zasm: rename curOutputOffset to ZASM_PC
This commit is contained in:
parent
a994867a86
commit
33a1ee250d
@ -632,7 +632,7 @@ getUpcode:
|
||||
bit 7, (ix+3)
|
||||
jr z, .absoluteValue ; bit not set? regular byte value,
|
||||
; Our argument is a relative address ("e" type in djnz and jr). We have
|
||||
; to subtract (curOutputOffset) from it.
|
||||
; to subtract (ZASM_PC) from it.
|
||||
|
||||
; First, check whether we're on first pass. If we are, skip processing
|
||||
; below because not having real symbol value makes relative address
|
||||
@ -643,7 +643,7 @@ getUpcode:
|
||||
|
||||
; We're on second pass
|
||||
push de ; Don't let go of this, that's our dest
|
||||
ld de, (curOutputOffset)
|
||||
ld de, (ZASM_PC)
|
||||
call JUMP_INTOHL
|
||||
dec hl ; what we write is "e-2"
|
||||
dec hl
|
||||
|
@ -37,7 +37,9 @@
|
||||
; that when we parse instructions and directive that error out because of a
|
||||
; missing symbol, we don't error out and just write down a dummy value.
|
||||
.equ ZASM_FIRST_PASS RAMSTART
|
||||
.equ ZASM_RAMEND ZASM_FIRST_PASS+1
|
||||
; The offset where we currently are with regards to outputting opcodes
|
||||
.equ ZASM_PC ZASM_FIRST_PASS+1
|
||||
.equ ZASM_RAMEND ZASM_PC+2
|
||||
|
||||
; *** Code ***
|
||||
jp zasmMain
|
||||
@ -85,12 +87,12 @@ zasmIsFirstPass:
|
||||
cp 1
|
||||
ret
|
||||
|
||||
; Increase (curOutputOffset) by A
|
||||
; Increase (ZASM_PC) by A
|
||||
incOutputOffset:
|
||||
push de
|
||||
ld de, (curOutputOffset)
|
||||
ld de, (ZASM_PC)
|
||||
call JUMP_ADDDE
|
||||
ld (curOutputOffset), de
|
||||
ld (ZASM_PC), de
|
||||
pop de
|
||||
ret
|
||||
|
||||
@ -99,7 +101,7 @@ incOutputOffset:
|
||||
; be read (first line is 1).
|
||||
zasmParseFile:
|
||||
ld de, 0
|
||||
ld (curOutputOffset), de
|
||||
ld (ZASM_PC), de
|
||||
.loop:
|
||||
inc de
|
||||
call ioReadLine
|
||||
@ -110,7 +112,7 @@ zasmParseFile:
|
||||
jr .loop
|
||||
|
||||
; Parse line in (HL), write the resulting opcode(s) through ioPutC and increases
|
||||
; (curOutputOffset) by the number of bytes written.
|
||||
; (ZASM_PC) by the number of bytes written.
|
||||
; Sets Z if parse was successful, unset if there was an error or EOF.
|
||||
parseLine:
|
||||
push bc
|
||||
@ -208,7 +210,7 @@ _parseLabel:
|
||||
; NZ? this means that (HL) couldn't be found in symbol list. Weird
|
||||
jr .error
|
||||
.registerLabel:
|
||||
ld de, (curOutputOffset)
|
||||
ld de, (ZASM_PC)
|
||||
call symRegister
|
||||
jr nz, .error
|
||||
; continue to .success
|
||||
@ -218,8 +220,3 @@ _parseLabel:
|
||||
.error:
|
||||
call JUMP_UNSETZ
|
||||
ret
|
||||
|
||||
; *** Variables ***
|
||||
; The offset where we currently are with regards to outputting opcodes
|
||||
curOutputOffset:
|
||||
.fill 2
|
||||
|
Loading…
Reference in New Issue
Block a user