Moved print_string to vwf.c
This commit is contained in:
parent
97b962c699
commit
b8864ffa52
|
@ -118,3 +118,22 @@ void weld_entry_custom(WINDOW *window, byte *str, int font, int foreground)
|
|||
window->pixel_x = x & 7;
|
||||
window->text_x = (x >> 3) - window->window_x;
|
||||
}
|
||||
|
||||
// Returns: ____XXXX = number of characters printed
|
||||
// XXXX____ = number of pixels printed
|
||||
int print_string(byte *str, int x, int y)
|
||||
{
|
||||
byte chr;
|
||||
int initial_x = x;
|
||||
int charCount = 0;
|
||||
|
||||
while ((chr = str[1]) != 0xFF)
|
||||
{
|
||||
chr = *str++;
|
||||
x += print_character(chr - 0x50, x, y, 0, 0xF);
|
||||
charCount++;
|
||||
}
|
||||
|
||||
int totalWidth = x - initial_x;
|
||||
return (charCount & 0xFFFF) | (totalWidth << 16);
|
||||
}
|
||||
|
|
|
@ -362,7 +362,8 @@ add r2,r2,r3
|
|||
lsl r2,r2,3 // r2 = tile_y * 8
|
||||
mov r0,r6
|
||||
bl print_string
|
||||
mov r7,r0
|
||||
lsl r0,r0,16
|
||||
lsr r7,r0,16
|
||||
b 0x80C9788
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
48
m2-vwf.asm
48
m2-vwf.asm
|
@ -1,47 +1,3 @@
|
|||
//=============================================================================
|
||||
// void print_string(char* str, int x, int y)
|
||||
// In:
|
||||
// r0: address of string to print
|
||||
// r1: x (pixel)
|
||||
// r2: y (pixel)
|
||||
// Out:
|
||||
// r0: number of characters printed
|
||||
// r1: number of pixels printed
|
||||
//=============================================================================
|
||||
|
||||
print_string:
|
||||
push {r2-r6,lr}
|
||||
|
||||
mov r5,0
|
||||
mov r6,r1
|
||||
mov r4,r0
|
||||
@@prev:
|
||||
ldrb r0,[r4,1]
|
||||
cmp r0,0xFF
|
||||
beq @@end
|
||||
ldrb r0,[r4,0]
|
||||
sub r0,0x50
|
||||
|
||||
push {r1-r3}
|
||||
add sp,-4
|
||||
mov r3,0xF
|
||||
str r3,[sp]
|
||||
mov r3,0
|
||||
bl print_character
|
||||
add sp,4
|
||||
pop {r1-r3}
|
||||
|
||||
add r1,r0,r1
|
||||
add r4,1
|
||||
add r5,1
|
||||
b @@prev
|
||||
|
||||
@@end:
|
||||
mov r0,r5
|
||||
sub r1,r1,r6
|
||||
pop {r2-r6,pc}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// void print_string_hlight_pixels(WINDOW* window, char* str, int x,
|
||||
// int y, bool highlight)
|
||||
|
@ -85,7 +41,9 @@ lsl r2,r2,3
|
|||
add r2,r2,r3
|
||||
mov r0,r6
|
||||
bl print_string
|
||||
mov r7,r0
|
||||
lsr r1,r0,16
|
||||
lsl r0,r0,16
|
||||
lsr r7,r0,16
|
||||
ldrh r0,[r5,0]
|
||||
lsl r0,r0,0x10
|
||||
asr r0,r0,0x1C
|
||||
|
|
Loading…
Reference in New Issue