zasm: remove JUMP_ prefixes

They serve no purpose and make the code less flexible.
This commit is contained in:
Virgil Dupras 2019-05-17 09:50:11 -04:00
parent 013a3b74c8
commit 7083116379
10 changed files with 76 additions and 77 deletions

View File

@ -98,7 +98,7 @@ handleINC:
; We have opening quote
inc hl
xor a
call JUMP_FINDCHAR ; go to end of string
call findchar ; go to end of string
dec hl
ld a, (hl)
cp '"'
@ -135,8 +135,8 @@ parseDirective:
; double A to have a proper offset in directiveHandlers
add a, a
ld de, directiveHandlers
call JUMP_ADDDE
call JUMP_INTODE
call addDE
call intoDE
ld ixh, d
ld ixl, e
pop de

View File

@ -6,12 +6,12 @@ parseExpr:
push de
push hl
ld a, '+'
call JUMP_FINDCHAR
call findchar
jr z, .hasExpr
pop hl
push hl
ld a, '-'
call JUMP_FINDCHAR
call findchar
jr nz, .noExpr
ld c, '-'
jr .hasExpr

View File

@ -146,7 +146,7 @@ parseArg:
call strncmpI
jr z, .found ; got it!
ld a, 5
call JUMP_ADDDE
call addDE
djnz .loop1
; We exhausted the argspecs. Let's see if we're inside parens.
@ -206,7 +206,7 @@ isGroupId:
cp a
ret
.notgroup:
call JUMP_UNSETZ
call unsetZ
ret
; Find argspec A in group id H.
@ -237,7 +237,7 @@ findInGroup:
ld a, h
rla
rla
call JUMP_ADDDE ; At this point, DE points to our group
call addDE ; At this point, DE points to our group
pop af
ex hl, de ; And now, HL points to the group
pop de
@ -276,7 +276,7 @@ findInGroup:
jr .end
.notfound:
pop bc ; from the push bc in .find
call JUMP_UNSETZ
call unsetZ
.end:
pop hl
pop bc
@ -297,11 +297,11 @@ matchArg:
cp 0
jr nz, .checkIfNumber ; not a zero, we can continue
; zero, stop here
call JUMP_UNSETZ
call unsetZ
ret
.checkIfNumber:
; not an exact match, let's check for numerical constants.
call JUMP_UPCASE
call upcase
call checkNOrM
jr z, .expectsNumber
jr .notNumber
@ -393,7 +393,7 @@ handleBIT:
ret
.error:
xor c
call JUMP_UNSETZ
call unsetZ
ret
handleBITHL:
@ -644,7 +644,7 @@ getUpcode:
; We're on second pass
push de ; Don't let go of this, that's our dest
ld de, (ZASM_PC)
call JUMP_INTOHL
call intoHL
dec hl ; what we write is "e-2"
dec hl
call subDEFromHL
@ -733,7 +733,7 @@ processArg:
cp a ; ensure Z is set
ret
.error:
call JUMP_UNSETZ
call unsetZ
ret
.noarg:
xor a
@ -764,7 +764,7 @@ parseInstruction:
call matchPrimaryRow
jr z, .match
ld a, INSTR_TBL_ROWSIZE
call JUMP_ADDDE
call addDE
djnz .loop
; no match
xor a

View File

@ -66,7 +66,7 @@ ioGetC:
; We're in "include mode", read from FS
push de
ld de, IO_INCLUDE_HDL
call JUMP_FSGETC
call fsGetC
pop de
or a ; cp 0
ret nz ; not zero, all good
@ -129,7 +129,7 @@ _ioSeek:
; We're in "include mode", seek in FS
push de
ld de, IO_INCLUDE_HDL
call JUMP_FSSEEK
call fsSeek
pop de
ret
@ -143,7 +143,7 @@ _ioTell:
; We're in "include mode", tell from FS
push de
ld de, IO_INCLUDE_HDL
call JUMP_FSTELL
call fsTell
pop de
ret
@ -156,10 +156,10 @@ ioInInclude:
; Open include file name specified in (HL).
; Sets Z on success, unset on error.
ioOpenInclude:
call JUMP_FSFINDFN
call fsFindFN
ret nz
ld hl, IO_INCLUDE_HDL
call JUMP_FSOPEN
call fsOpen
ld a, 1
ld (IO_IN_INCLUDE), a
cp a ; ensure Z

