1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-12-25 21:29:34 +00:00

Make sure unresolved externals generate error

This commit is contained in:
David Schmenk 2014-06-06 19:37:01 -07:00
parent fc91062291
commit 82ef510624
3 changed files with 42 additions and 15 deletions

View File

@ -85,7 +85,7 @@ byte hexchar[] = '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E',
word systemflags = 0 word systemflags = 0
word heap word heap
word symtbl, lastsym word symtbl, lastsym
word perr byte perr, lerr
word cmdptr word cmdptr
; ;
; CALL SOS ; CALL SOS
@ -670,19 +670,23 @@ def addmod(mod, addr)
return addtbl(modtosym(mod, @dci), addr, @lastsym) return addtbl(modtosym(mod, @dci), addr, @lastsym)
end end
def lookupextern(esd, index) def lookupextern(esd, index)
word sym word sym, addr
byte str[16] byte str[16]
while ^esd while ^esd
sym = esd sym = esd
esd = esd + dcitos(esd, @str) esd = esd + dcitos(esd, @str)
if (esd).0 & $10 and (esd).1 == index if (esd).0 & $10 and (esd).1 == index
return lookupsym(sym) addr = lookupsym(sym)
if !addr
lerr = $81
cout('?')
prstr(@str)
crout
fin
return addr
fin fin
esd = esd + 3 esd = esd + 3
loop loop
prbyte(index)
cout('?')
crout
return 0 return 0
end end
def adddef(addr, deflast) def adddef(addr, deflast)
@ -710,6 +714,7 @@ def loadmod(mod)
word deftbl, deflast word deftbl, deflast
word moddep, rld, esd, sym word moddep, rld, esd, sym
byte str[17], filename[17] byte str[17], filename[17]
lerr = 0
; ;
; Read the RELocatable module header (first 128 bytes) ; Read the RELocatable module header (first 128 bytes)
; ;
@ -841,6 +846,9 @@ def loadmod(mod)
perr = perr | 0x100 perr = perr | 0x100
return -perr return -perr
fin fin
if lerr
return -lerr
fin
; ;
; Call init routine if it exists. ; Call init routine if it exists.
; ;

View File

@ -87,7 +87,7 @@ word heap
word lastsym = symtbl word lastsym = symtbl
word xheap = $0800 word xheap = $0800
word systemflags = 0 word systemflags = 0
word perr byte perr, lerr
word cmdptr word cmdptr
; ;
; Utility functions ; Utility functions
@ -925,13 +925,20 @@ def addmod(mod, addr)
return addtbl(modtosym(mod, @dci), addr, @lastsym) return addtbl(modtosym(mod, @dci), addr, @lastsym)
end end
def lookupextern(esd, index) def lookupextern(esd, index)
word sym word sym, addr
byte str[16] byte str[16]
while ^esd while ^esd
sym = esd sym = esd
esd = esd + dcitos(esd, @str) esd = esd + dcitos(esd, @str)
if (esd).0 & $10 and (esd).1 == index if (esd).0 & $10 and (esd).1 == index
return lookupsym(sym) addr = lookupsym(sym)
if !addr
lerr = $81
cout('?')
prstr(@str)
crout
fin
return addr
fin fin
esd = esd + 3 esd = esd + 3
loop loop
@ -967,6 +974,7 @@ 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]
lerr = 0
; ;
; Read the RELocatable module header (first 128 bytes) ; Read the RELocatable module header (first 128 bytes)
; ;
@ -1127,6 +1135,9 @@ def loadmod(mod)
perr = perr | 0x100 perr = perr | 0x100
return -perr return -perr
fin fin
if lerr
return -lerr
fin
; ;
; Call init routine if it exists. ; Call init routine if it exists.
; ;

View File

@ -89,7 +89,7 @@ byte modseg[15]
word heap = $2000 word heap = $2000
word symtbl, lastsym word symtbl, lastsym
word refcons, devcons word refcons, devcons
word perr, terr byte perr, terr, lerr
word cmdptr word cmdptr
; ;
; CALL SOS ; CALL SOS
@ -890,19 +890,23 @@ def addmod(mod, addr)
return addtbl(modtosym(mod, @dci), addr, @lastsym) return addtbl(modtosym(mod, @dci), addr, @lastsym)
end end
def lookupextern(esd, index) def lookupextern(esd, index)
word sym word sym, addr
byte str[16] byte str[16]
while ^esd while ^esd
sym = esd sym = esd
esd = esd + dcitos(esd, @str) esd = esd + dcitos(esd, @str)
if (esd).0 & $10 and (esd).1 == index if (esd).0 & $10 and (esd).1 == index
return lookupsym(sym) addr = lookupsym(sym)
if !addr
lerr = $81
cout('?')
prstr(@str)
crout
fin
return addr
fin fin
esd = esd + 3 esd = esd + 3
loop loop
prbyte(index)
cout('?')
crout
return 0 return 0
end end
def adddef(ext, addr, deflast) def adddef(ext, addr, deflast)
@ -944,6 +948,7 @@ def loadmod(mod)
word moddep, rld, esd, sym word moddep, rld, esd, sym
byte defext, str[16], filename[33] byte defext, str[16], filename[33]
byte header[128] byte header[128]
lerr = 0
; ;
; Read the RELocatable module header (first 128 bytes) ; Read the RELocatable module header (first 128 bytes)
; ;
@ -1148,6 +1153,9 @@ def loadmod(mod)
perr = perr | 0x100 perr = perr | 0x100
return -perr return -perr
fin fin
if lerr
return -lerr
fin
; ;
; Call init routine if it exists. ; Call init routine if it exists.
; ;