pokeemerald/asm/gpu_reg_manager.s

427 lines
6.7 KiB
ArmAsm
Raw Normal View History

2015-10-06 14:46:30 +02:00
thumb_func_start lcd_io_copy_queue_clean
2015-10-10 12:12:48 +02:00
; void lcd_io_copy_queue_clean()
lcd_io_copy_queue_clean: ; 8000FE4
2015-10-06 14:46:30 +02:00
push {r4-r7,lr}
mov r7, r8
push {r7}
movs r2, 0
ldr r7, =0x030008d8
ldr r0, =0x030008d9
mov r12, r0
ldr r1, =0x030008da
mov r8, r1
ldr r6, =0x03000818
movs r5, 0
ldr r4, =0x03000878
movs r3, 0xFF
2015-10-10 12:12:48 +02:00
@08000FFE:
2015-10-06 14:46:30 +02:00
adds r0, r2, r6
strb r5, [r0]
adds r1, r2, r4
ldrb r0, [r1]
orrs r0, r3
strb r0, [r1]
adds r2, 0x1
cmp r2, 0x5F
2015-10-10 12:12:48 +02:00
ble @08000FFE
2015-10-06 14:46:30 +02:00
movs r0, 0
strb r0, [r7]
mov r1, r12
strb r0, [r1]
movs r0, 0
mov r1, r8
strh r0, [r1]
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_copy_queue_clean
thumb_func_start lcd_io_buffer_to_hardware
2015-10-10 12:12:48 +02:00
; void lcd_io_buffer_to_hardware(u8 reg)
lcd_io_buffer_to_hardware: ; 800103C
2015-10-06 14:46:30 +02:00
push {lr}
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0x4
2015-10-10 12:12:48 +02:00
bne @08001068
2015-10-06 14:46:30 +02:00
ldr r2, =0x04000004
ldrh r1, [r2]
ldr r0, =0x0000ffe7
ands r0, r1
strh r0, [r2]
ldr r1, =0x0300081c
ldrh r0, [r2]
ldrh r1, [r1]
orrs r0, r1
strh r0, [r2]
2015-10-10 12:12:48 +02:00
b @08001076
2015-10-06 14:46:30 +02:00
.align 2, 0
.pool
2015-10-10 12:12:48 +02:00
@08001068:
2015-10-06 14:46:30 +02:00
movs r0, 0x80
lsls r0, 19
adds r0, r2, r0
ldr r1, =0x03000818
adds r1, r2, r1
ldrh r1, [r1]
strh r1, [r0]
2015-10-10 12:12:48 +02:00
@08001076:
2015-10-06 14:46:30 +02:00
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_buffer_to_hardware
thumb_func_start lcd_io_copy_queue_process
2015-10-10 12:12:48 +02:00
; void lcd_io_copy_queue_process()
lcd_io_copy_queue_process: ; 8001080
2015-10-06 14:46:30 +02:00
push {r4,r5,lr}
ldr r0, =0x030008d8
ldrb r0, [r0]
cmp r0, 0
2015-10-10 12:12:48 +02:00
bne @080010A4
2015-10-06 14:46:30 +02:00
movs r5, 0
2015-10-10 12:12:48 +02:00
@0800108C:
2015-10-06 14:46:30 +02:00
ldr r0, =0x03000878
adds r4, r5, r0
ldrb r0, [r4]
cmp r0, 0xFF
2015-10-10 12:12:48 +02:00
beq @080010A4
2015-10-06 14:46:30 +02:00
bl lcd_io_buffer_to_hardware
movs r0, 0xFF
strb r0, [r4]
adds r5, 0x1
cmp r5, 0x5F
2015-10-10 12:12:48 +02:00
ble @0800108C
@080010A4:
2015-10-06 14:46:30 +02:00
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_copy_queue_process
thumb_func_start lcd_io_set
2015-10-10 12:12:48 +02:00
; void lcd_io_set(u8 reg, u16 value)
lcd_io_set: ; 80010B4
2015-10-06 14:46:30 +02:00
push {r4,r5,lr}
lsls r0, 24
lsrs r4, r0, 24
lsls r1, 16
lsrs r1, 16
cmp r4, 0x5F
2015-10-10 12:12:48 +02:00
bhi @08001130
2015-10-06 14:46:30 +02:00
ldr r0, =0x03000818
adds r0, r4, r0
strh r1, [r0]
ldr r0, =0x04000006
ldrh r1, [r0]
movs r0, 0xFF
ands r0, r1
subs r0, 0xA1
lsls r0, 16
lsrs r0, 16
cmp r0, 0x40
2015-10-10 12:12:48 +02:00
bls @080010E8
2015-10-06 14:46:30 +02:00
movs r0, 0x80
lsls r0, 19
ldrh r1, [r0]
movs r0, 0x80
ands r0, r1
cmp r0, 0
2015-10-10 12:12:48 +02:00
beq @080010FE
@080010E8:
2015-10-06 14:46:30 +02:00
adds r0, r4, 0
bl lcd_io_buffer_to_hardware
2015-10-10 12:12:48 +02:00
b @08001130
2015-10-06 14:46:30 +02:00
.align 2, 0
.pool
2015-10-10 12:12:48 +02:00
@080010F8:
2015-10-06 14:46:30 +02:00
movs r0, 0
strb r0, [r5]
2015-10-10 12:12:48 +02:00
b @08001130
@080010FE:
2015-10-06 14:46:30 +02:00
ldr r2, =0x030008d8
movs r0, 0x1
strb r0, [r2]
movs r3, 0
ldr r0, =0x03000878
ldrb r1, [r0]
adds r5, r2, 0
adds r2, r0, 0
cmp r1, 0xFF
2015-10-10 12:12:48 +02:00
beq @08001128
2015-10-06 14:46:30 +02:00
adds r1, r2, 0
2015-10-10 12:12:48 +02:00
@08001114:
2015-10-06 14:46:30 +02:00
ldrb r0, [r1]
cmp r0, r4
2015-10-10 12:12:48 +02:00
beq @080010F8
2015-10-06 14:46:30 +02:00
adds r1, 0x1
adds r3, 0x1
cmp r3, 0x5F
2015-10-10 12:12:48 +02:00
bgt @08001128
2015-10-06 14:46:30 +02:00
ldrb r0, [r1]
cmp r0, 0xFF
2015-10-10 12:12:48 +02:00
bne @08001114
@08001128:
2015-10-06 14:46:30 +02:00
adds r0, r3, r2
movs r1, 0
strb r4, [r0]
strb r1, [r5]
2015-10-10 12:12:48 +02:00
@08001130:
2015-10-06 14:46:30 +02:00
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_set
thumb_func_start lcd_io_set_forced_blank
2015-10-10 12:12:48 +02:00
; void lcd_io_set_forced_blank(u8 reg, u16 value)
lcd_io_set_forced_blank: ; 8001140
2015-10-06 14:46:30 +02:00
push {r4,r5,lr}
lsls r0, 24
lsrs r4, r0, 24
lsls r1, 16
lsrs r1, 16
cmp r4, 0x5F
2015-10-10 12:12:48 +02:00
bhi @080011A8
2015-10-06 14:46:30 +02:00
ldr r0, =0x03000818
adds r0, r4, r0
strh r1, [r0]
movs r0, 0x80
lsls r0, 19
ldrh r1, [r0]
movs r0, 0x80
ands r0, r1
cmp r0, 0
2015-10-10 12:12:48 +02:00
beq @08001176
2015-10-06 14:46:30 +02:00
adds r0, r4, 0
bl lcd_io_buffer_to_hardware
2015-10-10 12:12:48 +02:00
b @080011A8
2015-10-06 14:46:30 +02:00
.align 2, 0
.pool
2015-10-10 12:12:48 +02:00
@08001170:
2015-10-06 14:46:30 +02:00
movs r0, 0
strb r0, [r5]
2015-10-10 12:12:48 +02:00
b @080011A8
@08001176:
2015-10-06 14:46:30 +02:00
ldr r2, =0x030008d8
movs r0, 0x1
strb r0, [r2]
movs r3, 0
ldr r0, =0x03000878
ldrb r1, [r0]
adds r5, r2, 0
adds r2, r0, 0
cmp r1, 0xFF
2015-10-10 12:12:48 +02:00
beq @080011A0
2015-10-06 14:46:30 +02:00
adds r1, r2, 0
2015-10-10 12:12:48 +02:00
@0800118C:
2015-10-06 14:46:30 +02:00
ldrb r0, [r1]
cmp r0, r4
2015-10-10 12:12:48 +02:00
beq @08001170
2015-10-06 14:46:30 +02:00
adds r1, 0x1
adds r3, 0x1
cmp r3, 0x5F
2015-10-10 12:12:48 +02:00
bgt @080011A0
2015-10-06 14:46:30 +02:00
ldrb r0, [r1]
cmp r0, 0xFF
2015-10-10 12:12:48 +02:00
bne @0800118C
@080011A0:
2015-10-06 14:46:30 +02:00
adds r0, r3, r2
movs r1, 0
strb r4, [r0]
strb r1, [r5]
2015-10-10 12:12:48 +02:00
@080011A8:
2015-10-06 14:46:30 +02:00
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_set_forced_blank
thumb_func_start lcd_io_get
2015-10-10 12:12:48 +02:00
; u16 lcd_io_get(u8 reg)
lcd_io_get: ; 80011B8
2015-10-06 14:46:30 +02:00
push {lr}
lsls r0, 24
lsrs r0, 24
adds r1, r0, 0
cmp r1, 0x4
2015-10-10 12:12:48 +02:00
bne @080011CC
2015-10-06 14:46:30 +02:00
ldr r0, =0x04000004
2015-10-10 12:12:48 +02:00
b @080011DE
2015-10-06 14:46:30 +02:00
.align 2, 0
.pool
2015-10-10 12:12:48 +02:00
@080011CC:
2015-10-06 14:46:30 +02:00
cmp r1, 0x6
2015-10-10 12:12:48 +02:00
beq @080011DC
2015-10-06 14:46:30 +02:00
ldr r0, =0x03000818
adds r0, r1, r0
ldrh r0, [r0]
2015-10-10 12:12:48 +02:00
b @080011E0
2015-10-06 14:46:30 +02:00
.align 2, 0
.pool
2015-10-10 12:12:48 +02:00
@080011DC:
2015-10-06 14:46:30 +02:00
ldr r0, =0x04000006
2015-10-10 12:12:48 +02:00
@080011DE:
2015-10-06 14:46:30 +02:00
ldrh r0, [r0]
2015-10-10 12:12:48 +02:00
@080011E0:
2015-10-06 14:46:30 +02:00
pop {r1}
bx r1
.align 2, 0
.pool
thumb_func_end lcd_io_get
thumb_func_start lcd_io_set_bits
2015-10-10 12:12:48 +02:00
; void lcd_io_set_bits(u8 reg, u16 mask)
lcd_io_set_bits: ; 80011E8
2015-10-06 14:46:30 +02:00
push {lr}
adds r2, r1, 0
lsls r0, 24
lsrs r0, 24
ldr r1, =0x03000818
adds r1, r0, r1
ldrh r1, [r1]
orrs r1, r2
lsls r1, 16
lsrs r1, 16
bl lcd_io_set
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_set_bits
thumb_func_start lcd_io_clear_bits
2015-10-10 12:12:48 +02:00
; void lcd_io_clear_bits(u8 reg, u16 mask)
lcd_io_clear_bits: ; 8001208
2015-10-06 14:46:30 +02:00
push {lr}
adds r2, r1, 0
lsls r0, 24
lsrs r0, 24
lsls r2, 16
ldr r1, =0x03000818
adds r1, r0, r1
ldrh r1, [r1]
lsrs r2, 16
bics r1, r2
bl lcd_io_set
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_clear_bits
thumb_func_start update_hardware_IE
2015-10-10 12:12:48 +02:00
; void update_hardware_IE()
update_hardware_IE: ; 8001228
2015-10-06 14:46:30 +02:00
push {r4,r5,lr}
ldr r5, =0x030008d9
ldrb r0, [r5]
cmp r0, 0
2015-10-10 12:12:48 +02:00
beq @08001246
2015-10-06 14:46:30 +02:00
ldr r2, =0x04000208
ldrh r1, [r2]
movs r4, 0
strh r4, [r2]
ldr r3, =0x04000200
ldr r0, =0x030008da
ldrh r0, [r0]
strh r0, [r3]
strh r1, [r2]
strb r4, [r5]
2015-10-10 12:12:48 +02:00
@08001246:
2015-10-06 14:46:30 +02:00
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end update_hardware_IE
thumb_func_start enable_irqs
2015-10-10 12:12:48 +02:00
; void enable_irqs(u16 value)
enable_irqs: ; 800125C
2015-10-06 14:46:30 +02:00
push {r4,lr}
lsls r0, 16
lsrs r0, 16
ldr r4, =0x030008da
ldrh r1, [r4]
orrs r0, r1
strh r0, [r4]
ldr r1, =0x030008d9
movs r0, 0x1
strb r0, [r1]
bl update_hardware_IE
ldrh r0, [r4]
bl dispstat_set_vblank_hblank_irqs
pop {r4}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end enable_irqs
thumb_func_start disable_irqs
2015-10-10 12:12:48 +02:00
; void disable_irqs(u16 value)
disable_irqs: ; 8001288
2015-10-06 14:46:30 +02:00
push {r4,lr}
lsls r0, 16
lsrs r0, 16
ldr r4, =0x030008da
ldrh r1, [r4]
bics r1, r0
strh r1, [r4]
ldr r1, =0x030008d9
movs r0, 0x1
strb r0, [r1]
bl update_hardware_IE
ldrh r0, [r4]
bl dispstat_set_vblank_hblank_irqs
pop {r4}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end disable_irqs
thumb_func_start dispstat_set_vblank_hblank_irqs
2015-10-10 12:12:48 +02:00
; void dispstat_set_vblank_hblank_irqs(u16 value)
dispstat_set_vblank_hblank_irqs: ; 80012B4
2015-10-06 14:46:30 +02:00
push {r4,lr}
adds r4, r0, 0
lsls r4, 16
lsrs r4, 16
movs r0, 0x4
bl lcd_io_get
movs r2, 0x18
ands r2, r0
movs r1, 0x1
ands r1, r4
negs r0, r1
orrs r0, r1
asrs r1, r0, 31
movs r0, 0x8
ands r1, r0
movs r0, 0x2
ands r0, r4
cmp r0, 0
2015-10-10 12:12:48 +02:00
beq @080012E0
2015-10-06 14:46:30 +02:00
movs r0, 0x10
orrs r1, r0
2015-10-10 12:12:48 +02:00
@080012E0:
2015-10-06 14:46:30 +02:00
cmp r2, r1
2015-10-10 12:12:48 +02:00
beq @080012EA
2015-10-06 14:46:30 +02:00
movs r0, 0x4
bl lcd_io_set
2015-10-10 12:12:48 +02:00
@080012EA:
2015-10-06 14:46:30 +02:00
pop {r4}
pop {r0}
bx r0
thumb_func_end dispstat_set_vblank_hblank_irqs