1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-24 02:58:06 +11:00

zasm: optimize handleRST a little bit

This commit is contained in:
Virgil Dupras 2019-11-12 19:45:56 -05:00
parent 4de2ce3ceb
commit 0e9173a89a

View File

@ -559,16 +559,14 @@ handleLDrr:
handleRST: handleRST:
ld a, (INS_CURARG1+1) ld a, (INS_CURARG1+1)
; verify that A is either 0x08, 0x10, 0x18, 0x20, 0x28, 0x30 or 0x38. ; verify that A is either 0x08, 0x10, 0x18, 0x20, 0x28, 0x30 or 0x38.
; Good news: they're all multiples of 8. ; Good news: the relevant bits (bits 5:3) are already in place. We only
; to verify that we're within range, we to 8-bit rotation. If any of ; have to verify that they're surrounded by zeroes.
; the first 3 bytes are set (thus not a multiple of 8), the cp 8 ld c, 0b11000111
; later will yield NC because those bits will now be upwards. and c
rrca \ rrca \ rrca jr nz, .error
cp 8 ; We're in range. good.
jr nc, .error ld a, (INS_CURARG1+1)
; good, we have a proper arg. Now let's get those 3 bits in position or c
rlca \ rlca \ rlca
or 0b11000111
ld (INS_UPCODE), a ld (INS_UPCODE), a
ld c, 1 ld c, 1
ret ret