Cleaned up m2_vwf.weld_entry
This commit is contained in:
parent
7551009bef
commit
5fb82a5613
69
m2-vwf.asm
69
m2-vwf.asm
|
@ -40,72 +40,51 @@ pop {r1-r5,pc}
|
||||||
|
|
||||||
//--------------------------------
|
//--------------------------------
|
||||||
.weld_entry:
|
.weld_entry:
|
||||||
push {r0-r7,lr}
|
push {r0-r5,lr}
|
||||||
add sp,#-28
|
|
||||||
mov r5,r0
|
|
||||||
|
|
||||||
//--------------------------------
|
// Check for valid character value
|
||||||
// Get the char
|
mov r4,r0
|
||||||
ldrb r0,[r1,#0]
|
ldrb r0,[r1,#0]
|
||||||
sub r0,#0x50
|
sub r0,#0x50
|
||||||
bpl +
|
bpl +
|
||||||
mov r0,#0x1F // Replace char with ? if it's invalid
|
mov r0,#0x1F
|
||||||
b .char_custom
|
b .weld_entry_valid
|
||||||
+
|
+
|
||||||
cmp r0,#0x60
|
cmp r0,#0x60
|
||||||
bcc .char_custom
|
bcc .weld_entry_valid
|
||||||
mov r0,#0x1F
|
mov r0,#0x1F
|
||||||
|
|
||||||
.char_custom:
|
.weld_entry_valid:
|
||||||
str r0,[sp,#0x0]
|
|
||||||
// [sp+0] = char
|
|
||||||
|
|
||||||
//--------------------------------
|
// Calculate X coord
|
||||||
// Get the current X
|
ldrh r1,[r4,#0x22] // window_X
|
||||||
ldrh r1,[r5,#0x22]
|
mov r5,r1
|
||||||
ldrh r2,[r5,#0x2A]
|
ldrh r2,[r4,#0x2A] // text_X
|
||||||
add r1,r1,r2
|
add r1,r1,r2
|
||||||
str r1,[sp,#4]
|
|
||||||
lsl r1,r1,#3
|
lsl r1,r1,#3
|
||||||
ldrh r2,[r5,#2]
|
ldrh r2,[r4,#2] // pixel_X
|
||||||
str r2,[sp,#24]
|
add r1,r1,r2 // screen pixel X
|
||||||
add r1,r1,r2 // Current pixel X
|
|
||||||
str r1,[sp,#20]
|
|
||||||
|
|
||||||
// Get the current Y
|
// Calculate Y coord
|
||||||
ldrh r2,[r5,#0x24]
|
ldrh r2,[r4,#0x24] // window_Y
|
||||||
ldrh r3,[r5,#0x2C]
|
ldrh r3,[r4,#0x2C] // text_Y
|
||||||
add r2,r2,r3
|
add r2,r2,r3
|
||||||
str r2,[sp,#8]
|
|
||||||
lsl r2,r2,#3
|
lsl r2,r2,#3
|
||||||
|
|
||||||
//--------------------------------
|
|
||||||
// Print
|
// Print
|
||||||
ldr r0,[sp,#0x0]
|
mov r3,#0 // font
|
||||||
mov r3,#0
|
|
||||||
bl .print_character
|
bl .print_character
|
||||||
str r0,[sp,#12]
|
|
||||||
|
|
||||||
//--------------------------------
|
// Store new X coords
|
||||||
// Figure out new window coords
|
add r0,r0,r1 // new screen pixel_X
|
||||||
ldr r0,[sp,#20]
|
|
||||||
ldr r1,[sp,#12]
|
|
||||||
add r0,r0,r1
|
|
||||||
|
|
||||||
// Store new window coords
|
|
||||||
lsr r1,r0,#3
|
lsr r1,r0,#3
|
||||||
ldrh r2,[r5,#0x22]
|
sub r1,r1,r5 // new text_X
|
||||||
sub r1,r1,r2
|
strh r1,[r4,#0x2A]
|
||||||
strh r1,[r5,#0x2A]
|
|
||||||
|
|
||||||
// Store new pixel X
|
|
||||||
lsl r0,r0,#29
|
lsl r0,r0,#29
|
||||||
lsr r0,r0,#29
|
lsr r0,r0,#29 // new pixel_X
|
||||||
strh r0,[r5,#2]
|
strh r0,[r4,#2]
|
||||||
|
|
||||||
//--------------------------------
|
pop {r0-r5,pc}
|
||||||
add sp,#28
|
|
||||||
pop {r0-r7,pc}
|
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
Loading…
Reference in New Issue