mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-08-24 20:28:59 +00:00
Merge branch 'master' of https://github.com/badvision/lawless-legends
This commit is contained in:
commit
e548a644da
@ -726,46 +726,6 @@ asm lookuptbl
|
|||||||
STA DSTH
|
STA DSTH
|
||||||
BNE -
|
BNE -
|
||||||
end
|
end
|
||||||
def lookupdef(addr, deftbl)
|
|
||||||
while (deftbl).0 == $20
|
|
||||||
if (deftbl):3 == addr
|
|
||||||
return deftbl
|
|
||||||
fin
|
|
||||||
deftbl = deftbl + 5
|
|
||||||
loop
|
|
||||||
return 0
|
|
||||||
;asm lookupdef
|
|
||||||
; LDA ESTKL,X
|
|
||||||
; STA DSTL
|
|
||||||
; LDA ESTKH,X
|
|
||||||
; STA DSTH
|
|
||||||
; INX
|
|
||||||
;- LDY #$00
|
|
||||||
; LDA #$20
|
|
||||||
; AND (DST),Y
|
|
||||||
; BEQ ++
|
|
||||||
; LDY #$03
|
|
||||||
; LDA (DST),Y
|
|
||||||
; CMP ESTKL,X
|
|
||||||
; BNE +++
|
|
||||||
; INY
|
|
||||||
; LDA (DST),Y
|
|
||||||
; CMP ESTKH,X
|
|
||||||
; BNE ++
|
|
||||||
;+ LDA DSTL
|
|
||||||
; LDY DSTH
|
|
||||||
;++ STA ESTKL,X
|
|
||||||
; STY ESTKH,X
|
|
||||||
; RTS
|
|
||||||
;+++ LDA #$05
|
|
||||||
; CLC
|
|
||||||
; ADC DSTL
|
|
||||||
; STA DSTL
|
|
||||||
; LDA #$00
|
|
||||||
; ADC DSTH
|
|
||||||
; STA DSTH
|
|
||||||
; BNE -
|
|
||||||
end
|
|
||||||
;
|
;
|
||||||
; CHAR IN
|
; CHAR IN
|
||||||
; RDKEY()
|
; RDKEY()
|
||||||
@ -1003,16 +963,27 @@ def lookupextern(esd, index)
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
def adddef(bank, addr, deflast)
|
def adddef(bank, addr, deflast)
|
||||||
(*deflast).0 = $20
|
word defentry
|
||||||
if bank == 0
|
defentry = *deflast
|
||||||
(*deflast):1 = $03D6 ; JSR $03D6 (MAIN MEM INTERP)
|
*deflast = defentry + 5
|
||||||
|
if bank
|
||||||
|
(defentry):1 = $03DC ; JSR $03DC (AUX MEM INTERP)
|
||||||
else
|
else
|
||||||
(*deflast):1 = $03DC ; JSR $03DC (AUX MEM INTERP)
|
(defentry):1 = $03D6 ; JSR $03D6 (MAIN MEM INTERP)
|
||||||
fin
|
fin
|
||||||
(*deflast):3 = addr
|
(defentry).0 = $20
|
||||||
*deflast = *deflast + 5
|
(defentry):3 = addr
|
||||||
(*deflast).0 = 0
|
(defentry).5 = 0 ; NULL out next entry
|
||||||
return *deflast - 5
|
return defentry
|
||||||
|
end
|
||||||
|
def lookupdef(addr, deftbl)
|
||||||
|
while (deftbl).0 == $20
|
||||||
|
if (deftbl):3 == addr
|
||||||
|
return deftbl
|
||||||
|
fin
|
||||||
|
deftbl = deftbl + 5
|
||||||
|
loop
|
||||||
|
return 0
|
||||||
end
|
end
|
||||||
def loadmod(mod)
|
def loadmod(mod)
|
||||||
word refnum, rdlen, modsize, bytecode, defofst, defcnt, init, fixup
|
word refnum, rdlen, modsize, bytecode, defofst, defcnt, init, fixup
|
||||||
@ -1021,7 +992,6 @@ def loadmod(mod)
|
|||||||
word moddep, rld, esd, sym
|
word moddep, rld, esd, sym
|
||||||
byte defbank, str[16], filename[64]
|
byte defbank, str[16], filename[64]
|
||||||
byte header[128]
|
byte header[128]
|
||||||
|
|
||||||
;
|
;
|
||||||
; Read the RELocatable module header (first 128 bytes)
|
; Read the RELocatable module header (first 128 bytes)
|
||||||
;
|
;
|
||||||
@ -1088,14 +1058,15 @@ def loadmod(mod)
|
|||||||
until rdlen <= 0
|
until rdlen <= 0
|
||||||
close(refnum)
|
close(refnum)
|
||||||
;
|
;
|
||||||
; Apply all fixups and symbol import/export.
|
|
||||||
|
; Apply all fixups and symbol import/export.
|
||||||
;
|
;
|
||||||
modfix = modaddr - modfix
|
modfix = modaddr - modfix
|
||||||
bytecode = defofst + modfix - MODADDR
|
bytecode = defofst + modfix - MODADDR
|
||||||
modend = modaddr + modsize
|
modend = modaddr + modsize
|
||||||
rld = modend ; Re-Locatable Directory
|
rld = modend ; Re-Locatable Directory
|
||||||
esd = rld ; Extern+Entry Symbol Directory
|
esd = rld ; Extern+Entry Symbol Directory
|
||||||
while !^esd ; Scan to end of ESD
|
while ^esd ; Scan to end of ESD
|
||||||
esd = esd + 4
|
esd = esd + 4
|
||||||
loop
|
loop
|
||||||
esd = esd + 1
|
esd = esd + 1
|
||||||
@ -1121,7 +1092,7 @@ def loadmod(mod)
|
|||||||
adddef(defbank, (rld):1 - defofst + defaddr, @deflast)
|
adddef(defbank, (rld):1 - defofst + defaddr, @deflast)
|
||||||
else
|
else
|
||||||
addr = (rld):1 + modfix
|
addr = (rld):1 + modfix
|
||||||
if addr >= modaddr ; Skip fixups to header
|
if uword_isge(addr, modaddr) ; Skip fixups to header
|
||||||
if ^rld & $80 ; WORD sized fixup.
|
if ^rld & $80 ; WORD sized fixup.
|
||||||
fixup = *addr
|
fixup = *addr
|
||||||
else ; BYTE sized fixup.
|
else ; BYTE sized fixup.
|
||||||
|
Loading…
Reference in New Issue
Block a user