From 82ef5106244877b384c35d95b7f0637cb4a76036 Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Fri, 6 Jun 2014 19:37:01 -0700 Subject: [PATCH] Make sure unresolved externals generate error --- src/a1cmd.pla | 20 ++++++++++++++------ src/cmd.pla | 17 ++++++++++++++--- src/soscmd.pla | 20 ++++++++++++++------ 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/a1cmd.pla b/src/a1cmd.pla index bced974..2e4b2b5 100644 --- a/src/a1cmd.pla +++ b/src/a1cmd.pla @@ -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. ; diff --git a/src/cmd.pla b/src/cmd.pla index da9e3f6..2d14a91 100644 --- a/src/cmd.pla +++ b/src/cmd.pla @@ -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. ; diff --git a/src/soscmd.pla b/src/soscmd.pla index 63e8a13..3612467 100644 --- a/src/soscmd.pla +++ b/src/soscmd.pla @@ -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. ;