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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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