improve input handling

This commit is contained in:
notaz 2013-08-17 03:04:15 +03:00
parent be7867d875
commit 531a8f3883
12 changed files with 170 additions and 108 deletions

View file

@ -9,7 +9,6 @@
.equ SRR_MAPPED, (1 << 0)
.equ SRR_READONLY, (1 << 1)
.equ SRF_EEPROM, (1 << 1)
.equ POPT_6BTN_PAD, (1 << 5)
.equ POPT_EN_32X, (1 << 20)
.text
@ -67,24 +66,7 @@ m_read8_eeprom:
PicoRead8_io: @ u32 a, u32 d
bic r2, r0, #0x001f @ most commonly we get i/o port read,
cmp r2, #0xa10000 @ so check for it first
bne m_read8_not_io
m_read8_misc_io:
ands r0, r0, #0x1e
beq m_read8_misc_hwreg
cmp r0, #4
movlt r0, #0
moveq r0, #1
ble PadRead
ldr r3, =(Pico+0x22000)
mov r0, r0, lsr #1 @ other IO ports (Pico.ioports[a])
ldrb r0, [r3, r0]
bx lr
m_read8_misc_hwreg:
ldr r3, =(Pico+0x22200)
ldrb r0, [r3, #0x0f] @ Pico.m.hardware
bx lr
beq io_ports_read
m_read8_not_io:
and r2, r0, #0xfc00
@ -161,7 +143,7 @@ PicoRead16_io: @ u32 a, u32 d
cmp r2, #0xa10000 @ so check for it first
bne m_read16_not_io
stmfd sp!,{lr}
bl m_read8_misc_io @ same as read8
bl io_ports_read @ same as read8
orr r0, r0, r0, lsl #8 @ only has bytes mirrored
ldmfd sp!,{pc}
@ -201,37 +183,7 @@ PicoWrite8_io: @ u32 a, u32 d
bic r2, r0, #0x1e @ most commonly we get i/o port write,
eor r2, r2, #0xa10000 @ so check for it first
eors r2, r2, #1
bne m_write8_not_io
m_write8_io:
ldr r2, =PicoOpt
and r0, r0, #0x1e
ldr r2, [r2]
ldr r3, =(Pico+0x22000) @ Pico.ioports
tst r2, #POPT_6BTN_PAD
beq m_write8_io_done
cmp r0, #2
cmpne r0, #4
bne m_write8_io_done @ not likely to happen
add r2, r3, #0x200 @ Pico+0x22200
mov r12,#0
cmp r0, #2
streqb r12,[r2,#0x18]
strneb r12,[r2,#0x19] @ Pico.m.padDelay[i] = 0
tst r1, #0x40 @ TH
beq m_write8_io_done
ldrb r12,[r3, r0, lsr #1]
tst r12,#0x40
bne m_write8_io_done
cmp r0, #2
ldreqb r12,[r2,#0x0a]
ldrneb r12,[r2,#0x0b] @ Pico.m.padTHPhase
add r12,r12,#1
streqb r12,[r2,#0x0a]
strneb r12,[r2,#0x0b] @ Pico.m.padTHPhase
m_write8_io_done:
strb r1, [r3, r0, lsr #1]
bx lr
beq io_ports_write
m_write8_not_io:
tst r0, #1
@ -270,7 +222,7 @@ m_write8_not_sreg:
PicoWrite16_io: @ u32 a, u32 d
bic r2, r0, #0x1f @ most commonly we get i/o port write,
cmp r2, #0xa10000 @ so check for it first
beq m_write8_io
beq io_ports_write
m_write16_not_io:
and r2, r0, #0xff00