View File

@ -19,20 +19,20 @@
;
; *** Requirements ***
; blockdev
; JUMP_STRNCMP
; JUMP_ADDDE
; JUMP_ADDHL
; JUMP_UPCASE
; JUMP_UNSETZ
; JUMP_INTODE
; JUMP_INTOHL
; JUMP_FINDCHAR
; JUMP_BLKSEL
; JUMP_FSFINDFN
; JUMP_FSOPEN
; JUMP_FSGETC
; JUMP_FSSEEK
; JUMP_FSTELL
; strncmp
; addDE
; addHL
; upcase
; unsetZ
; intoDE
; intoHL
; findchar
; blkSel
; fsFindFN
; fsOpen
; fsGetC
; fsSeek
; fsTell
; RAMSTART (where we put our variables in RAM)
; FS_HANDLE_SIZE
@ -60,7 +60,7 @@ jp zasmMain
.equ IO_RAMSTART ZASM_RAMEND
#include "io.asm"
#include "tok.asm"
#include "parse.asm"
#include "parse_z.asm"
#include "expr.asm"
#include "instr.asm"
.equ DIREC_RAMSTART IO_RAMEND
@ -74,10 +74,10 @@ zasmMain:
; Init I/O
ld a, h
ld de, IO_IN_GETC
call JUMP_BLKSEL
call blkSel
ld a, l
ld de, IO_OUT_GETC
call JUMP_BLKSEL
call blkSel
; Init modules
xor a
@ -113,7 +113,7 @@ zasmIsLocalPass:
incOutputOffset:
push de
ld de, (ZASM_PC)
call JUMP_ADDDE
call addDE
ld (ZASM_PC), de
pop de
ret
@ -180,7 +180,7 @@ _parseInstr:
xor a ; ensure Z
ret
.error:
call JUMP_UNSETZ
call unsetZ
ret
_parseDirec:
@ -241,7 +241,7 @@ _parseLabel:
xor a ; ensure Z
ret
.error:
call JUMP_UNSETZ
call unsetZ
ret
_beginLocalPass:

View File

@ -51,7 +51,7 @@ parseDecimal:
jr .loop
.error:
call JUMP_UNSETZ
call unsetZ
.end:
pop bc
pop de
@ -77,18 +77,18 @@ parseHexadecimal:
; too long, error
jr .error
.double:
call JUMP_PARSEHEXPAIR ; moves HL to last char of pair
call parseHexPair ; moves HL to last char of pair
jr c, .error
inc hl ; now HL is on first char of next pair
ld ixh, a
.single:
call JUMP_PARSEHEXPAIR
call parseHexPair
jr c, .error
ld ixl, a
cp a ; ensure Z
jr .end
.error:
call JUMP_UNSETZ
call unsetZ
.end:
pop hl
ret

View File

