Completely rewrite the intro screen

This commit is contained in:
Sterophonick 2020-05-18 14:19:05 -07:00
parent 0106094cf1
commit b0ae8f7a66
1 changed files with 72 additions and 86 deletions

View File

@ -1,117 +1,103 @@
REG_DISPCNT equ 0x04000000 //Display Control, 16-bit
REG_DISPSTAT equ 0x04000004 //General LCD Status
REG_BG0CNT equ 0x04000008 //BG0 Control
REG_IME equ 0x04000208 //Interrupt Master Enable Register
REG_IE equ 0x04000200 //Interrupt Enable Register
REG_IF equ 0x04000202 //Interrupt Request Flags / IRQ Acknowledge
REG_BLDCNT equ 0x04000050 //Color Special Effects Selection
REG_BLDY equ 0x04000054 //Brightness Coefficient
REG_BASE equ 0x04000000 //Display Control, 16-bit
REG_DISPSTAT equ 0x4 //General LCD Status
REG_BG0CNT equ 0x8 //BG0 Control
REG_IME equ 0x208 //Interrupt Master Enable Register
REG_IE equ 0x200 //Interrupt Enable Register
REG_IF equ 0x202 //Interrupt Request Flags / IRQ Acknowledge
REG_BLDCNT equ 0x50 //Color Special Effects Selection
REG_BLDY equ 0x54 //Brightness Coefficient
VRAM equ 0x06000000 //Video RAM, 16-bit
BGCRAM equ 0x05000000 //BG Color RAM, 16-bit
REG_KEYINPUT equ 0x04000130 //Key Status
REG_KEYINPUT equ 0x130 //Key Status
LZ77UnCompVRAM equ #18
// Note: THIS IS A TERRIBLE WAY OF DOING THIS STUFF... TOO BAD!
RegisterRamReset equ 1
m12_intro_screen:
push {r0-r4}
ldr r0,=REG_DISPCNT
mov r1,#0xFF
add r1,r1,#1
strh r1,[r0]
ldr r0,=REG_DISPSTAT
mov r1,#8
strh r1,[r0]
push {r0-r5}
ldr r4,=REG_BASE
ldr r0,=#0x100
strh r0,[r4]
ldr r0,=REG_BG0CNT
mov r1,#0x80
strh r1,[r0]
mov r0,#8
strh r0,[r4,#REG_DISPSTAT]
ldr r0,=REG_IME
mov r1,#0x1
strh r1,[r0]
mov r0,#0x80
strh r0,[r4,#REG_BG0CNT]
ldr r0,=REG_IE
mov r1,#0x1
strh r1,[r0]
mov r0,#1
ldr r1,=#REG_IME
strh r0,[r4,r1]
ldr r1,=#REG_IE
strh r0,[r4,r1]
ldr r1,=#REG_IF
strh r0,[r4,r1]
ldr r0,=REG_IF
mov r1,#0x1
strh r1,[r0]
mov r0,#0xA1
ldr r1,=#REG_BLDCNT
strh r0,[r4,r1]
ldr r0,=REG_BLDCNT
mov r1,#0xA1
strh r1,[r0]
mov r0,#16
ldr r1,=#REG_BLDY
strh r0,[r4,r1]
ldr r0,=REG_BLDY
mov r1,#16
strh r1,[r0]
ldr r0,=disclaimer_palette
ldr r1,=BGCRAM
ldr r4,=#256*2
ldr r2,=#256*2
@@palette:
ldrh r3,[r0,r5]
strh r3,[r1,r5]
add r5,#2
cmp r5,r4
cmp r5,r2
bne @@palette
ldr r2,=#0x100
ldr r0,=disclaimer_map
ldr r1,=VRAM
ldr r4,=#1280
ldr r5,=#1280
@@map:
sub r4,#2
ldrh r3,[r0,r4]
sub r5,#2
ldrh r3,[r0,r5]
add r3,r2
strh r3,[r1,r4]
cmp r4,#0
strh r3,[r1,r5]
cmp r5,#0
bne @@map
ldr r0,=#disclaimer_graphics
ldr r1,=VRAM+0x4000
swi LZ77UnCompVRAM
ldr r2,=REG_BLDCNT
mov r4,#0x10
@@fadein:
strh r4,[r2,#4]
swi #5
swi #5 // 15 loops with 2 intrs each gives a total fade-in time of 0.5 seconds
sub r4,#1
bpl @@fadein
ldr r2,=REG_KEYINPUT
ldr r4,=#0x3FF
@@loop3:
swi #5 // VBlankIntrWait
ldrh r0,[r2,#0]
cmp r0,r4
beq @@loop3
@@next:
ldr r2,=REG_BLDCNT
mov r4,#0x00
@@fadeout:
strh r4,[r2,#4]
swi #5
swi #5 // 15 loops with 2 intrs each gives a total fade-in time of 0.5 seconds
add r4,#1
cmp r4,#0x11
bne @@fadeout
mov r0,#0
ldr r1,=BGCRAM
ldr r4,=#74
@@cpal:
sub r4,#2
strh r0,[r1,r4]
cmp r4,#0
bne @@cpal
pop {r0-r4}
ldr r5,=REG_BLDY
mov r2,#0x10
@@fadein:
strh r2,[r4,r5]
sub r2,#1
swi 5
swi 5
cmp r2,#0
bne @@fadein
ldr r5,=REG_KEYINPUT
ldr r2,=#0x3FF
@@keywait:
swi #5 // VBlankIntrWait
ldrh r0,[r4,r5]
cmp r0,r2
beq @@keywait
ldr r5,=REG_BLDY
mov r2,#0x0
@@fadeout:
strh r2,[r4,r5]
add r2,#1
swi 5
swi 5
cmp r2,#0x10
bne @@fadeout
mov r0,0b0011000
swi RegisterRamReset
pop {r0-r5}
push {lr}
ldr r0,=#0x3007FFC
str r1,[r0,#0]