Add VWF code

This commit is contained in:
jeffman 2015-03-13 19:03:48 -04:00
parent 9f97303106
commit 47ccb76f95
12 changed files with 1862 additions and 0 deletions

BIN
m2-coord-table.bin Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

180
m2-customcodes.asm Normal file
View File

@ -0,0 +1,180 @@
m2_customcodes:
//==============================================================================
// void parse(int code, char* parserAddress, WINDOW* window)
// In:
// r0: code
// r1: parser address
// r2: window
// Out:
// r0: control code length (0 if not matched)
//==============================================================================
.parse:
print "m2-customcodes.parse: $",pc
push {r1-r6,lr}
mov r6,#0
ldr r3,=#m2_custom_wram
add r3,r3,#4
mov r4,r0
// Get the window number
mov r0,r2
bl m2_vwf.get_window_number
//--------------------------------
// 60 FF XX: Add XX pixels to the renderer
cmp r4,#0x60
bne +
mov r6,#3
// Get the current X offset
ldrb r4,[r3,r0]
// Get the current X tile
mov r5,#0x2A
ldrb r5,[r2,r5]
lsl r5,r5,#3
add r4,r4,r5 // Current X location (in pixels)
// Get the value to add
ldrb r5,[r1,#2] // Control code parameter
add r4,r4,r5 // New X location
// Store the pixel offset of the new location
.store_x:
lsl r5,r4,#29
lsr r5,r5,#29
strb r5,[r3,r0]
// Store the X tile of the new location
lsr r4,r4,#3
mov r5,#0x2A
strb r4,[r2,r5]
b .parse_end
+
//--------------------------------
// 5F FF XX: Set the X value of the renderer
cmp r4,#0x5F
bne +
mov r6,#3
// Get the new X value
ldrb r4,[r1,#2]
b .store_x
+
//--------------------------------
.parse_end:
mov r0,r6
pop {r1-r6,pc}
//==============================================================================
// void check_main(byte code, char* parserAddress, WINDOW* window)
// In:
// r0: code
// r7: parser address
// r5: window
//==============================================================================
.check_main:
push {r1-r3,lr}
//--------------------------------
mov r1,r7
mov r2,r5
bl .parse
cmp r0,#0
bne +
mov r0,#2
+
//--------------------------------
// Clobbered code
ldr r3,[r6,#0]
add r3,r3,r0
mov r0,r3
//--------------------------------
pop {r1-r3,pc}
//==============================================================================
// void check_status(char* parserAddress, WINDOW* window)
// In:
// r2: parser address
// r4: window
//==============================================================================
.check_status:
push {lr}
ldrb r0,[r2,#0]
cmp r0,#1
bne +
pop {r0}
mov lr,r0
ldr r0,=#0x80C90A9
bx r0
+
//--------------------------------
push {r0-r2}
mov r1,r2
mov r2,r4
bl .parse
mov r7,r0
cmp r0,#0
pop {r0-r2}
bne +
// It wasn't one of our codes, so let the game continue checking
pop {r7}
mov lr,r7
ldr r7,=#0x80C90CD
bx r7
+
//--------------------------------
mov r0,r12
add r0,r0,r7
str r0,[r4,#0x14]
pop {r7}
mov lr,r7
ldr r7,=#0x80C904D
bx r7
//==============================================================================
// void check_selection_menu(char* parserAddress, WINDOW* window)
// In:
// r3: parser address
// r4: window
//==============================================================================
.check_selection_menu:
push {r0-r2,lr}
//--------------------------------
ldrb r0,[r3,#0]
mov r1,r3
mov r2,r4
bl .parse
cmp r0,#0
bne +
mov r0,#2
+
add r3,r3,r0
//--------------------------------
pop {r0-r2,pc}

BIN
m2-font-main.bin Normal file

Binary file not shown.

BIN
m2-font-relocate.bin Normal file

Binary file not shown.

BIN
m2-font-saturn.bin Normal file

Binary file not shown.

BIN
m2-mainfont1-empty.bin Normal file

Binary file not shown.

BIN
m2-mainfont2-empty.bin Normal file

Binary file not shown.

BIN
m2-mainfont3-empty.bin Normal file

Binary file not shown.

172
m2-status-initial.asm Normal file
View File

@ -0,0 +1,172 @@
// Status window: level
org $80C0BB8
mov r3,#6
mul r3,r4
mov r2,#56
sub r2,r2,r3
org $80C0BC6
mov r3,#8
bl m2_formatting.status1
// Status window: max HP
org $80C0C10
mov r5,#6
mul r4,r5
mov r5,#147
sub r4,r5,r4
org $80C0C20
mov r3,#56
bl m2_formatting.status1
// Status window: current HP
org $80C0C6C
mov r5,#6
mul r4,r5
mov r5,#120
sub r4,r5,r4
org $80C0C7C
mov r3,#56
bl m2_formatting.status1
// Status window: max PP
org $80C0CC8
mov r0,#6
mul r4,r0
mov r0,#147
sub r4,r0,r4
org $80C0CD8
mov r3,#72
bl m2_formatting.status1
// Status window: current PP
org $80C0D24
mov r5,#6
mul r4,r5
mov r5,#120
org $80C0D30
sub r2,r5,r4
mov r3,#72
bl m2_formatting.status1
// Status window: total exp
org $80C0D82
mov r1,#6
mul r4,r1
mov r1,#147
sub r4,r1,r4
org $80C0D92
mov r3,#88
bl m2_formatting.status1
// Status window: exp to next level
org $80C0E02
mov r3,#6
mul r4,r3
mov r3,#61
sub r4,r3,r4
org $80C0E12
mov r3,#104
bl m2_formatting.status1
// Status window: offense
org $80C0E90
mov r6,#6
mul r4,r6
mov r6,#225
sub r4,r6,r4
org $80C0EA0
mov r3,#8
bl m2_formatting.status1
// Status window: defense
org $80C0EEA
mov r2,#6
mul r4,r2
sub r4,r6,r4
org $80C0EF8
mov r3,#24
bl m2_formatting.status1
// Status window: speed
org $80C0F42
mov r2,#6
mul r4,r2
sub r4,r6,r4
org $80C0F50
mov r3,#40
bl m2_formatting.status1
// Status window: guts
org $80C0F9A
mov r2,#6
mul r4,r2
sub r4,r6,r4
org $80C0FA8
mov r3,#56
bl m2_formatting.status1
// Status window: vitality
org $80C0FF2
mov r2,#6
mul r4,r2
sub r4,r6,r4
org $80C1000
mov r3,#72
bl m2_formatting.status1
// Status window: IQ
org $80C104A
mov r2,#6
mul r4,r2
sub r4,r6,r4
org $80C1058
mov r3,#88
bl m2_formatting.status1
// Status window: Luck
org $80C10A2
mov r2,#6
mul r4,r2
sub r6,r6,r4
org $80C10B0
mov r3,#104
bl m2_formatting.status1
// Status window: Press A for PSI info
org $80C10F2
mov r2,#44
mov r3,#120
bl m2_formatting.status1
org $80C0BB4; bl m2_formatting.status_clear
org $80C0C0C; nop; nop // spaces
org $80C0C68; nop; nop // spaces
org $80C0CC4; nop; nop // spaces
org $80C0D20; nop; nop // spaces
org $80C0D7E; nop; nop // spaces
org $80C0DFE; nop; nop // spaces
org $80C06F0; nop; nop // ?
org $80C0E8C; nop; nop // spaces
org $80C0EE6; nop; nop // spaces
org $80C0F3E; nop; nop // spaces
org $80C0F96; nop; nop // spaces
org $80C0FEE; nop; nop // spaces
org $80C1046; nop; nop // spaces
org $80C109E; nop; nop // spaces
org $80C1112; nop; nop
org $80C11AC; nop; nop
org $80C11D2; nop; nop

170
m2-status-switch.asm Normal file
View File

@ -0,0 +1,170 @@
// Status window: level
org $80C139C
mov r3,#6
mul r3,r4
mov r2,#56
sub r2,r2,r3
org $80C13AA
mov r3,#8
bl m2_formatting.status1
// Status window: max HP
org $80C13F6
mov r5,#6
mul r4,r5
mov r5,#147
sub r4,r5,r4
org $80C1406
mov r3,#56
bl m2_formatting.status1
// Status window: current HP
org $80C1452
mov r5,#6
mul r4,r5
mov r5,#120
sub r4,r5,r4
org $80C1462
mov r3,#56
bl m2_formatting.status1
// Status window: max PP
org $80C14AE
mov r0,#6
mul r4,r0
mov r0,#147
sub r4,r0,r4
org $80C14BE
mov r3,#72
bl m2_formatting.status1
// Status window: current PP
org $80C150A
mov r3,#6
mul r4,r3
mov r3,#120
org $80C1516
sub r2,r3,r4
mov r3,#72
bl m2_formatting.status1
// Status window: total exp
org $80C156A
mov r1,#6
mul r4,r1
mov r1,#147
sub r4,r1,r4
org $80C157A
mov r3,#88
bl m2_formatting.status1
// Status window: exp to next level
org $80C15EC
mov r0,#6
mul r4,r0
mov r0,#61
sub r4,r0,r4
org $80C15FC
mov r3,#104
bl m2_formatting.status1
// Status window: offense
org $80C167C
mov r6,#6
mul r4,r6
mov r6,#225
sub r4,r6,r4
org $80C168C
mov r3,#8
bl m2_formatting.status1
// Status window: defense
org $80C16D6
mov r2,#6
mul r4,r2
sub r4,r6,r4
org $80C16E4
mov r3,#24
bl m2_formatting.status1
// Status window: speed
org $80C172E
mov r2,#6
mul r4,r2
sub r4,r6,r4
org $80C173C
mov r3,#40
bl m2_formatting.status1
// Status window: guts
org $80C1786
mov r2,#6
mul r4,r2
sub r4,r6,r4
org $80C1794
mov r3,#56
bl m2_formatting.status1
// Status window: vitality
org $80C17DE
mov r2,#6
mul r4,r2
sub r4,r6,r4
org $80C17EC
mov r3,#72
bl m2_formatting.status1
// Status window: IQ
org $80C1836
mov r2,#6
mul r4,r2
sub r4,r6,r4
org $80C1844
mov r3,#88
bl m2_formatting.status1
// Status window: Luck
org $80C188E
mov r2,#6
mul r4,r2
sub r6,r6,r4
org $80C189C
mov r3,#104
bl m2_formatting.status1
// Status window: Press A for PSI info
org $80C18DA
mov r2,#44
mov r3,#120
bl m2_formatting.status1
org $80C1398; bl m2_formatting.status_clear
org $80C13F2; nop; nop // spaces
org $80C144E; nop; nop // spaces
org $80C14AA; nop; nop // spaces
org $80C1506; nop; nop // spaces
org $80C1566; nop; nop // spaces
org $80C15E8; nop; nop // spaces
org $80C162A; nop; nop // ?
org $80C1678; nop; nop // spaces
org $80C16D2; nop; nop // spaces
org $80C172A; nop; nop // spaces
org $80C17DA; nop; nop // spaces
org $80C1832; nop; nop // spaces
org $80C188A; nop; nop // spaces
org $80C1782; nop; nop
org $80C11AC; nop; nop
org $80C11D2; nop; nop

1340
m2-vwf.asm Normal file

File diff suppressed because it is too large Load Diff

BIN
m2-widths-main.bin Normal file

Binary file not shown.