@ -57,11 +57,11 @@ _symNext:
cp (hl)
jr nz, .do ; (HL) is not zero? we can advance.
; (HL) is zero? we're at the end of the chain.
call JUMP_UNSETZ
call unsetZ
ret
.do:
; A is already 0
call JUMP_FINDCHAR ; find next null char
call findchar ; find next null char
; go to the char after it.
inc hl
cp a ; ensure Z
@ -126,7 +126,7 @@ symNamesEnd:
djnz .loop
; exhausted djnz? out of bounds
.outOfBounds:
call JUMP_UNSETZ
call unsetZ
jr .end
.success:
; Our index is 0 - B (if B is, for example 0xfd, A is 0x3)
@ -161,7 +161,7 @@ symRegister:
push de
ld de, (SYM_CTX_NAMESEND)
ld a, c
call JUMP_ADDHL
call addHL
call cpHLDE
pop de
pop hl
@ -189,8 +189,8 @@ symRegister:
pop de
push de ; push it right back to avoid stack imbalance
ld hl, (SYM_CTX_VALUES)
call JUMP_ADDHL
call JUMP_ADDHL ; twice because our values are words
call addHL
call addHL ; twice because our values are words
; Everything is set! DE is our value HL points to the proper index in
; (SYM_CTX_VALUES). Let's just write it (little endian).
@ -227,7 +227,7 @@ symFind:
ld hl, (SYM_CTX_NAMES)
.loop:
ld a, c ; recall strlen
call JUMP_STRNCMP
call strncmp
jr z, .match
; ok, next!
call _symNext
@ -235,8 +235,7 @@ symFind:
djnz .loop
; exhausted djnz? no match
.nomatch:
out (99), a
call JUMP_UNSETZ
call unsetZ
jr .end
.match:
; Our index is 0 - B (if B is, for example 0xfd, A is 0x3)
@ -254,8 +253,8 @@ symGetVal:
; our index is in A. Let's fetch the proper value
push hl
ld hl, (SYM_CTX_VALUES)
call JUMP_ADDHL
call JUMP_ADDHL ; twice because our values are words
call addHL
call addHL ; twice because our values are words
ld e, (hl)
inc hl
ld d, (hl)

View File

@ -52,7 +52,7 @@ isSepOrLineEnd:
isLabel:
push hl
ld a, ':'
call JUMP_FINDCHAR
call findchar
ld a, (hl)
cp ':'
jr nz, .nomatch
@ -67,7 +67,7 @@ isLabel:
ld (hl), a
jr .end
.nomatch:
call JUMP_UNSETZ
call unsetZ
.end:
pop hl
ret
@ -105,7 +105,7 @@ readWord:
; We need to put the last char we've read back so that gotoNextLine
; behaves properly.
call ioPutBack
call JUMP_UNSETZ
call unsetZ
jr .end
.success:
call ioPutBack

View File

@ -66,10 +66,10 @@ strncmpI:
ld b, a
.loop:
ld a, (de)
call JUMP_UPCASE
call upcase
ld c, a
ld a, (hl)
call JUMP_UPCASE
call upcase
cp c
jr nz, .end ; not equal? break early. NZ is carried out
; to the called
@ -120,7 +120,7 @@ enterParens:
ret ; we're good!
.doNotEnter:
pop hl
call JUMP_UNSETZ
call unsetZ
ret
; Find string (HL) in string list (DE) of size B, in a case-insensitive manner.
@ -133,7 +133,7 @@ findStringInList:
ld a, c
call strncmpI
ld a, c
call JUMP_ADDDE
call addDE
jr z, .match
djnz .loop
; no match, Z is unset

View File

@ -1,19 +1,19 @@
; *** JUMP TABLE ***
JUMP_STRNCMP .equ 0x03
JUMP_ADDDE .equ 0x06
JUMP_ADDHL .equ 0x09
JUMP_UPCASE .equ 0x0c
JUMP_UNSETZ .equ 0x0f
JUMP_INTODE .equ 0x12
JUMP_INTOHL .equ 0x15
JUMP_FINDCHAR .equ 0x18
JUMP_PARSEHEXPAIR .equ 0x1b
JUMP_BLKSEL .equ 0x1e
JUMP_FSFINDFN .equ 0x21
JUMP_FSOPEN .equ 0x24
JUMP_FSGETC .equ 0x27
JUMP_FSSEEK .equ 0x2a
JUMP_FSTELL .equ 0x2d
strncmp .equ 0x03
addDE .equ 0x06
addHL .equ 0x09
upcase .equ 0x0c
unsetZ .equ 0x0f
intoDE .equ 0x12
intoHL .equ 0x15
findchar .equ 0x18
parseHexPair .equ 0x1b
blkSel .equ 0x1e
fsFindFN .equ 0x21
fsOpen .equ 0x24
fsGetC .equ 0x27
fsSeek .equ 0x2a
fsTell .equ 0x2d
.equ FS_HANDLE_SIZE 8
.equ USER_CODE 0x4800