1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-12-24 15:29:29 +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 heap
word symtbl, lastsym
word perr
byte perr, lerr
word cmdptr
;
; CALL SOS
@ -670,19 +670,23 @@ def addmod(mod, addr)
return addtbl(modtosym(mod, @dci), addr, @lastsym)
end
def lookupextern(esd, index)
word sym
word sym, addr
byte str[16]
while ^esd
sym = esd
esd = esd + dcitos(esd, @str)
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
esd = esd + 3
loop
prbyte(index)
cout('?')
crout
return 0
end
def adddef(addr, deflast)
@ -710,6 +714,7 @@ def loadmod(mod)
word deftbl, deflast
word moddep, rld, esd, sym
byte str[17], filename[17]
lerr = 0
;
; Read the RELocatable module header (first 128 bytes)
;
@ -841,6 +846,9 @@ def loadmod(mod)
perr = perr | 0x100
return -perr
fin
if lerr
return -lerr
fin
;
; Call init routine if it exists.
;

View File

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

View File

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