mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-26 01:58:06 +11:00
Compare commits
2 Commits
17cc28e211
...
518df7a05e
Author | SHA1 | Date | |
---|---|---|---|
|
518df7a05e | ||
|
cbc6fb5931 |
@ -20,7 +20,6 @@
|
||||
; *** Requirements ***
|
||||
; strncmp
|
||||
; addDE
|
||||
; addHL
|
||||
; upcase
|
||||
; unsetZ
|
||||
; intoDE
|
||||
@ -34,7 +33,6 @@
|
||||
; fsFindFN
|
||||
; fsOpen
|
||||
; fsGetB
|
||||
; cpHLDE
|
||||
; parseArgs
|
||||
; _blkGetB
|
||||
; _blkPutB
|
||||
|
@ -1,8 +1,6 @@
|
||||
; *** Consts ***
|
||||
; Number of rows in the argspec table
|
||||
.equ ARGSPEC_TBL_CNT 33
|
||||
; Number of rows in the primary instructions table
|
||||
.equ INSTR_TBL_CNT 147
|
||||
; size in bytes of each row in the primary instructions table
|
||||
.equ INSTR_TBL_ROWSIZE 6
|
||||
; Instruction IDs They correspond to the index of the table in instrNames
|
||||
@ -873,15 +871,28 @@ parseInstruction:
|
||||
jr nz, .error ; A is set to error
|
||||
.nomorearg:
|
||||
; Parsing done, no error, let's move forward to instr row matching!
|
||||
; To speed up things a little, we use a poor man's indexing. Full
|
||||
; bisecting would involve too much complexity.
|
||||
ld a, c ; recall A param
|
||||
ld de, instrTBl
|
||||
ld b, INSTR_TBL_CNT
|
||||
cp I_EX
|
||||
jr c, .loop
|
||||
ld de, instrTBlEX
|
||||
cp I_LD
|
||||
jr c, .loop
|
||||
ld de, instrTBlLD
|
||||
cp I_RET
|
||||
jr c, .loop
|
||||
ld de, instrTBlRET
|
||||
.loop:
|
||||
ld a, c ; recall A param
|
||||
call matchPrimaryRow
|
||||
jr z, .match
|
||||
ld a, INSTR_TBL_ROWSIZE
|
||||
call addDE
|
||||
djnz .loop
|
||||
ld a, (de)
|
||||
cp 0xff
|
||||
jr nz, .loop
|
||||
; No signature match
|
||||
ld a, ERR_BAD_ARG
|
||||
jr .error
|
||||
@ -1066,6 +1077,7 @@ instrNames:
|
||||
; custom code.
|
||||
; Bit 4: When in an 'l' argspec, this means "I accept IX and IY variants".
|
||||
|
||||
; This table needs to be kept in ascending order of I_* value.
|
||||
instrTBl:
|
||||
.db I_ADC, 'A', 'l', 0, 0x8e , 0 ; ADC A, (HL)
|
||||
.db I_ADC, 'A', 0xb, 0, 0b10001000 , 0 ; ADC A, r
|
||||
@ -1102,6 +1114,7 @@ instrTBl:
|
||||
.db I_DI, 0, 0, 0, 0xf3 , 0 ; DI
|
||||
.db I_DJNZ,'n', 0, 0x80, 0x10 , 0 ; DJNZ e
|
||||
.db I_EI, 0, 0, 0, 0xfb , 0 ; EI
|
||||
instrTBlEX:
|
||||
.db I_EX, 'p', 'h', 0, 0xe3 , 0 ; EX (SP), HL
|
||||
.db I_EX, 'p', 'X', 0, 0xdd, 0xe3 ; EX (SP), IX
|
||||
.db I_EX, 'p', 'Y', 0, 0xfd, 0xe3 ; EX (SP), IY
|
||||
@ -1131,6 +1144,7 @@ instrTBl:
|
||||
.db I_JR, '=', 'n', 0x80, 0x30 , 0 ; JR NC, e
|
||||
.db I_JR, 'Z', 'n', 0x80, 0x28 , 0 ; JR Z, e
|
||||
.db I_JR, 'z', 'n', 0x80, 0x20 , 0 ; JR NZ, e
|
||||
instrTBlLD:
|
||||
.db I_LD, 'c', 'A', 0, 0x02 , 0 ; LD (BC), A
|
||||
.db I_LD, 'e', 'A', 0, 0x12 , 0 ; LD (DE), A
|
||||
.db I_LD, 'A', 'c', 0, 0x0a , 0 ; LD A, (BC)
|
||||
@ -1185,6 +1199,7 @@ instrTBl:
|
||||
.db I_PUSH,0x1, 0, 4, 0b11000101 , 0 ; PUSH qq
|
||||
.db I_RES, 0xc, 'l', 0x53, 0xcb, 0b10000110 ; RES b, (HL) + (IX/Y)
|
||||
.db I_RES, 0xc, 0xb, 0x20 \ .dw handleRESR ; RES b, r
|
||||
instrTBlRET:
|
||||
.db I_RET, 0, 0, 0, 0xc9 , 0 ; RET
|
||||
.db I_RET, 0xa, 0, 3, 0b11000000 , 0 ; RET cc
|
||||
.db I_RETI,0, 0, 0, 0xed, 0x4d ; RETI
|
||||
@ -1214,3 +1229,4 @@ instrTBl:
|
||||
.db I_XOR, 'l', 0, 0, 0xae , 0 ; XOR (HL)
|
||||
.db I_XOR, 0xb, 0, 0, 0b10101000 , 0 ; XOR r
|
||||
.db I_XOR, 'n', 0, 0, 0xee , 0 ; XOR n
|
||||
.db 0xff
|
||||
|
@ -11,7 +11,6 @@ jp init ; 3 bytes
|
||||
; *** JUMP TABLE ***
|
||||
jp strncmp
|
||||
jp addDE
|
||||
jp addHL
|
||||
jp upcase
|
||||
jp unsetZ
|
||||
jp intoDE
|
||||
@ -25,7 +24,6 @@ jp blkSet
|
||||
jp fsFindFN
|
||||
jp fsOpen
|
||||
jp fsGetB
|
||||
jp cpHLDE
|
||||
jp parseArgs
|
||||
jp _blkGetB
|
||||
jp _blkPutB
|
||||
@ -83,8 +81,7 @@ emulGetB:
|
||||
cp a ; ensure z
|
||||
ret
|
||||
.eof:
|
||||
call unsetZ
|
||||
ret
|
||||
jp unsetZ
|
||||
|
||||
emulPutB:
|
||||
out (STDIO_PORT), a
|
||||
|
@ -6,7 +6,6 @@
|
||||
; *** JUMP TABLE ***
|
||||
.equ strncmp 0x03
|
||||
.equ addDE @+3
|
||||
.equ addHL @+3
|
||||
.equ upcase @+3
|
||||
.equ unsetZ @+3
|
||||
.equ intoDE @+3
|
||||
@ -20,7 +19,6 @@
|
||||
.equ fsFindFN @+3
|
||||
.equ fsOpen @+3
|
||||
.equ fsGetB @+3
|
||||
.equ cpHLDE @+3
|
||||
.equ parseArgs @+3
|
||||
.equ _blkGetB @+3
|
||||
.equ _blkPutB @+3
|
||||
|
Loading…
Reference in New Issue
Block a user