1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-08-08 09:25:19 +00:00

29 Commits
Alpha2 ... Beta

Author SHA1 Message Date
David Schmenk
66c51a2ab5 Beta release 2023-02-28 15:03:45 -08:00
David Schmenk
64a722f1e2 Beta release 2023-02-28 15:02:39 -08:00
David Schmenk
75c2847cf1 Update images with FIBER library 2023-02-28 13:03:10 -08:00
dschmenk
f5efc5641e Add count of active fibers 2023-02-28 12:57:49 -08:00
David Schmenk
c39fd20746 Update images will PLASM Apple /// fix 2023-02-27 12:31:38 -08:00
dschmenk
79287f2c51 Fix status print for Apple /// 2023-02-27 11:59:12 -08:00
Dave Schmenk
cd0126477b Had to make room to update compiler to latest 2023-02-26 21:25:05 -08:00
Dave Schmenk
1c35a7ae0a Update disk images 2023-02-26 12:21:02 -08:00
Dave Schmenk
ffce999045 Update 2mg image file 2023-02-25 22:38:32 -08:00
dschmenk
9e62379b46 Update strings to BETA 2023-02-25 20:32:56 -08:00
dschmenk
9125b7bfd4 Error on local constants 2023-02-25 19:21:36 -08:00
dschmenk
cdb734d1ba Allow to import module header itself 2023-02-25 16:16:46 -08:00
David Schmenk
f78f2827dc Add output filename to compile data 2023-02-25 10:54:17 -08:00
David Schmenk
ef268697b5 Fix display width calc 2023-02-25 10:51:36 -08:00
David Schmenk
6665199e55 Fix display width calc 2023-02-25 10:50:36 -08:00
David Schmenk
f4ce23a3cf Slight adjustment to FPSTR_FLEX formatting 2023-02-25 10:29:30 -08:00
dschmenk
177c621364 Add fppow sample test 2023-02-24 17:49:13 -08:00
David Schmenk
54fba4e12f Update FPPOW.PLA sample in images 2023-02-24 11:26:08 -08:00
David Schmenk
0d41deb7ec Update 2mg with lastest FPSTR files 2023-02-24 11:12:31 -08:00
Dave Schmenk
7a3debfd0c Much better floating point string conversion 2023-02-23 17:57:11 -08:00
David Schmenk
1713c71505 Fix *some* of the exponent formatting 2023-02-13 15:40:47 -08:00
David Schmenk
abd9d35cae Fix string -> decrec conversion 2023-02-12 14:13:59 -08:00
David Schmenk
1d3de982d6 Give output filename as STDOUT if -S flag 2023-02-02 12:02:54 -06:00
David Schmenk
9cb7d29bfa Merge pull request #69 from ZornsLemma/plasm-stdout
Add new -S option to "plasm" to output to stdout
2023-02-02 11:35:00 -06:00
Steven Flintham
374d2465b6 Add -S option to plasm to output to stdout 2023-01-15 22:30:53 +00:00
ZornsLemma
156bca2413 Merge pull request #18 from dschmenk/master
Merge latest upstream changes to master
2023-01-14 22:30:39 +00:00
David Schmenk
f5b2db78a3 Allow importing self 2023-01-14 12:20:16 -08:00
David Schmenk
ca5f81530c Alpha 2 format 2023-01-01 23:56:45 +00:00
David Schmenk
76b3905a60 Release Alpha 2 2023-01-01 23:55:53 +00:00
36 changed files with 618 additions and 491 deletions

View File

@@ -1,7 +1,9 @@
# 7/4/2020 PLASMA 2.0 Alpha 1 Available! # 2/28/2023 PLASMA 2.0 Beta Available!
Hopefully close to a 2.0 Release.
[Download and read the Release Notes](https://github.com/dschmenk/PLASMA/releases) [Download and read the Release Notes](https://github.com/dschmenk/PLASMA/releases)
[Change List](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%202.0.md#changes-in-plasma-for-20-alpha-1) [Change List](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%202.0.md#changes-in-plasma-for-20-alpha-2)
# 4/29/2018 PLASMA 1.2 Available! # 4/29/2018 PLASMA 1.2 Available!
[Download and read the Release Notes](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%201.2.md) [Download and read the Release Notes](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%201.2.md)

View File

@@ -1,20 +1,20 @@
# PLASMA Version 2.0 Alpha 2 # PLASMA Version 2.0 Beta
Welcome to PLASMA: the Grand Unifying Platform for the Apple 1, ][, and ///. Welcome to PLASMA: the Grand Unifying Platform for the Apple 1, ][, and ///.
Download the five disk images: Download the five disk images:
[PLASMA 2.0 Alpha2 800K Full System](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2.2mg?raw=true) [PLASMA 2.0 Beta 800K Full System](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2.2mg?raw=true)
[PLASMA 2.0 Alpha2 System and ProDOS Boot](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-SYS.PO?raw=true) [PLASMA 2.0 Beta System and ProDOS Boot](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-SYS.PO?raw=true)
[PLASMA 2.0 Alpha2 Build Tools](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-BLD.PO?raw=true) [PLASMA 2.0 Beta Build Tools](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-BLD.PO?raw=true)
[PLASMA 2.0 Alpha2 Demos](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-DEM.PO?raw=true) [PLASMA 2.0 Beta Demos](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-DEM.PO?raw=true)
[PLASMA 2.0 Alpha2 TCP/IP network modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-INET.PO?raw=true) [PLASMA 2.0 Beta TCP/IP network modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-INET.PO?raw=true)
[PLASMA 2.0 Alpha2 Apple /// SOS Mame Boot and SANE floating point modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-FPSOS.PO?raw=true) [PLASMA 2.0 Beta Apple /// SOS Mame Boot and SANE floating point modules](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLASMA2-FPSOS.PO?raw=true)
[PLASMA 2.0 Alpha1 Apple /// Mame hard disk image](https://github.com/dschmenk/PLASMA/blob/master/images/apple/apple3.hd?raw=true) [PLASMA 2.0 Alpha1 Apple /// Mame hard disk image](https://github.com/dschmenk/PLASMA/blob/master/images/apple/apple3.hd?raw=true)
@@ -118,6 +118,16 @@ There is a [YouTube playlist](https://www.youtube.com/playlist?list=PLlPKgUMQbJ7
- The documentation is sparse and incomplete. Yep, could use your help... - The documentation is sparse and incomplete. Yep, could use your help...
# Changes in PLASMA for 2.0 Beta
1. Compilers allows for including self imported defines
2. Compilers fixed for local constants
3. Floating point string formatting fixes and improvements
4. Fiber library exports number of active fibers
# Changes in PLASMA for 2.0 Alpha 2 # Changes in PLASMA for 2.0 Alpha 2
1. Self hosted compiler fixes for invalid array size constants 1. Self hosted compiler fixes for invalid array size constants

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,4 +1,5 @@
import fiber import fiber
predef fbrInit(numPool), fbrStop(fid)#0, fbrExit#0, fbrStart(defaddr, param) predef fbrInit(numPool), fbrStop(fid)#0, fbrExit#0, fbrStart(defaddr, param)
predef fbrYield#0, fbrHalt#0, fbrResume(fid)#0 predef fbrYield#0, fbrHalt#0, fbrResume(fid)#0
byte fbrCount
end end

View File

@@ -6,6 +6,7 @@ const FPSTR_FIXED = 1 // Fixed count of fractional digits
const FPSTR_FLOAT = 0 // Floating count of fractional digits const FPSTR_FLOAT = 0 // Floating count of fractional digits
const FPSTR_STRIP = 2 // Strip trailing fractional zeros const FPSTR_STRIP = 2 // Strip trailing fractional zeros
const FPSTR_EXP = 4 // Force exponential format const FPSTR_EXP = 4 // Force exponential format
const FPSTR_FLEX = 8 // Flexible switch to EXP format if over/underflow
// //
// Parse string into decrecord, return SANE conversion output // Parse string into decrecord, return SANE conversion output
// //

View File

@@ -1,4 +1,5 @@
include "inc/cmdsys.plh" include "inc/cmdsys.plh"
include "inc/conio.plh"
sysflags nojitc // Keep tone() from compiling and sounding different sysflags nojitc // Keep tone() from compiling and sounding different
// //
// Handy constants. // Handy constants.
@@ -34,24 +35,6 @@ const page2 = 1
// //
const ENV_REG = $FFDF const ENV_REG = $FFDF
// //
// External interface.
//
struc t_conio
word keypressed
word getkey
word echo
word home
word gotoxy
word viewport
word texttype
word textmode
word grmode
word grcolor
word grplot
word tone
word rnd
end
//
// Predefined functions. // Predefined functions.
// //
predef a2keypressed,a2home,a12echo(state),a2gotoxy(x,y),a2viewport(left, top, width, height),a2texttype(type) predef a2keypressed,a2home,a12echo(state),a2gotoxy(x,y),a2viewport(left, top, width, height),a2texttype(type)

View File

@@ -1,4 +1,5 @@
include "inc/cmdsys.plh" include "inc/cmdsys.plh"
include "inc/fileio.plh"
// //
// CFFA1 addresses. // CFFA1 addresses.
// //
@@ -22,26 +23,6 @@ const sysbuf = $0800
// //
// External interface // External interface
// //
struc t_fileio
word getpfx
word setpfx
word getfileinfo
word setfileinfo
word geteof
word seteof
word iobufalloc
word open
word close
word read
word write
word create
word destroy
word rename
word newline
word online
word readblock
word writeblock
end
predef a2getpfx(path), a23setpfx(path), a2getfileinfo(path, fileinfo), a2setfileinfo(path, fileinfo), a23geteof(refnum)#2, a23seteof(refnum, eofl, eofh), a2iobufs(iobufs), a2open(path), a2close(refnum) predef a2getpfx(path), a23setpfx(path), a2getfileinfo(path, fileinfo), a2setfileinfo(path, fileinfo), a23geteof(refnum)#2, a23seteof(refnum, eofl, eofh), a2iobufs(iobufs), a2open(path), a2close(refnum)
predef a23read(refnum, buf, len), a2write(refnum, buf, len), a2create(path, type, aux), a23destroy(path), a23rename(path, newpath) predef a23read(refnum, buf, len), a2write(refnum, buf, len), a2create(path, type, aux), a23destroy(path), a23rename(path, newpath)
predef a2newline(refnum, emask, nlchar), a2online(unit, buf), a2readblock(unit, buf, block), a2writeblock(unit, buf, block) predef a2newline(refnum, emask, nlchar), a2online(unit, buf), a2readblock(unit, buf, block), a2writeblock(unit, buf, block)

View File

@@ -19,6 +19,7 @@ byte fbrNext[MAX_FIBERS]
word fbrVMState[MAX_FIBERS] word fbrVMState[MAX_FIBERS]
word fbrPool word fbrPool
byte fbrRunning = 0 byte fbrRunning = 0
export byte fbrCount = 0
// //
// Zero Page VM state and 6502 stack // Zero Page VM state and 6502 stack
// //
@@ -136,6 +137,7 @@ export def fbrInit(numPool)
else else
return -1 return -1
fin fin
fbrCount = 1
return 0 return 0
end end
// //
@@ -151,6 +153,7 @@ export def fbrStop(fid)#0
// //
// Remove fiber from RUN list and tag as free // Remove fiber from RUN list and tag as free
// //
fbrCount--
fbrState[fid] = FIBER_FREE fbrState[fid] = FIBER_FREE
i = 0 i = 0
while fbrNext[i] <> fid while fbrNext[i] <> fid
@@ -212,6 +215,7 @@ export def fbrStart(defaddr, param)
// //
// Return fiber ID (index) // Return fiber ID (index)
// //
fbrCount++
return i return i
fin fin
next next

View File

@@ -3,6 +3,7 @@
// //
include "inc/cmdsys.plh" include "inc/cmdsys.plh"
include "inc/sane.plh" include "inc/sane.plh"
include "inc/fpstr.plh"
// //
// Structures for DEC2BIN, BIN2DEC // Structures for DEC2BIN, BIN2DEC
// //
@@ -19,14 +20,13 @@ end
// Parse string into decrecord, return SANE conversion output // Parse string into decrecord, return SANE conversion output
// //
export def str2ext(str, ext) export def str2ext(str, ext)
byte i, s, d byte i, d
byte decrec[t_decrecord] byte decrec[t_decrecord]
word sgnadj, expadj word sgnadj, expadj
decrec:sgn = 0 decrec:sgn = 0
decrec:exp = 0 decrec:exp = 0
decrec.sig = 0 decrec.sig = 0
s = 1
i = 1 i = 1
// //
// Skip whitespace // Skip whitespace
@@ -51,27 +51,34 @@ export def str2ext(str, ext)
// Parse number // Parse number
// //
while i <= ^str while i <= ^str
d = toupper(^(str+i)) d = ^(str+i)
if d >= '0' and d <= '9' if d >= '0' and d <= '9'
// //
// Parse digit // Parse digit
// //
decrec.sig[s] = ^(str+i)
decrec:sig++ decrec:sig++
s++ decrec.sig[decrec.sig] = d
elsif d == '.' elsif d == '.'
// //
// Parse decimal point // Parse decimal point
// //
i++ i++
while i <= ^str if !decrec:exp
d = toupper(^(str+i)) //
if d >= '0' and d <= '9' // Skip leading zeros
decrec.sig[s] = ^(str+i) //
decrec.sig++ while i <= ^str and ^(str+i) == '0'
decrec:exp-- decrec:exp--
s++ i++
elsif d == 'E' loop
fin
while i <= ^str
d = ^(str+i)
if d >= '0' and d <= '9'
decrec.sig++
decrec.sig[decrec.sig] = d
decrec:exp--
elsif d == 'E' or d == 'e'
i-- i--
break break
else else
@@ -79,7 +86,7 @@ export def str2ext(str, ext)
fin fin
i++ i++
loop loop
elsif d == 'E' elsif d == 'E' or d == 'e'
// //
// Parse exponent // Parse exponent
// //
@@ -108,14 +115,11 @@ export def str2ext(str, ext)
i++ i++
loop loop
// //
// Strip leading zeros from sig // Strip trailing zeros from sig
// //
while decrec.sig > 1 and decrec.sig.1 == '0' while decrec.sig > 0 and decrec.sig[decrec.sig] == '0'
decrec.sig-- decrec.sig--
if decrec:exp < 0 decrec:exp++
decrec:exp--
fin
memcpy(@decrec.sig.1, @decrec.sig.2, decrec.sig)
loop loop
// //
// Check for zero // Check for zero
@@ -123,6 +127,8 @@ export def str2ext(str, ext)
if !decrec.sig if !decrec.sig
decrec.sig = 1 decrec.sig = 1
decrec.sig.1 = '0' decrec.sig.1 = '0'
decrec:sgn = 0
decrec:exp = 0
fin fin
sane:saveZP() sane:saveZP()
return sane:restoreZP(sane:op2FP(FFEXT|FOD2B, ext, @decrec)) return sane:restoreZP(sane:op2FP(FFEXT|FOD2B, ext, @decrec))
@@ -131,14 +137,15 @@ end
// Convert extended FP to string using , return string // Convert extended FP to string using , return string
// //
export def ext2str(ext, str, intdigits, fracdigits, format) export def ext2str(ext, str, intdigits, fracdigits, format)
byte d, i, sigdigits, numdigits byte d, numdigits
word dp, tens word istr, dp, tens
byte decform[t_decformat] byte decform[t_decformat]
byte decrec[t_decrecord] byte decrec[t_decrecord]
numdigits = intdigits + fracdigits numdigits = intdigits + fracdigits
decform:style = format & $01 decform:style = format & FPSTR_FIXED
decform:digits = decform:style ?? fracdigits :: numdigits decform:digits = decform:style ?? fracdigits :: numdigits
decrec:exp = 0
sane:saveZP() sane:saveZP()
sane:restoreZP(sane:op3FP(FFEXT|FOB2D, @decrec, ext, @decform)) sane:restoreZP(sane:op3FP(FFEXT|FOB2D, @decrec, ext, @decform))
^(str+1) = decrec.sgn ?? '-' :: ' ' ^(str+1) = decrec.sgn ?? '-' :: ' '
@@ -156,93 +163,110 @@ export def ext2str(ext, str, intdigits, fracdigits, format)
^str = 4 ^str = 4
return str return str
fin fin
if decrec.sig.1 == '0'
while decrec.sig < fracdigits
decrec.sig++
decrec.sig[decrec.sig] = '0'
loop
decrec:exp = -decrec.sig
fin
dp = decrec.sig + decrec:exp dp = decrec.sig + decrec:exp
sigdigits = decrec.sig if format & FPSTR_EXP
if decrec:exp < 0 and format & $02 if format & FPSTR_STRIP
// //
// Strip off trailing fractional zeros // Strip off trailing fractional zeros
// //
while sigdigits > dp and decrec.sig[sigdigits] == '0' while decrec.sig > 1 and decrec.sig[decrec.sig] == '0'
sigdigits-- decrec.sig--
decrec:exp++ decrec:exp++
loop loop
fin fin
if -decrec:exp > numdigits or sigdigits + decrec:exp >= (decform:style ?? intdigits :: numdigits) or format & $04
//
// Convert to exponential format
//
^(str+2) = decrec.sig.1
^(str+3) = '.'
i = 3
for d = 0 to fracdigits
i++
^(str+i) = decrec.sig.2[d]
next
// //
// Copy over all significant digits // Copy over all significant digits
// //
if ^(str+i) == '.'; i--; fin ^(str+2) = decrec.sig.1
i++ ^(str+3) = '.'
^(str+i) = 'E' istr = str + 3
i++ for d = 2 to decrec.sig
istr++
^istr = decrec.sig[d]
next
if ^istr == '.'; istr--; fin
//
// Print exponent as 4 digits with leading zeros
//
istr++
^istr = 'E'
istr++
dp-- dp--
if dp < 0 if dp < 0
^(str+i) = '-' ^istr = '-'
dp = -dp dp = -dp
else else
^(str+i) = '+' ^istr = '+'
if dp == 0
i++
^(str+i) = '0'
fin
fin
//
// Pretty output the exponent (preceding zero for values less than 10)
//
d = 0
tens = 10000
while dp
d = d or tens <= 10
if dp >= tens or d
d = 1
i++
^(str+i) = (dp / tens) + '0'
fin fin
tens = 1000
while tens
istr++
^istr = (dp / tens) + '0'
dp = dp % tens dp = dp % tens
tens = tens / 10 tens = tens / 10
if !tens; break; fin
loop loop
else else
if format & FPSTR_STRIP and decrec:exp < 0
//
// Strip off trailing fractional zeros
//
while decrec.sig > dp and decrec.sig[decrec.sig] == '0'
decrec.sig--
decrec:exp++
loop
fin
if decrec:sig == 1 | '0'<<8
//
// Case of zero or underflow
//
if decrec:exp == 0
//
// Zero
//
if format & FPSTR_FIXED
//
// Add trailing fractional zeros
//
dp = 1 - fracdigits
fin
elsif format & FPSTR_FLEX
//
// Underflow
//
dp = -fracdigits - 1
fin
fin
if format & FPSTR_FLEX and (dp < -fracdigits or dp > (format & FPSTR_FIXED ?? intdigits :: numdigits))
//
// Print as exponent if over/underflow fixed digits
//
if numdigits < 7; numdigits = 7; fin
return ext2str(ext, str, 1, numdigits - 7, FPSTR_EXP | (format & FPSTR_STRIP))
fin
// //
// Convert as floating point // Convert as floating point
// //
i = 1
if dp <= 0 if dp <= 0
*(str+2) = '0'|('.'<<8) *(str+2) = '0'|('.'<<8)
i = 3 istr = str + 3
while dp < 0 while dp < 0
dp++ dp++
i++ istr++
^(str+i) = '0' ^istr = '0'
loop loop
else
istr = str + 1
fin fin
for d = 1 to sigdigits for d = 1 to decrec.sig
i++ istr++
^(str+i) = decrec.sig[d] ^istr = decrec.sig[d]
if d == dp if d == dp
i++ istr++
^(str+i) = '.' ^istr = '.'
fin fin
next next
if ^(str+i) == '.'; i--; fin if ^istr == '.'; istr--; fin
fin fin
^str = i ^str = istr - str
return str return str
end end

View File

@@ -1,24 +1,5 @@
include "inc/cmdsys.plh" include "inc/cmdsys.plh"
// include "inc/inet.plh"
// iNet API - must match inet.plh
//
struc t_inet
word initIP
word serviceIP
word openUDP
word sendUDP
word closeUDP
word listenTCP
word connectTCP
word sendTCP
word closeTCP
word setInterfaceIP
word getInterfaceHA
word setDNS
word resolveIP
word setCallback
word setParam
end
// //
// DNS message // DNS message
// //

View File

@@ -143,11 +143,11 @@ $(PLASM): $(OBJS) $(INCS)
cc $(OBJS) -o $(PLASM) cc $(OBJS) -o $(PLASM)
$(PLASMAPLASM): toolsrc/plasm.pla toolsrc/lex.pla toolsrc/parse.pla toolsrc/codegen.pla toolsrc/codeseq.plh $(PLASMAPLASM): toolsrc/plasm.pla toolsrc/lex.pla toolsrc/parse.pla toolsrc/codegen.pla toolsrc/codeseq.plh
./$(PLASM) -AMOW < toolsrc/plasm.pla > toolsrc/plasm.a ./$(PLASM) -AMOW toolsrc/plasm.pla
acme --setpc 4094 -o $(PLASMAPLASM) toolsrc/plasm.a acme --setpc 4094 -o $(PLASMAPLASM) toolsrc/plasm.a
$(CODEOPT): toolsrc/codeopt.pla toolsrc/codeseq.plh $(CODEOPT): toolsrc/codeopt.pla toolsrc/codeseq.plh
./$(PLASM) -AMOW < toolsrc/codeopt.pla > toolsrc/codeopt.a ./$(PLASM) -AMOW toolsrc/codeopt.pla
acme --setpc 4094 -o $(CODEOPT) toolsrc/codeopt.a acme --setpc 4094 -o $(CODEOPT) toolsrc/codeopt.a
# #
@@ -177,25 +177,25 @@ $(PLVMC64): vmsrc/c64/plvmc64.s vmsrc/c64/cmd.a
acme -f cbm -o $(PLVMC64) -l vmsrc/c64/plvmc64.sym vmsrc/c64/plvmc64.s acme -f cbm -o $(PLVMC64) -l vmsrc/c64/plvmc64.sym vmsrc/c64/plvmc64.s
vmsrc/apple/a1cmd.a: vmsrc/apple/a1cmd.pla $(PLASM) vmsrc/apple/a1cmd.a: vmsrc/apple/a1cmd.pla $(PLASM)
./$(PLASM) -AOW < vmsrc/apple/a1cmd.pla > vmsrc/apple/a1cmd.a ./$(PLASM) -AOW vmsrc/apple/a1cmd.pla
$(PLVM01): vmsrc/apple/plvm01.s vmsrc/apple/a1cmd.a $(PLVM01): vmsrc/apple/plvm01.s vmsrc/apple/a1cmd.a
acme -o $(PLVM01) -l vmsrc/apple/plvm01.sym vmsrc/apple/plvm01.s acme -o $(PLVM01) -l vmsrc/apple/plvm01.sym vmsrc/apple/plvm01.s
$(CMD): vmsrc/apple/cmd.pla vmsrc/apple/cmdstub.s $(PLVM02) $(PLASM) $(CMD): vmsrc/apple/cmd.pla vmsrc/apple/cmdstub.s $(PLVM02) $(PLASM)
./$(PLASM) -AOW < vmsrc/apple/cmd.pla > vmsrc/apple/cmd.a ./$(PLASM) -AOW vmsrc/apple/cmd.pla
acme --setpc 8192 -o $(CMD) vmsrc/apple/cmdstub.s acme --setpc 8192 -o $(CMD) vmsrc/apple/cmdstub.s
$(CMDJIT): vmsrc/apple/cmdjit.pla vmsrc/apple/cmdjitstub.s $(PLVMJIT) $(PLASM) $(CMDJIT): vmsrc/apple/cmdjit.pla vmsrc/apple/cmdjitstub.s $(PLVMJIT) $(PLASM)
./$(PLASM) -AOW < vmsrc/apple/cmdjit.pla > vmsrc/apple/cmdjit.a ./$(PLASM) -AOW vmsrc/apple/cmdjit.pla
acme --setpc 8192 -o $(CMDJIT) vmsrc/apple/cmdjitstub.s acme --setpc 8192 -o $(CMDJIT) vmsrc/apple/cmdjitstub.s
$(SOSCMD): vmsrc/apple/soscmd.pla $(PLVM03) $(PLASM) $(SOSCMD): vmsrc/apple/soscmd.pla $(PLVM03) $(PLASM)
./$(PLASM) -AMOW < vmsrc/apple/soscmd.pla > vmsrc/apple/soscmd.a ./$(PLASM) -AMOW vmsrc/apple/soscmd.pla
acme --setpc 4094 -o $(SOSCMD) vmsrc/apple/soscmd.a acme --setpc 4094 -o $(SOSCMD) vmsrc/apple/soscmd.a
$(SOSCMDJIT): vmsrc/apple/soscmdjit.pla libsrc/jitcore.pla $(PLVMJIT03) $(PLASM) $(SOSCMDJIT): vmsrc/apple/soscmdjit.pla libsrc/jitcore.pla $(PLVMJIT03) $(PLASM)
./$(PLASM) -AMOW < vmsrc/apple/soscmdjit.pla > vmsrc/apple/soscmdjit.a ./$(PLASM) -AMOW vmsrc/apple/soscmdjit.pla
acme --setpc 4094 -o $(SOSCMDJIT) vmsrc/apple/soscmdjit.a acme --setpc 4094 -o $(SOSCMDJIT) vmsrc/apple/soscmdjit.a
$(PLVM02): vmsrc/apple/plvm02.s $(PLVM02): vmsrc/apple/plvm02.s
@@ -208,13 +208,13 @@ $(PLVM802): vmsrc/apple/plvm802.s
acme -o $(PLVM802) -l vmsrc/apple/plvm802.sym vmsrc/apple/plvm802.s acme -o $(PLVM802) -l vmsrc/apple/plvm802.sym vmsrc/apple/plvm802.s
vmsrc/apple/sossys.a: vmsrc/apple/sossys.pla $(PLASM) vmsrc/apple/sossys.a: vmsrc/apple/sossys.pla $(PLASM)
./$(PLASM) -AOW < vmsrc/apple/sossys.pla > vmsrc/apple/sossys.a ./$(PLASM) -AOW vmsrc/apple/sossys.pla
$(PLVM03): vmsrc/apple/plvm03.s vmsrc/apple/sossys.a $(PLVM03): vmsrc/apple/plvm03.s vmsrc/apple/sossys.a
acme -o $(PLVM03) -l vmsrc/apple/plvm03.sym vmsrc/apple/plvm03.s acme -o $(PLVM03) -l vmsrc/apple/plvm03.sym vmsrc/apple/plvm03.s
vmsrc/apple/sossysjit.a: vmsrc/apple/sossysjit.pla $(PLASM) vmsrc/apple/sossysjit.a: vmsrc/apple/sossysjit.pla $(PLASM)
./$(PLASM) -AOW < vmsrc/apple/sossysjit.pla > vmsrc/apple/sossysjit.a ./$(PLASM) -AOW vmsrc/apple/sossysjit.pla
$(PLVMJIT03): vmsrc/apple/plvmjit03.s vmsrc/apple/sossysjit.a $(PLVMJIT03): vmsrc/apple/plvmjit03.s vmsrc/apple/sossysjit.a
acme -o $(PLVMJIT03) -l vmsrc/apple/plvmjit03.sym vmsrc/apple/plvmjit03.s acme -o $(PLVMJIT03) -l vmsrc/apple/plvmjit03.sym vmsrc/apple/plvmjit03.s
@@ -222,309 +222,309 @@ $(PLVMJIT03): vmsrc/apple/plvmjit03.s vmsrc/apple/sossysjit.a
# Sample code # Sample code
# #
test: samplesrc/test.pla samplesrc/testlib.pla $(PLVM) $(PLASM) test: samplesrc/test.pla samplesrc/testlib.pla $(PLVM) $(PLASM)
./$(PLASM) -AMOW < samplesrc/test.pla > samplesrc/test.a ./$(PLASM) -AMOW samplesrc/test.pla
acme --setpc 4094 -o $(TEST) samplesrc/test.a acme --setpc 4094 -o $(TEST) samplesrc/test.a
./$(PLASM) -AMOW < samplesrc/testlib.pla > samplesrc/testlib.a ./$(PLASM) -AMOW samplesrc/testlib.pla
acme --setpc 4094 -o $(TESTLIB) samplesrc/testlib.a acme --setpc 4094 -o $(TESTLIB) samplesrc/testlib.a
./$(PLVM) TEST ./$(PLVM) TEST
$(ED): toolsrc/ed.pla $(PLVM02) $(PLASM) toolsrc/ed.pla $(ED): toolsrc/ed.pla $(PLVM02) $(PLASM) toolsrc/ed.pla
./$(PLASM) -AMOW < toolsrc/ed.pla > toolsrc/ed.a ./$(PLASM) -AMOW toolsrc/ed.pla
acme --setpc 4094 -o $(ED) toolsrc/ed.a acme --setpc 4094 -o $(ED) toolsrc/ed.a
$(MATCHFILES): libsrc/apple/matchfiles.pla $(PLVM02) $(PLASM) $(MATCHFILES): libsrc/apple/matchfiles.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/matchfiles.pla > libsrc/apple/matchfiles.a ./$(PLASM) -AMOW libsrc/apple/matchfiles.pla
acme --setpc 4094 -o $(MATCHFILES) libsrc/apple/matchfiles.a acme --setpc 4094 -o $(MATCHFILES) libsrc/apple/matchfiles.a
$(ARGS): libsrc/args.pla $(PLVM02) $(PLASM) $(ARGS): libsrc/args.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/args.pla > libsrc/args.a ./$(PLASM) -AMOW libsrc/args.pla
acme --setpc 4094 -o $(ARGS) libsrc/args.a acme --setpc 4094 -o $(ARGS) libsrc/args.a
$(MEMMGR): libsrc/memmgr.pla $(PLVM02) $(PLASM) $(MEMMGR): libsrc/memmgr.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/memmgr.pla > libsrc/memmgr.a ./$(PLASM) -AMOW libsrc/memmgr.pla
acme --setpc 4094 -o $(MEMMGR) libsrc/memmgr.a acme --setpc 4094 -o $(MEMMGR) libsrc/memmgr.a
$(MEMTEST): samplesrc/memtest.pla $(PLVM02) $(PLASM) $(MEMTEST): samplesrc/memtest.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/memtest.pla > samplesrc/memtest.a ./$(PLASM) -AMOW samplesrc/memtest.pla
acme --setpc 4094 -o $(MEMTEST) samplesrc/memtest.a acme --setpc 4094 -o $(MEMTEST) samplesrc/memtest.a
$(FIBER): libsrc/fiber.pla $(PLVM02) $(PLASM) $(FIBER): libsrc/fiber.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/fiber.pla > libsrc/fiber.a ./$(PLASM) -AMOW libsrc/fiber.pla
acme --setpc 4094 -o $(FIBER) libsrc/fiber.a acme --setpc 4094 -o $(FIBER) libsrc/fiber.a
$(LINES): libsrc/lines.pla $(PLVM02) $(PLASM) $(LINES): libsrc/lines.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/lines.pla > libsrc/lines.a ./$(PLASM) -AMOW libsrc/lines.pla
acme --setpc 4094 -o $(LINES) libsrc/lines.a acme --setpc 4094 -o $(LINES) libsrc/lines.a
$(FIBERTEST): samplesrc/fibertest.pla $(PLVM02) $(PLASM) $(FIBERTEST): samplesrc/fibertest.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/fibertest.pla > samplesrc/fibertest.a ./$(PLASM) -AMOW samplesrc/fibertest.pla
acme --setpc 4094 -o $(FIBERTEST) samplesrc/fibertest.a acme --setpc 4094 -o $(FIBERTEST) samplesrc/fibertest.a
$(LONGJMP): libsrc/longjmp.pla $(PLVM02) $(PLASM) $(LONGJMP): libsrc/longjmp.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/longjmp.pla > libsrc/longjmp.a ./$(PLASM) -AMOW libsrc/longjmp.pla
acme --setpc 4094 -o $(LONGJMP) libsrc/longjmp.a acme --setpc 4094 -o $(LONGJMP) libsrc/longjmp.a
$(SFM): samplesrc/sfm.pla $(PLVM02) $(PLASM) $(SFM): samplesrc/sfm.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/sfm.pla > samplesrc/sfm.a ./$(PLASM) -AMOW samplesrc/sfm.pla
acme --setpc 4094 -o $(SFM) samplesrc/sfm.a acme --setpc 4094 -o $(SFM) samplesrc/sfm.a
$(SFMSPRT): samplesrc/sfmsprt.pla $(PLVM02) $(PLASM) $(SFMSPRT): samplesrc/sfmsprt.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/sfmsprt.pla > samplesrc/sfmsprt.a ./$(PLASM) -AMOW samplesrc/sfmsprt.pla
acme --setpc 4094 -o $(SFMSPRT) samplesrc/sfmsprt.a acme --setpc 4094 -o $(SFMSPRT) samplesrc/sfmsprt.a
$(ROGUE): samplesrc/rogue.pla $(PLVM02) $(PLASM) $(ROGUE): samplesrc/rogue.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/rogue.pla > samplesrc/rogue.a ./$(PLASM) -AMOW samplesrc/rogue.pla
acme --setpc 4094 -o $(ROGUE) samplesrc/rogue.a acme --setpc 4094 -o $(ROGUE) samplesrc/rogue.a
$(ROGUECOMBAT): samplesrc/rogue.combat.pla $(PLVM02) $(PLASM) $(ROGUECOMBAT): samplesrc/rogue.combat.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/rogue.combat.pla > samplesrc/rogue.combat.a ./$(PLASM) -AMOW samplesrc/rogue.combat.pla
acme --setpc 4094 -o $(ROGUECOMBAT) samplesrc/rogue.combat.a acme --setpc 4094 -o $(ROGUECOMBAT) samplesrc/rogue.combat.a
$(ROGUEMAP): samplesrc/rogue.map.pla $(PLVM02) $(PLASM) $(ROGUEMAP): samplesrc/rogue.map.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/rogue.map.pla > samplesrc/rogue.map.a ./$(PLASM) -AMOW samplesrc/rogue.map.pla
acme --setpc 4094 -o $(ROGUEMAP) samplesrc/rogue.map.a acme --setpc 4094 -o $(ROGUEMAP) samplesrc/rogue.map.a
hello: samplesrc/hello.pla $(PLVM) $(PLASM) hello: samplesrc/hello.pla $(PLVM) $(PLASM)
./$(PLASM) -AMOW < samplesrc/hello.pla > samplesrc/hello.a ./$(PLASM) -AMOW samplesrc/hello.pla
acme --setpc 4094 -o $(HELLO) samplesrc/hello.a acme --setpc 4094 -o $(HELLO) samplesrc/hello.a
./$(PLVM) HELLO ./$(PLVM) HELLO
$(CONIOTST): samplesrc/coniotst.pla $(PLVM02) $(PLASM) $(CONIOTST): samplesrc/coniotst.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/coniotst.pla > samplesrc/coniotst.a ./$(PLASM) -AMOW samplesrc/coniotst.pla
acme --setpc 4094 -o $(CONIOTST) samplesrc/coniotst.a acme --setpc 4094 -o $(CONIOTST) samplesrc/coniotst.a
$(ROD): samplesrc/rod.pla $(PLVM02) $(PLASM) $(ROD): samplesrc/rod.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/rod.pla > samplesrc/rod.a ./$(PLASM) -AMOW samplesrc/rod.pla
acme --setpc 4094 -o $(ROD) samplesrc/rod.a acme --setpc 4094 -o $(ROD) samplesrc/rod.a
$(SIEVE): samplesrc/sieve.pla $(PLVM02) $(PLASM) $(SIEVE): samplesrc/sieve.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMW < samplesrc/sieve.pla > samplesrc/sieve.a ./$(PLASM) -AMW samplesrc/sieve.pla
acme --setpc 4094 -o $(SIEVE) samplesrc/sieve.a acme --setpc 4094 -o $(SIEVE) samplesrc/sieve.a
$(PRIMEGAP): samplesrc/primegap.pla $(PLVM02) $(PLASM) $(PRIMEGAP): samplesrc/primegap.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMW < samplesrc/primegap.pla > samplesrc/primegap.a ./$(PLASM) -AMW samplesrc/primegap.pla
acme --setpc 4094 -o $(PRIMEGAP) samplesrc/primegap.a acme --setpc 4094 -o $(PRIMEGAP) samplesrc/primegap.a
$(INT32): libsrc/int32.pla $(PLVM02) $(PLASM) $(INT32): libsrc/int32.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/int32.pla > libsrc/int32.a ./$(PLASM) -AMOW libsrc/int32.pla
acme --setpc 4094 -o $(INT32) libsrc/int32.a acme --setpc 4094 -o $(INT32) libsrc/int32.a
$(INT32TEST): samplesrc/int32test.pla $(PLVM02) $(PLASM) $(INT32TEST): samplesrc/int32test.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/int32test.pla > samplesrc/int32test.a ./$(PLASM) -AMOW samplesrc/int32test.pla
acme --setpc 4094 -o $(INT32TEST) samplesrc/int32test.a acme --setpc 4094 -o $(INT32TEST) samplesrc/int32test.a
$(SANE): libsrc/sane.pla $(PLVM02) $(PLASM) $(SANE): libsrc/sane.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/sane.pla > libsrc/sane.a ./$(PLASM) -AMOW libsrc/sane.pla
acme --setpc 4094 -o $(SANE) libsrc/sane.a acme --setpc 4094 -o $(SANE) libsrc/sane.a
$(FPSTR): libsrc/fpstr.pla $(PLVM02) $(PLASM) $(FPSTR): libsrc/fpstr.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/fpstr.pla > libsrc/fpstr.a ./$(PLASM) -AMOW libsrc/fpstr.pla
acme --setpc 4094 -o $(FPSTR) libsrc/fpstr.a acme --setpc 4094 -o $(FPSTR) libsrc/fpstr.a
$(FPU): libsrc/fpu.pla $(PLVM02) $(PLASM) $(FPU): libsrc/fpu.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/fpu.pla > libsrc/fpu.a ./$(PLASM) -AMOW libsrc/fpu.pla
acme --setpc 4094 -o $(FPU) libsrc/fpu.a acme --setpc 4094 -o $(FPU) libsrc/fpu.a
$(SANITY): samplesrc/sanity.pla $(PLVM02) $(PLASM) $(SANITY): samplesrc/sanity.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/sanity.pla > samplesrc/sanity.a ./$(PLASM) -AMOW samplesrc/sanity.pla
acme --setpc 4094 -o $(SANITY) samplesrc/sanity.a acme --setpc 4094 -o $(SANITY) samplesrc/sanity.a
$(LZ4): libsrc/lz4.pla $(PLVM02) $(PLASM) $(LZ4): libsrc/lz4.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/lz4.pla > libsrc/lz4.a ./$(PLASM) -AMOW libsrc/lz4.pla
acme --setpc 4094 -o $(LZ4) libsrc/lz4.a acme --setpc 4094 -o $(LZ4) libsrc/lz4.a
$(LZ4CAT): samplesrc/lz4cat.pla inc/lz4.plh $(PLVM02) $(PLASM) $(LZ4CAT): samplesrc/lz4cat.pla inc/lz4.plh $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/lz4cat.pla > samplesrc/lz4cat.a ./$(PLASM) -AMOW samplesrc/lz4cat.pla
acme --setpc 4094 -o $(LZ4CAT) samplesrc/lz4cat.a acme --setpc 4094 -o $(LZ4CAT) samplesrc/lz4cat.a
$(RPNCALC): samplesrc/rpncalc.pla libsrc/fpu.pla inc/fpu.plh libsrc/fpstr.pla inc/fpstr.plh inc/conio.plh $(PLVM02) $(PLASM) $(RPNCALC): samplesrc/rpncalc.pla libsrc/fpu.pla inc/fpu.plh libsrc/fpstr.pla inc/fpstr.plh inc/conio.plh $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/rpncalc.pla > samplesrc/rpncalc.a ./$(PLASM) -AMOW samplesrc/rpncalc.pla
acme --setpc 4094 -o $(RPNCALC) samplesrc/rpncalc.a acme --setpc 4094 -o $(RPNCALC) samplesrc/rpncalc.a
$(ETHERIP): libsrc/etherip.pla $(PLVM02) $(PLASM) $(ETHERIP): libsrc/etherip.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/etherip.pla > libsrc/etherip.a ./$(PLASM) -AMOW libsrc/etherip.pla
acme --setpc 4094 -o $(ETHERIP) libsrc/etherip.a acme --setpc 4094 -o $(ETHERIP) libsrc/etherip.a
$(INET): libsrc/inet.pla $(PLVM02) $(PLASM) $(INET): libsrc/inet.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/inet.pla > libsrc/inet.a ./$(PLASM) -AMOW libsrc/inet.pla
acme --setpc 4094 -o $(INET) libsrc/inet.a acme --setpc 4094 -o $(INET) libsrc/inet.a
$(DHCP): libsrc/dhcp.pla $(PLVM02) $(PLASM) $(DHCP): libsrc/dhcp.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/dhcp.pla > libsrc/dhcp.a ./$(PLASM) -AMOW libsrc/dhcp.pla
acme --setpc 4094 -o $(DHCP) libsrc/dhcp.a acme --setpc 4094 -o $(DHCP) libsrc/dhcp.a
$(HTTPD): samplesrc/httpd.pla $(PLVM02) $(PLASM) $(HTTPD): samplesrc/httpd.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/httpd.pla > samplesrc/httpd.a ./$(PLASM) -AMOW samplesrc/httpd.pla
acme --setpc 4094 -o $(HTTPD) samplesrc/httpd.a acme --setpc 4094 -o $(HTTPD) samplesrc/httpd.a
$(TFTPD): utilsrc/tftpd.pla $(PLVM02) $(PLASM) $(TFTPD): utilsrc/tftpd.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < utilsrc/tftpd.pla > utilsrc/tftpd.a ./$(PLASM) -AMOW utilsrc/tftpd.pla
acme --setpc 4094 -o $(TFTPD) utilsrc/tftpd.a acme --setpc 4094 -o $(TFTPD) utilsrc/tftpd.a
$(MOUSE): libsrc/apple/mouse.pla $(PLVM02) $(PLASM) $(MOUSE): libsrc/apple/mouse.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/mouse.pla > libsrc/apple/mouse.a ./$(PLASM) -AMOW libsrc/apple/mouse.pla
acme --setpc 4094 -o $(MOUSE) libsrc/apple/mouse.a acme --setpc 4094 -o $(MOUSE) libsrc/apple/mouse.a
$(UTHERNET): libsrc/apple/uthernet.pla $(PLVM02) $(PLASM) $(UTHERNET): libsrc/apple/uthernet.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/uthernet.pla > libsrc/apple/uthernet.a ./$(PLASM) -AMOW libsrc/apple/uthernet.pla
acme --setpc 4094 -o $(UTHERNET) libsrc/apple/uthernet.a acme --setpc 4094 -o $(UTHERNET) libsrc/apple/uthernet.a
$(UTHERNET2): libsrc/apple/uthernet2.pla $(PLVM02) $(PLASM) $(UTHERNET2): libsrc/apple/uthernet2.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/uthernet2.pla > libsrc/apple/uthernet2.a ./$(PLASM) -AMOW libsrc/apple/uthernet2.pla
acme --setpc 4094 -o $(UTHERNET2) libsrc/apple/uthernet2.a acme --setpc 4094 -o $(UTHERNET2) libsrc/apple/uthernet2.a
$(FILEIO_APL): libsrc/apple/fileio.pla $(PLVM02) $(PLASM) $(FILEIO_APL): libsrc/apple/fileio.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/fileio.pla > libsrc/apple/fileio.a ./$(PLASM) -AMOW libsrc/apple/fileio.pla
acme --setpc 4094 -o $(FILEIO_APL) libsrc/apple/fileio.a acme --setpc 4094 -o $(FILEIO_APL) libsrc/apple/fileio.a
$(CONIO_APL): libsrc/apple/conio.pla $(PLVM02) $(PLASM) $(CONIO_APL): libsrc/apple/conio.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/conio.pla > libsrc/apple/conio.a ./$(PLASM) -AMOW libsrc/apple/conio.pla
acme --setpc 4094 -o $(CONIO_APL) libsrc/apple/conio.a acme --setpc 4094 -o $(CONIO_APL) libsrc/apple/conio.a
$(FILEIO_C64): libsrc/c64/fileio.pla $(PLVM02) $(PLASM) $(FILEIO_C64): libsrc/c64/fileio.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/c64/fileio.pla > libsrc/c64/fileio.a ./$(PLASM) -AMOW libsrc/c64/fileio.pla
acme --setpc 4094 -o $(FILEIO_C64) libsrc/c64/fileio.a acme --setpc 4094 -o $(FILEIO_C64) libsrc/c64/fileio.a
$(CONIO_C64): libsrc/c64/conio.pla $(PLVM02) $(PLASM) $(CONIO_C64): libsrc/c64/conio.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/c64/conio.pla > libsrc/c64/conio.a ./$(PLASM) -AMOW libsrc/c64/conio.pla
acme --setpc 4094 -o $(CONIO_C64) libsrc/c64/conio.a acme --setpc 4094 -o $(CONIO_C64) libsrc/c64/conio.a
$(SNDSEQ): libsrc/apple/sndseq.pla $(PLVM02) $(PLASM) $(SNDSEQ): libsrc/apple/sndseq.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/sndseq.pla > libsrc/apple/sndseq.a ./$(PLASM) -AMOW libsrc/apple/sndseq.pla
acme --setpc 4094 -o $(SNDSEQ) libsrc/apple/sndseq.a acme --setpc 4094 -o $(SNDSEQ) libsrc/apple/sndseq.a
$(PLAYSEQ): samplesrc/playseq.pla $(PLVM02) $(PLASM) $(PLAYSEQ): samplesrc/playseq.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/playseq.pla > samplesrc/playseq.a ./$(PLASM) -AMOW samplesrc/playseq.pla
acme --setpc 4094 -o $(PLAYSEQ) samplesrc/playseq.a acme --setpc 4094 -o $(PLAYSEQ) samplesrc/playseq.a
$(GRAFIX): libsrc/apple/grafix.pla $(PLVM02) $(PLASM) $(GRAFIX): libsrc/apple/grafix.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/grafix.pla > libsrc/apple/grafix.a ./$(PLASM) -AMOW libsrc/apple/grafix.pla
acme --setpc 4094 -o $(GRAFIX) libsrc/apple/grafix.a acme --setpc 4094 -o $(GRAFIX) libsrc/apple/grafix.a
$(GFXDEMO): samplesrc/gfxdemo.pla $(PLVM02) $(PLASM) $(GFXDEMO): samplesrc/gfxdemo.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/gfxdemo.pla > samplesrc/gfxdemo.a ./$(PLASM) -AMOW samplesrc/gfxdemo.pla
acme --setpc 4094 -o $(GFXDEMO) samplesrc/gfxdemo.a acme --setpc 4094 -o $(GFXDEMO) samplesrc/gfxdemo.a
$(FATCAT): samplesrc/fatcat.pla $(PLVM02) $(PLASM) $(FATCAT): samplesrc/fatcat.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/fatcat.pla > samplesrc/fatcat.a ./$(PLASM) -AMOW samplesrc/fatcat.pla
acme --setpc 4094 -o $(FATCAT) samplesrc/fatcat.a acme --setpc 4094 -o $(FATCAT) samplesrc/fatcat.a
$(FATGET): samplesrc/fatget.pla $(PLVM02) $(PLASM) $(FATGET): samplesrc/fatget.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/fatget.pla > samplesrc/fatget.a ./$(PLASM) -AMOW samplesrc/fatget.pla
acme --setpc 4094 -o $(FATGET) samplesrc/fatget.a acme --setpc 4094 -o $(FATGET) samplesrc/fatget.a
$(FATPUT): samplesrc/fatput.pla $(PLVM02) $(PLASM) $(FATPUT): samplesrc/fatput.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/fatput.pla > samplesrc/fatput.a ./$(PLASM) -AMOW samplesrc/fatput.pla
acme --setpc 4094 -o $(FATPUT) samplesrc/fatput.a acme --setpc 4094 -o $(FATPUT) samplesrc/fatput.a
$(FATWDSK): samplesrc/fatwritedsk.pla $(PLVM02) $(PLASM) $(FATWDSK): samplesrc/fatwritedsk.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/fatwritedsk.pla > samplesrc/fatwritedsk.a ./$(PLASM) -AMOW samplesrc/fatwritedsk.pla
acme --setpc 4094 -o $(FATWDSK) samplesrc/fatwritedsk.a acme --setpc 4094 -o $(FATWDSK) samplesrc/fatwritedsk.a
$(FATRDSK): samplesrc/fatreaddsk.pla $(PLVM02) $(PLASM) $(FATRDSK): samplesrc/fatreaddsk.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/fatreaddsk.pla > samplesrc/fatreaddsk.a ./$(PLASM) -AMOW samplesrc/fatreaddsk.pla
acme --setpc 4094 -o $(FATRDSK) samplesrc/fatreaddsk.a acme --setpc 4094 -o $(FATRDSK) samplesrc/fatreaddsk.a
$(SDFAT): libsrc/apple/sdfat.pla $(PLVM02) $(PLASM) $(SDFAT): libsrc/apple/sdfat.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/sdfat.pla > libsrc/apple/sdfat.a ./$(PLASM) -AMOW libsrc/apple/sdfat.pla
acme --setpc 4094 -o $(SDFAT) libsrc/apple/sdfat.a acme --setpc 4094 -o $(SDFAT) libsrc/apple/sdfat.a
$(SPIPORT): libsrc/apple/spiport.pla $(PLVM02) $(PLASM) $(SPIPORT): libsrc/apple/spiport.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/spiport.pla > libsrc/apple/spiport.a ./$(PLASM) -AMOW libsrc/apple/spiport.pla
acme --setpc 4094 -o $(SPIPORT) libsrc/apple/spiport.a acme --setpc 4094 -o $(SPIPORT) libsrc/apple/spiport.a
$(JOYBUZZ): libsrc/apple/joybuzz.pla $(PLVM02) $(PLASM) $(JOYBUZZ): libsrc/apple/joybuzz.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/joybuzz.pla > libsrc/apple/joybuzz.a ./$(PLASM) -AMOW libsrc/apple/joybuzz.pla
acme --setpc 4094 -o $(JOYBUZZ) libsrc/apple/joybuzz.a acme --setpc 4094 -o $(JOYBUZZ) libsrc/apple/joybuzz.a
$(PORTIO): libsrc/apple/portio.pla $(PLVM02) $(PLASM) $(PORTIO): libsrc/apple/portio.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/portio.pla > libsrc/apple/portio.a ./$(PLASM) -AMOW libsrc/apple/portio.pla
acme --setpc 4094 -o $(PORTIO) libsrc/apple/portio.a acme --setpc 4094 -o $(PORTIO) libsrc/apple/portio.a
$(HGRLIB): libsrc/apple/hgrlib.pla $(PLVM02) $(PLASM) $(HGRLIB): libsrc/apple/hgrlib.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/hgrlib.pla > libsrc/apple/hgrlib.a ./$(PLASM) -AMOW libsrc/apple/hgrlib.pla
acme --setpc 4094 -o $(HGRLIB) libsrc/apple/hgrlib.a acme --setpc 4094 -o $(HGRLIB) libsrc/apple/hgrlib.a
$(GRLIB): libsrc/apple/grlib.pla $(PLVM02) $(PLASM) $(GRLIB): libsrc/apple/grlib.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/grlib.pla > libsrc/apple/grlib.a ./$(PLASM) -AMOW libsrc/apple/grlib.pla
acme --setpc 4094 -o $(GRLIB) libsrc/apple/grlib.a acme --setpc 4094 -o $(GRLIB) libsrc/apple/grlib.a
$(DGRLIB): libsrc/apple/dgrlib.pla $(PLVM02) $(PLASM) $(DGRLIB): libsrc/apple/dgrlib.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/dgrlib.pla > libsrc/apple/dgrlib.a ./$(PLASM) -AMOW libsrc/apple/dgrlib.pla
acme --setpc 4094 -o $(DGRLIB) libsrc/apple/dgrlib.a acme --setpc 4094 -o $(DGRLIB) libsrc/apple/dgrlib.a
$(TILETEST): samplesrc/tiletest.pla $(PLASM) $(TILETEST): samplesrc/tiletest.pla $(PLASM)
./$(PLASM) -AMOW < samplesrc/tiletest.pla > samplesrc/tiletest.a ./$(PLASM) -AMOW samplesrc/tiletest.pla
acme --setpc 4094 -o $(TILETEST) samplesrc/tiletest.a acme --setpc 4094 -o $(TILETEST) samplesrc/tiletest.a
$(HGRTILE): libsrc/apple/hgrtile.pla $(PLVM02) $(PLASM) $(HGRTILE): libsrc/apple/hgrtile.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/hgrtile.pla > libsrc/apple/hgrtile.a ./$(PLASM) -AMOW libsrc/apple/hgrtile.pla
acme --setpc 4094 -o $(HGRTILE) libsrc/apple/hgrtile.a acme --setpc 4094 -o $(HGRTILE) libsrc/apple/hgrtile.a
$(HGRFONT): libsrc/apple/hgrfont.pla $(PLVM02) $(PLASM) $(HGRFONT): libsrc/apple/hgrfont.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/hgrfont.pla > libsrc/apple/hgrfont.a ./$(PLASM) -AMOW libsrc/apple/hgrfont.pla
acme --setpc 4094 -o $(HGRFONT) libsrc/apple/hgrfont.a acme --setpc 4094 -o $(HGRFONT) libsrc/apple/hgrfont.a
$(HGRSPRITE): libsrc/apple/hgrsprite.pla $(PLVM02) $(PLASM) $(HGRSPRITE): libsrc/apple/hgrsprite.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/hgrsprite.pla > libsrc/apple/hgrsprite.a ./$(PLASM) -AMOW libsrc/apple/hgrsprite.pla
acme --setpc 4094 -o $(HGRSPRITE) libsrc/apple/hgrsprite.a acme --setpc 4094 -o $(HGRSPRITE) libsrc/apple/hgrsprite.a
$(HGRTEST): samplesrc/hgrtest.pla $(HGRLIB) $(PLASM) $(HGRTEST): samplesrc/hgrtest.pla $(HGRLIB) $(PLASM)
./$(PLASM) -AMOW < samplesrc/hgrtest.pla > samplesrc/hgrtest.a ./$(PLASM) -AMOW samplesrc/hgrtest.pla
acme --setpc 4094 -o $(HGRTEST) samplesrc/hgrtest.a acme --setpc 4094 -o $(HGRTEST) samplesrc/hgrtest.a
$(GRTEST): samplesrc/grtest.pla $(GRLIB) $(PLASM) $(GRTEST): samplesrc/grtest.pla $(GRLIB) $(PLASM)
./$(PLASM) -AMOW < samplesrc/grtest.pla > samplesrc/grtest.a ./$(PLASM) -AMOW samplesrc/grtest.pla
acme --setpc 4094 -o $(GRTEST) samplesrc/grtest.a acme --setpc 4094 -o $(GRTEST) samplesrc/grtest.a
$(DGRTEST): samplesrc/dgrtest.pla $(DGRLIB) $(PLASM) $(DGRTEST): samplesrc/dgrtest.pla $(DGRLIB) $(PLASM)
./$(PLASM) -AMOW < samplesrc/dgrtest.pla > samplesrc/dgrtest.a ./$(PLASM) -AMOW samplesrc/dgrtest.pla
acme --setpc 4094 -o $(DGRTEST) samplesrc/dgrtest.a acme --setpc 4094 -o $(DGRTEST) samplesrc/dgrtest.a
$(MON): utilsrc/apple/mon.pla $(PLASM) $(MON): utilsrc/apple/mon.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/mon.pla > utilsrc/apple/mon.a ./$(PLASM) -AMOW utilsrc/apple/mon.pla
acme --setpc 4094 -o $(MON) utilsrc/apple/mon.a acme --setpc 4094 -o $(MON) utilsrc/apple/mon.a
$(COPY): utilsrc/apple/copy.pla $(MATCHFILES) $(PLASM) $(COPY): utilsrc/apple/copy.pla $(MATCHFILES) $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/copy.pla > utilsrc/apple/copy.a ./$(PLASM) -AMOW utilsrc/apple/copy.pla
acme --setpc 4094 -o $(COPY) utilsrc/apple/copy.a acme --setpc 4094 -o $(COPY) utilsrc/apple/copy.a
$(DEL): utilsrc/apple/del.pla $(MATCHFILES) $(PLASM) $(DEL): utilsrc/apple/del.pla $(MATCHFILES) $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/del.pla > utilsrc/apple/del.a ./$(PLASM) -AMOW utilsrc/apple/del.pla
acme --setpc 4094 -o $(DEL) utilsrc/apple/del.a acme --setpc 4094 -o $(DEL) utilsrc/apple/del.a
$(REN): utilsrc/apple/ren.pla $(PLASM) $(REN): utilsrc/apple/ren.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/ren.pla > utilsrc/apple/ren.a ./$(PLASM) -AMOW utilsrc/apple/ren.pla
acme --setpc 4094 -o $(REN) utilsrc/apple/ren.a acme --setpc 4094 -o $(REN) utilsrc/apple/ren.a
$(CAT): utilsrc/apple/cat.pla $(MATCHFILES) $(PLASM) $(CAT): utilsrc/apple/cat.pla $(MATCHFILES) $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/cat.pla > utilsrc/apple/cat.a ./$(PLASM) -AMOW utilsrc/apple/cat.pla
acme --setpc 4094 -o $(CAT) utilsrc/apple/cat.a acme --setpc 4094 -o $(CAT) utilsrc/apple/cat.a
$(NEWDIR): utilsrc/apple/newdir.pla $(PLASM) $(NEWDIR): utilsrc/apple/newdir.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/newdir.pla > utilsrc/apple/newdir.a ./$(PLASM) -AMOW utilsrc/apple/newdir.pla
acme --setpc 4094 -o $(NEWDIR) utilsrc/apple/newdir.a acme --setpc 4094 -o $(NEWDIR) utilsrc/apple/newdir.a
$(TYPE): utilsrc/apple/type.pla $(PLASM) $(TYPE): utilsrc/apple/type.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/type.pla > utilsrc/apple/type.a ./$(PLASM) -AMOW utilsrc/apple/type.pla
acme --setpc 4094 -o $(TYPE) utilsrc/apple/type.a acme --setpc 4094 -o $(TYPE) utilsrc/apple/type.a
$(SOS): utilsrc/apple/sos.pla $(PLVM03) $(PLASM) $(SOS): utilsrc/apple/sos.pla $(PLVM03) $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/sos.pla > utilsrc/apple/sos.a ./$(PLASM) -AMOW utilsrc/apple/sos.pla
acme --setpc 4094 -o $(SOS) utilsrc/apple/sos.a acme --setpc 4094 -o $(SOS) utilsrc/apple/sos.a
$(ZIPCHIP): utilsrc/apple/zipchip.pla $(PLASM) $(ZIPCHIP): utilsrc/apple/zipchip.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/zipchip.pla > utilsrc/apple/zipchip.a ./$(PLASM) -AMOW utilsrc/apple/zipchip.pla
acme --setpc 4094 -o $(ZIPCHIP) utilsrc/apple/zipchip.a acme --setpc 4094 -o $(ZIPCHIP) utilsrc/apple/zipchip.a
$(JIT): libsrc/apple/jit.pla libsrc/jitcore.pla $(PLVMJIT) $(PLASM) $(JIT): libsrc/apple/jit.pla libsrc/jitcore.pla $(PLVMJIT) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/jit.pla > libsrc/apple/jit.a ./$(PLASM) -AMOW libsrc/apple/jit.pla
acme --setpc 4094 -o $(JIT) libsrc/apple/jit.a acme --setpc 4094 -o $(JIT) libsrc/apple/jit.a
$(JIT16): libsrc/apple/jit16.pla libsrc/jit16core.pla $(PLVMJIT) $(PLASM) $(JIT16): libsrc/apple/jit16.pla libsrc/jit16core.pla $(PLVMJIT) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/jit16.pla > libsrc/apple/jit16.a ./$(PLASM) -AMOW libsrc/apple/jit16.pla
acme --setpc 4094 -o $(JIT16) libsrc/apple/jit16.a acme --setpc 4094 -o $(JIT16) libsrc/apple/jit16.a
$(JITUNE): utilsrc/apple/jitune.pla $(PLVMJIT) $(PLASM) $(JITUNE): utilsrc/apple/jitune.pla $(PLVMJIT) $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/jitune.pla > utilsrc/apple/jitune.a ./$(PLASM) -AMOW utilsrc/apple/jitune.pla
acme --setpc 4094 -o $(JITUNE) utilsrc/apple/jitune.a acme --setpc 4094 -o $(JITUNE) utilsrc/apple/jitune.a

View File

@@ -198,6 +198,7 @@ cp samplesrc/gfxdemo.pla prodos/bld/samples/GFXDEMO.PLA.TXT
cp samplesrc/lz4cat.pla prodos/bld/samples/Z4CAT.PLA.TXT cp samplesrc/lz4cat.pla prodos/bld/samples/Z4CAT.PLA.TXT
cp samplesrc/sfm.pla prodos/bld/samples/SFM.PLA.TXT cp samplesrc/sfm.pla prodos/bld/samples/SFM.PLA.TXT
cp samplesrc/sfmsprt.pla prodos/bld/samples/SFMSPRT.PLA.TXT cp samplesrc/sfmsprt.pla prodos/bld/samples/SFMSPRT.PLA.TXT
cp samplesrc/fppow.pla prodos/bld/samples/FPPOW.PLA.TXT
cp utilsrc/apple/mon.pla prodos/bld/samples/MON.PLA.TXT cp utilsrc/apple/mon.pla prodos/bld/samples/MON.PLA.TXT
cp utilsrc/apple/zipchip.pla prodos/bld/samples/ZIPCHIP.PLA.TXT cp utilsrc/apple/zipchip.pla prodos/bld/samples/ZIPCHIP.PLA.TXT

View File

@@ -19,6 +19,5 @@ fbrInit(4)
fbrStart(@fbrTest, 3) fbrStart(@fbrTest, 3)
fbrStart(@fbrTest, 2) fbrStart(@fbrTest, 2)
fbrStart(@fbrTest, 1) fbrStart(@fbrTest, 1)
fbrYield; fbrYield; fbrYield; fbrYield while fbrCount > 1; fbrYield; loop
done done

44
src/samplesrc/fppow.pla Normal file
View File

@@ -0,0 +1,44 @@
include "inc/cmdsys.plh"
include "inc/sane.plh"
include "inc/fpstr.plh"
var xT[t_extended]
char sT[32] // extra space
byte str = "123456789.123456789"
byte i
// mul div
def test(iM, iD)#0
sane:saveZP()
sane:op2FP(FFINT|FOMUL, @xT, @iM)
sane:op2FP(FFINT|FODIV, @xT, @iD)
sane:restoreZP(0)
putc('x')
if iM<10; putc(' '); fin
puti(iM); putc('/'); puti(iD)
if iD<10; putc(' '); fin
puts("=>")
ext2str(@xT,@sT,9,9,FPSTR_FLEX|FPSTR_FIXED) // fixed
puts(@sT); putc('[')
puti( sT); putc(']')
putln
end
puts("Float Format Text\n\n")
sane:initFP()
strcpy(@sT,@str); str2ext(@sT,@xT)
puts("begin: ")
puts(@sT); putc('[')
puti( sT); putc(']')
putln
test(1,1)
for i=1 to 10
test(32000,1)
next
strcpy(@sT,@str); str2ext(@sT,@xT)
for i=1 to 10
test(1,2)
next
puts("Done\n")
done

View File

@@ -5,7 +5,8 @@ include "inc/cmdsys.plh"
include "inc/fpstr.plh" include "inc/fpstr.plh"
include "inc/fpu.plh" include "inc/fpu.plh"
include "inc/conio.plh" include "inc/conio.plh"
const displayWidth = 16 const displayWidth = 15
const displayDefFix = 6
const inputLen = displayWidth+1 const inputLen = displayWidth+1
const ZEROSTR = $3001 const ZEROSTR = $3001
// //
@@ -36,8 +37,8 @@ byte inputStr[32] = ""
// //
// Display format state // Display format state
// //
byte displayFix = 6 byte displayFix = displayDefFix
byte displayInt = displayWidth - 7 // - displayFix - 1 byte displayInt = displayWidth - displayDefFix - 2
// //
// Store/load memory // Store/load memory
// //
@@ -152,9 +153,10 @@ def showStack#0
byte strFP[displayWidth+1] byte strFP[displayWidth+1]
for s = 0 to 3 for s = 0 to 3
fpu:storStr(@strFP, displayInt, displayFix, FPSTR_FIXED, s) fpu:storStr(@strFP, displayInt, displayFix, FPSTR_FIXED|FPSTR_FLEX, s)
conio:gotoxy(4, 5 - s) conio:gotoxy(4, 5 - s)
repc(displayWidth - strFP - 1, ' ') //repc(displayWidth - strFP - 1, ' ')
repc(displayWidth - strFP, ' ')
puts(@strFP) puts(@strFP)
next next
end end
@@ -163,7 +165,7 @@ def showMem#0
byte strFP[displayWidth+1] byte strFP[displayWidth+1]
for m = 0 to 9 for m = 0 to 9
ext2str(@memory[m*t_fpureg], @strFP, displayInt, displayFix, FPSTR_FIXED) ext2str(@memory[m*t_fpureg], @strFP, displayInt, displayFix, FPSTR_FIXED|FPSTR_FLEX)
conio:gotoxy(23, 2 + m) conio:gotoxy(23, 2 + m)
repc(displayWidth - strFP - 1, ' ') repc(displayWidth - strFP - 1, ' ')
puts(@strFP) puts(@strFP)
@@ -252,7 +254,7 @@ def delKey(pkey)#0
showInput showInput
end end
def dropKey(pkey)#0 def dropKey(pkey)#0
fpu:pullStr(@inputStr, displayInt, displayFix, FPSTR_STRIP|FPSTR_FLOAT) fpu:pullStr(@inputStr, displayInt, displayFix, FPSTR_STRIP|FPSTR_FLOAT|FPSTR_FLEX)
if inputStr.1 == ' ' if inputStr.1 == ' '
inputStr-- inputStr--
memcpy(@inputStr.1, @inputStr.2, inputStr) memcpy(@inputStr.1, @inputStr.2, inputStr)
@@ -261,7 +263,7 @@ def dropKey(pkey)#0
showStack showStack
end end
def copyKey(pkey)#0 def copyKey(pkey)#0
fpu:storStr(@inputStr, displayInt, displayFix, FPSTR_STRIP|FPSTR_FLOAT, X_REG) fpu:storStr(@inputStr, displayInt, displayFix, FPSTR_STRIP|FPSTR_FLOAT|FPSTR_FLEX, X_REG)
if inputStr.1 == ' ' if inputStr.1 == ' '
inputStr-- inputStr--
memcpy(@inputStr.1, @inputStr.2, inputStr) memcpy(@inputStr.1, @inputStr.2, inputStr)
@@ -380,7 +382,7 @@ def elemsKey(pkey)#0
is 'L' is 'L'
fpu:log2X() fpu:log2X()
break break
is 'E' is 'P'
fpu:powEX() fpu:powEX()
break break
is 'N' is 'N'
@@ -403,7 +405,7 @@ def cmdKey(pkey)#0
d = toupper(getc) - '0' d = toupper(getc) - '0'
if d >= 1 and d <= 9 if d >= 1 and d <= 9
displayFix = d displayFix = d
displayInt = displayWidth - displayFix - 1 displayInt = displayWidth - displayFix - 2
elsif d == 'Q' - '0' elsif d == 'Q' - '0'
quit = TRUE quit = TRUE
fin fin
@@ -450,7 +452,7 @@ initInput
showStack showStack
showMem showMem
showInput showInput
showStatus("Version 0.6") showStatus("Version 0.7")
inputKey inputKey
conio:gotoxy(0, 22) conio:gotoxy(0, 22)
done done

View File

@@ -57,5 +57,6 @@ echo "BLD/SAMPLES/GFXDEMO.PLA"; atftp $1 --put -l samplesrc/gfxdemo.pla -r $
echo "BLD/SAMPLES/LZ4CAT.PLA"; atftp $1 --put -l samplesrc/lz4cat.pla -r $2/BLD/SAMPLES/LZ4CAT.PLA#040000 echo "BLD/SAMPLES/LZ4CAT.PLA"; atftp $1 --put -l samplesrc/lz4cat.pla -r $2/BLD/SAMPLES/LZ4CAT.PLA#040000
echo "BLD/SAMPLES/SFM.PLA"; atftp $1 --put -l samplesrc/sfm.pla -r $2/BLD/SAMPLES/SFM.PLA#040000 echo "BLD/SAMPLES/SFM.PLA"; atftp $1 --put -l samplesrc/sfm.pla -r $2/BLD/SAMPLES/SFM.PLA#040000
echo "BLD/SAMPLES/SFMSPRT.PLA"; atftp $1 --put -l samplesrc/sfmsprt.pla -r $2/BLD/SAMPLES/SFMSPRT.PLA#040000 echo "BLD/SAMPLES/SFMSPRT.PLA"; atftp $1 --put -l samplesrc/sfmsprt.pla -r $2/BLD/SAMPLES/SFMSPRT.PLA#040000
echo "BLD/SAMPLES/FPPOW.PLA"; atftp $1 --put -l samplesrc/fppow.pla -r $2/BLD/SAMPLES/FPPOW.PLA#040000
echo "BLD/SAMPLES/MON.PLA"; atftp $1 --put -l utilsrc/apple/mon.pla -r $2/BLD/SAMPLES/MON.PLA#040000 echo "BLD/SAMPLES/MON.PLA"; atftp $1 --put -l utilsrc/apple/mon.pla -r $2/BLD/SAMPLES/MON.PLA#040000

View File

@@ -173,7 +173,7 @@ int idglobal_add(char *name, int len, int type, int size)
} }
else else
{ {
printf("\t\t\t\t\t; %s -> X%03d\n", &idglobal_name[globals][1], externs); fprintf(outputfile, "\t\t\t\t\t; %s -> X%03d\n", &idglobal_name[globals][1], externs);
idglobal_tag[globals++] = externs++; idglobal_tag[globals++] = externs++;
} }
return (1); return (1);
@@ -219,7 +219,7 @@ int idfunc_add(char *name, int len, int type, int tag)
idglobal_type[globals] = type; idglobal_type[globals] = type;
idglobal_tag[globals++] = tag; idglobal_tag[globals++] = tag;
if (type & EXTERN_TYPE) if (type & EXTERN_TYPE)
printf("\t\t\t\t\t; %s -> X%03d\n", &idglobal_name[globals - 1][1], tag); fprintf(outputfile, "\t\t\t\t\t; %s -> X%03d\n", &idglobal_name[globals - 1][1], tag);
return (1); return (1);
} }
int idfunc_set(char *name, int len, int type, int tag) int idfunc_set(char *name, int len, int type, int tag)
@@ -343,11 +343,11 @@ void emit_dci(char *str, int len)
{ {
if (len--) if (len--)
{ {
printf("\t; DCI STRING: %s\n", supper(str)); fprintf(outputfile, "\t; DCI STRING: %s\n", supper(str));
printf("\t%s\t$%02X", DB, toupper(*str++) | (len ? 0x80 : 0x00)); fprintf(outputfile, "\t%s\t$%02X", DB, toupper(*str++) | (len ? 0x80 : 0x00));
while (len--) while (len--)
printf(",$%02X", toupper(*str++) | (len ? 0x80 : 0x00)); fprintf(outputfile, ",$%02X", toupper(*str++) | (len ? 0x80 : 0x00));
printf("\n"); fprintf(outputfile, "\n");
} }
} }
void emit_flags(int flags) void emit_flags(int flags)
@@ -365,22 +365,22 @@ void emit_header(void)
int i; int i;
if (outflags & ACME) if (outflags & ACME)
printf("; ACME COMPATIBLE OUTPUT\n"); fprintf(outputfile, "; ACME COMPATIBLE OUTPUT\n");
else else
printf("; CA65 COMPATIBLE OUTPUT\n"); fprintf(outputfile, "; CA65 COMPATIBLE OUTPUT\n");
if (outflags & MODULE) if (outflags & MODULE)
{ {
printf("\t%s\t_SEGEND-_SEGBEGIN\t; LENGTH OF HEADER + CODE/DATA + BYTECODE SEGMENT\n", DW); fprintf(outputfile, "\t%s\t_SEGEND-_SEGBEGIN\t; LENGTH OF HEADER + CODE/DATA + BYTECODE SEGMENT\n", DW);
printf("_SEGBEGIN%c\n", LBL); fprintf(outputfile, "_SEGBEGIN%c\n", LBL);
printf("\t%s\t$6502\t\t\t; MAGIC #\n", DW); fprintf(outputfile, "\t%s\t$6502\t\t\t; MAGIC #\n", DW);
printf("\t%s\t_SYSFLAGS\t\t\t; SYSTEM FLAGS\n", DW); fprintf(outputfile, "\t%s\t_SYSFLAGS\t\t\t; SYSTEM FLAGS\n", DW);
printf("\t%s\t_SUBSEG\t\t\t; BYTECODE SUB-SEGMENT\n", DW); fprintf(outputfile, "\t%s\t_SUBSEG\t\t\t; BYTECODE SUB-SEGMENT\n", DW);
printf("\t%s\t_DEFCNT\t\t\t; BYTECODE DEF COUNT\n", DW); fprintf(outputfile, "\t%s\t_DEFCNT\t\t\t; BYTECODE DEF COUNT\n", DW);
printf("\t%s\t_INIT\t\t\t; MODULE INITIALIZATION ROUTINE\n", DW); fprintf(outputfile, "\t%s\t_INIT\t\t\t; MODULE INITIALIZATION ROUTINE\n", DW);
} }
else else
{ {
printf("\tJMP\t_INIT\t\t\t; MODULE INITIALIZATION ROUTINE\n"); fprintf(outputfile, "\tJMP\t_INIT\t\t\t; MODULE INITIALIZATION ROUTINE\n");
} }
/* /*
* Init free op sequence table * Init free op sequence table
@@ -393,7 +393,7 @@ void emit_rld(void)
{ {
int i, j; int i, j;
printf(";\n; RE-LOCATEABLE DICTIONARY\n;\n"); fprintf(outputfile, ";\n; RE-LOCATEABLE DICTIONARY\n;\n");
/* /*
* First emit the bytecode definition entrypoint information. * First emit the bytecode definition entrypoint information.
*/ */
@@ -409,9 +409,9 @@ void emit_rld(void)
j = outflags & INIT ? defs - 1 : defs; j = outflags & INIT ? defs - 1 : defs;
for (i = 0; i < j; i++) for (i = 0; i < j; i++)
{ {
printf("\t%s\t$02\t\t\t; CODE TABLE FIXUP\n", DB); fprintf(outputfile, "\t%s\t$02\t\t\t; CODE TABLE FIXUP\n", DB);
printf("\t%s\t_C%03d\t\t\n", DW, i); fprintf(outputfile, "\t%s\t_C%03d\t\t\n", DW, i);
printf("\t%s\t$00\n", DB); fprintf(outputfile, "\t%s\t$00\n", DB);
} }
/* /*
* Now emit the fixup table. * Now emit the fixup table.
@@ -420,53 +420,53 @@ void emit_rld(void)
{ {
if (fixup_type[i] & EXTERN_TYPE) if (fixup_type[i] & EXTERN_TYPE)
{ {
printf("\t%s\t$%02X\t\t\t; EXTERNAL FIXUP\n", DB, 0x11 + fixup_size[i] & 0xFF); fprintf(outputfile, "\t%s\t$%02X\t\t\t; EXTERNAL FIXUP\n", DB, 0x11 + fixup_size[i] & 0xFF);
printf("\t%s\t_F%03d-_SEGBEGIN\t\t\n", DW, i); fprintf(outputfile, "\t%s\t_F%03d-_SEGBEGIN\t\t\n", DW, i);
printf("\t%s\t%d\t\t\t; ESD INDEX\n", DB, fixup_tag[i]); fprintf(outputfile, "\t%s\t%d\t\t\t; ESD INDEX\n", DB, fixup_tag[i]);
} }
else else
{ {
printf("\t%s\t$%02X\t\t\t; INTERNAL FIXUP\n", DB, 0x01 + fixup_size[i] & 0xFF); fprintf(outputfile, "\t%s\t$%02X\t\t\t; INTERNAL FIXUP\n", DB, 0x01 + fixup_size[i] & 0xFF);
printf("\t%s\t_F%03d-_SEGBEGIN\t\t\n", DW, i); fprintf(outputfile, "\t%s\t_F%03d-_SEGBEGIN\t\t\n", DW, i);
printf("\t%s\t$00\n", DB); fprintf(outputfile, "\t%s\t$00\n", DB);
} }
} }
printf("\t%s\t$00\t\t\t; END OF RLD\n", DB); fprintf(outputfile, "\t%s\t$00\t\t\t; END OF RLD\n", DB);
} }
void emit_esd(void) void emit_esd(void)
{ {
int i; int i;
printf(";\n; EXTERNAL/ENTRY SYMBOL DICTIONARY\n;\n"); fprintf(outputfile, ";\n; EXTERNAL/ENTRY SYMBOL DICTIONARY\n;\n");
for (i = 0; i < globals; i++) for (i = 0; i < globals; i++)
{ {
if (idglobal_type[i] & ACCESSED_TYPE) // Only refer to accessed externals if (idglobal_type[i] & ACCESSED_TYPE) // Only refer to accessed externals
{ {
emit_dci(&idglobal_name[i][1], idglobal_name[i][0]); emit_dci(&idglobal_name[i][1], idglobal_name[i][0]);
printf("\t%s\t$10\t\t\t; EXTERNAL SYMBOL FLAG\n", DB); fprintf(outputfile, "\t%s\t$10\t\t\t; EXTERNAL SYMBOL FLAG\n", DB);
printf("\t%s\t%d\t\t\t; ESD INDEX\n", DW, idglobal_tag[i]); fprintf(outputfile, "\t%s\t%d\t\t\t; ESD INDEX\n", DW, idglobal_tag[i]);
} }
else if (idglobal_type[i] & EXPORT_TYPE) else if (idglobal_type[i] & EXPORT_TYPE)
{ {
emit_dci(&idglobal_name[i][1], idglobal_name[i][0]); emit_dci(&idglobal_name[i][1], idglobal_name[i][0]);
printf("\t%s\t$08\t\t\t; ENTRY SYMBOL FLAG\n", DB); fprintf(outputfile, "\t%s\t$08\t\t\t; ENTRY SYMBOL FLAG\n", DB);
printf("\t%s\t%s\t\t\n", DW, tag_string(idglobal_tag[i], idglobal_type[i])); fprintf(outputfile, "\t%s\t%s\t\t\n", DW, tag_string(idglobal_tag[i], idglobal_type[i]));
} }
} }
printf("\t%s\t$00\t\t\t; END OF ESD\n", DB); fprintf(outputfile, "\t%s\t$00\t\t\t; END OF ESD\n", DB);
} }
void emit_trailer(void) void emit_trailer(void)
{ {
if (!(outflags & BYTECODE_SEG)) if (!(outflags & BYTECODE_SEG))
emit_bytecode_seg(); emit_bytecode_seg();
if (!(outflags & INIT)) if (!(outflags & INIT))
printf("_INIT\t=\t0\n"); fprintf(outputfile, "_INIT\t=\t0\n");
if (!(outflags & SYSFLAGS)) if (!(outflags & SYSFLAGS))
printf("_SYSFLAGS\t=\t0\n"); fprintf(outputfile, "_SYSFLAGS\t=\t0\n");
if (outflags & MODULE) if (outflags & MODULE)
{ {
printf("_DEFCNT\t=\t%d\n", defs); fprintf(outputfile, "_DEFCNT\t=\t%d\n", defs);
printf("_SEGEND%c\n", LBL); fprintf(outputfile, "_SEGEND%c\n", LBL);
emit_rld(); emit_rld();
emit_esd(); emit_esd();
} }
@@ -481,12 +481,12 @@ void emit_moddep(char *name, int len)
idglobal_add(name, len, EXTERN_TYPE | WORD_TYPE, 2); // Add to symbol table idglobal_add(name, len, EXTERN_TYPE | WORD_TYPE, 2); // Add to symbol table
} }
else else
printf("\t%s\t$00\t\t\t; END OF MODULE DEPENDENCIES\n", DB); fprintf(outputfile, "\t%s\t$00\t\t\t; END OF MODULE DEPENDENCIES\n", DB);
} }
} }
void emit_sysflags(int val) void emit_sysflags(int val)
{ {
printf("_SYSFLAGS\t=\t$%04X\t\t; SYSTEM FLAGS\n", val); fprintf(outputfile, "_SYSFLAGS\t=\t$%04X\t\t; SYSTEM FLAGS\n", val);
outflags |= SYSFLAGS; outflags |= SYSFLAGS;
} }
void emit_bytecode_seg(void) void emit_bytecode_seg(void)
@@ -494,57 +494,57 @@ void emit_bytecode_seg(void)
if ((outflags & MODULE) && !(outflags & BYTECODE_SEG)) if ((outflags & MODULE) && !(outflags & BYTECODE_SEG))
{ {
if (lastglobalsize == 0) // Pad a byte if last label is at end of data segment if (lastglobalsize == 0) // Pad a byte if last label is at end of data segment
printf("\t%s\t$00\t\t\t; PAD BYTE\n", DB); fprintf(outputfile, "\t%s\t$00\t\t\t; PAD BYTE\n", DB);
printf("_SUBSEG%c\t\t\t\t; BYTECODE STARTS\n", LBL); fprintf(outputfile, "_SUBSEG%c\t\t\t\t; BYTECODE STARTS\n", LBL);
} }
outflags |= BYTECODE_SEG; outflags |= BYTECODE_SEG;
} }
void emit_comment(char *s) void emit_comment(char *s)
{ {
printf("\t\t\t\t\t; %s\n", s); fprintf(outputfile, "\t\t\t\t\t; %s\n", s);
} }
void emit_asm(char *s) void emit_asm(char *s)
{ {
printf("%s\n", s); fprintf(outputfile, "%s\n", s);
} }
void emit_idlocal(char *name, int value) void emit_idlocal(char *name, int value)
{ {
printf("\t\t\t\t\t; %s -> [%d]\n", name, value); fprintf(outputfile, "\t\t\t\t\t; %s -> [%d]\n", name, value);
} }
void emit_idglobal(int tag, int size, char *name) void emit_idglobal(int tag, int size, char *name)
{ {
lastglobalsize = size; lastglobalsize = size;
if (size == 0) if (size == 0)
printf("_D%03d%c\t\t\t\t\t; %s\n", tag, LBL, name); fprintf(outputfile, "_D%03d%c\t\t\t\t\t; %s\n", tag, LBL, name);
else else
printf("_D%03d%c\t%s\t%d\t\t\t; %s\n", tag, LBL, DS, size, name); fprintf(outputfile, "_D%03d%c\t%s\t%d\t\t\t; %s\n", tag, LBL, DS, size, name);
} }
void emit_idfunc(int tag, int type, char *name, int is_bytecode) void emit_idfunc(int tag, int type, char *name, int is_bytecode)
{ {
if (name) if (name)
printf("%s%c\t\t\t\t\t; %s()\n", tag_string(tag, type), LBL, name); fprintf(outputfile, "%s%c\t\t\t\t\t; %s()\n", tag_string(tag, type), LBL, name);
if (!(outflags & MODULE)) if (!(outflags & MODULE))
{ {
//printf("%s%c\n", name, LBL); //fprintf(outputfile, "%s%c\n", name, LBL);
if (is_bytecode) if (is_bytecode)
printf("\tJSR\tINTERP\n"); fprintf(outputfile, "\tJSR\tINTERP\n");
} }
} }
void emit_lambdafunc(int tag, char *name, int cparams, t_opseq *lambda_seq) void emit_lambdafunc(int tag, char *name, int cparams, t_opseq *lambda_seq)
{ {
emit_idfunc(tag, DEF_TYPE, name, 1); emit_idfunc(tag, DEF_TYPE, name, 1);
if (cparams) if (cparams)
printf("\t%s\t$58,$%02X,$%02X\t\t; ENTER\t%d,%d\n", DB, cparams*2, cparams, cparams*2, cparams); fprintf(outputfile, "\t%s\t$58,$%02X,$%02X\t\t; ENTER\t%d,%d\n", DB, cparams*2, cparams, cparams*2, cparams);
emit_seq(lambda_seq); emit_seq(lambda_seq);
emit_pending_seq(); emit_pending_seq();
if (cparams) if (cparams)
printf("\t%s\t$5A,$%02X\t\t\t; LEAVE\t%d\n", DB, cparams*2, cparams*2); fprintf(outputfile, "\t%s\t$5A,$%02X\t\t\t; LEAVE\t%d\n", DB, cparams*2, cparams*2);
else else
printf("\t%s\t$5C\t\t\t; RET\n", DB); fprintf(outputfile, "\t%s\t$5C\t\t\t; RET\n", DB);
} }
void emit_idconst(char *name, int value) void emit_idconst(char *name, int value)
{ {
printf("\t\t\t\t\t; %s = %d\n", name, value); fprintf(outputfile, "\t\t\t\t\t; %s = %d\n", name, value);
} }
int emit_data(int vartype, int consttype, long constval, int constsize) int emit_data(int vartype, int consttype, long constval, int constsize)
{ {
@@ -553,25 +553,25 @@ int emit_data(int vartype, int consttype, long constval, int constsize)
if (consttype == 0) if (consttype == 0)
{ {
datasize = constsize; datasize = constsize;
printf("\t%s\t$%02X\n", DS, constsize); fprintf(outputfile, "\t%s\t$%02X\n", DS, constsize);
} }
else if (consttype & STRING_TYPE) else if (consttype & STRING_TYPE)
{ {
str = (unsigned char *)constval; str = (unsigned char *)constval;
constsize = *str++; constsize = *str++;
datasize = constsize + 1; datasize = constsize + 1;
printf("\t%s\t$%02X\n", DB, constsize); fprintf(outputfile, "\t%s\t$%02X\n", DB, constsize);
while (constsize-- > 0) while (constsize-- > 0)
{ {
printf("\t%s\t$%02X", DB, *str++); fprintf(outputfile, "\t%s\t$%02X", DB, *str++);
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
{ {
if (constsize-- > 0) if (constsize-- > 0)
printf(",$%02X", *str++); fprintf(outputfile, ",$%02X", *str++);
else else
break; break;
} }
printf("\n"); fprintf(outputfile, "\n");
} }
} }
else if (consttype & ADDR_TYPE) else if (consttype & ADDR_TYPE)
@@ -581,18 +581,18 @@ int emit_data(int vartype, int consttype, long constval, int constsize)
int fixup = fixup_new(constval, consttype, FIXUP_WORD); int fixup = fixup_new(constval, consttype, FIXUP_WORD);
datasize = 2; datasize = 2;
if (consttype & EXTERN_TYPE) if (consttype & EXTERN_TYPE)
printf("_F%03d%c\t%s\t0\t\t\t; %s\n", fixup, LBL, DW, tag_string(constval, consttype)); fprintf(outputfile, "_F%03d%c\t%s\t0\t\t\t; %s\n", fixup, LBL, DW, tag_string(constval, consttype));
else else
printf("_F%03d%c\t%s\t%s\n", fixup, LBL, DW, tag_string(constval, consttype)); fprintf(outputfile, "_F%03d%c\t%s\t%s\n", fixup, LBL, DW, tag_string(constval, consttype));
} }
else else
{ {
int fixup = fixup_new(constval, consttype, FIXUP_BYTE); int fixup = fixup_new(constval, consttype, FIXUP_BYTE);
datasize = 1; datasize = 1;
if (consttype & EXTERN_TYPE) if (consttype & EXTERN_TYPE)
printf("_F%03d%c\t%s\t0\t\t\t; %s\n", fixup, LBL, DB, tag_string(constval, consttype)); fprintf(outputfile, "_F%03d%c\t%s\t0\t\t\t; %s\n", fixup, LBL, DB, tag_string(constval, consttype));
else else
printf("_F%03d%c\t%s\t%s\n", fixup, LBL, DB, tag_string(constval, consttype)); fprintf(outputfile, "_F%03d%c\t%s\t%s\n", fixup, LBL, DB, tag_string(constval, consttype));
} }
} }
else else
@@ -600,12 +600,12 @@ int emit_data(int vartype, int consttype, long constval, int constsize)
if (vartype & WORD_TYPE) if (vartype & WORD_TYPE)
{ {
datasize = 2; datasize = 2;
printf("\t%s\t$%04lX\n", DW, constval & 0xFFFF); fprintf(outputfile, "\t%s\t$%04lX\n", DW, constval & 0xFFFF);
} }
else else
{ {
datasize = 1; datasize = 1;
printf("\t%s\t$%02lX\n", DB, constval & 0xFF); fprintf(outputfile, "\t%s\t$%02lX\n", DB, constval & 0xFF);
} }
} }
return (datasize); return (datasize);
@@ -613,78 +613,78 @@ int emit_data(int vartype, int consttype, long constval, int constsize)
void emit_codetag(int tag) void emit_codetag(int tag)
{ {
emit_pending_seq(); emit_pending_seq();
printf("_B%03d%c\n", tag, LBL); fprintf(outputfile, "_B%03d%c\n", tag, LBL);
} }
void emit_const(int cval) void emit_const(int cval)
{ {
emit_pending_seq(); emit_pending_seq();
if ((cval & 0xFFFF) == 0xFFFF) if ((cval & 0xFFFF) == 0xFFFF)
printf("\t%s\t$20\t\t\t; MINUS ONE\n", DB); fprintf(outputfile, "\t%s\t$20\t\t\t; MINUS ONE\n", DB);
else if ((cval & 0xFFF0) == 0x0000) else if ((cval & 0xFFF0) == 0x0000)
printf("\t%s\t$%02X\t\t\t; CN\t%d\n", DB, cval*2, cval); fprintf(outputfile, "\t%s\t$%02X\t\t\t; CN\t%d\n", DB, cval*2, cval);
else if ((cval & 0xFF00) == 0x0000) else if ((cval & 0xFF00) == 0x0000)
printf("\t%s\t$2A,$%02X\t\t\t; CB\t%d\n", DB, cval, cval); fprintf(outputfile, "\t%s\t$2A,$%02X\t\t\t; CB\t%d\n", DB, cval, cval);
else if ((cval & 0xFF00) == 0xFF00) else if ((cval & 0xFF00) == 0xFF00)
printf("\t%s\t$5E,$%02X\t\t\t; CFFB\t%d\n", DB, cval&0xFF, cval); fprintf(outputfile, "\t%s\t$5E,$%02X\t\t\t; CFFB\t%d\n", DB, cval&0xFF, cval);
else else
printf("\t%s\t$2C,$%02X,$%02X\t\t; CW\t%d\n", DB, cval&0xFF,(cval>>8)&0xFF, cval); fprintf(outputfile, "\t%s\t$2C,$%02X,$%02X\t\t; CW\t%d\n", DB, cval&0xFF,(cval>>8)&0xFF, cval);
} }
void emit_conststr(long conststr) void emit_conststr(long conststr)
{ {
printf("\t%s\t$2E\t\t\t; CS\n", DB); fprintf(outputfile, "\t%s\t$2E\t\t\t; CS\n", DB);
emit_data(0, STRING_TYPE, conststr, 0); emit_data(0, STRING_TYPE, conststr, 0);
} }
void emit_addi(int cval) void emit_addi(int cval)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$38,$%02X\t\t\t; ADDI\t%d\n", DB, cval, cval); fprintf(outputfile, "\t%s\t$38,$%02X\t\t\t; ADDI\t%d\n", DB, cval, cval);
} }
void emit_subi(int cval) void emit_subi(int cval)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$3A,$%02X\t\t\t; SUBI\t%d\n", DB, cval, cval); fprintf(outputfile, "\t%s\t$3A,$%02X\t\t\t; SUBI\t%d\n", DB, cval, cval);
} }
void emit_andi(int cval) void emit_andi(int cval)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$3C,$%02X\t\t\t; ANDI\t%d\n", DB, cval, cval); fprintf(outputfile, "\t%s\t$3C,$%02X\t\t\t; ANDI\t%d\n", DB, cval, cval);
} }
void emit_ori(int cval) void emit_ori(int cval)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$3E,$%02X\t\t\t; ORI\t%d\n", DB, cval, cval); fprintf(outputfile, "\t%s\t$3E,$%02X\t\t\t; ORI\t%d\n", DB, cval, cval);
} }
void emit_lb(void) void emit_lb(void)
{ {
printf("\t%s\t$60\t\t\t; LB\n", DB); fprintf(outputfile, "\t%s\t$60\t\t\t; LB\n", DB);
} }
void emit_lw(void) void emit_lw(void)
{ {
printf("\t%s\t$62\t\t\t; LW\n", DB); fprintf(outputfile, "\t%s\t$62\t\t\t; LW\n", DB);
} }
void emit_llb(int index) void emit_llb(int index)
{ {
printf("\t%s\t$64,$%02X\t\t\t; LLB\t[%d]\n", DB, index, index); fprintf(outputfile, "\t%s\t$64,$%02X\t\t\t; LLB\t[%d]\n", DB, index, index);
} }
void emit_llw(int index) void emit_llw(int index)
{ {
printf("\t%s\t$66,$%02X\t\t\t; LLW\t[%d]\n", DB, index, index); fprintf(outputfile, "\t%s\t$66,$%02X\t\t\t; LLW\t[%d]\n", DB, index, index);
} }
void emit_addlb(int index) void emit_addlb(int index)
{ {
printf("\t%s\t$B0,$%02X\t\t\t; ADDLB\t[%d]\n", DB, index, index); fprintf(outputfile, "\t%s\t$B0,$%02X\t\t\t; ADDLB\t[%d]\n", DB, index, index);
} }
void emit_addlw(int index) void emit_addlw(int index)
{ {
printf("\t%s\t$B2,$%02X\t\t\t; ADDLW\t[%d]\n", DB, index, index); fprintf(outputfile, "\t%s\t$B2,$%02X\t\t\t; ADDLW\t[%d]\n", DB, index, index);
} }
void emit_idxlb(int index) void emit_idxlb(int index)
{ {
printf("\t%s\t$B8,$%02X\t\t\t; IDXLB\t[%d]\n", DB, index, index); fprintf(outputfile, "\t%s\t$B8,$%02X\t\t\t; IDXLB\t[%d]\n", DB, index, index);
} }
void emit_idxlw(int index) void emit_idxlw(int index)
{ {
printf("\t%s\t$BA,$%02X\t\t\t; IDXLW\t[%d]\n", DB, index, index); fprintf(outputfile, "\t%s\t$BA,$%02X\t\t\t; IDXLW\t[%d]\n", DB, index, index);
} }
void emit_lab(int tag, int offset, int type) void emit_lab(int tag, int offset, int type)
{ {
@@ -692,12 +692,12 @@ void emit_lab(int tag, int offset, int type)
{ {
int fixup = fixup_new(tag, type, FIXUP_WORD); int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type); char *taglbl = tag_string(tag, type);
printf("\t%s\t$68\t\t\t; LAB\t%s+%d\n", DB, taglbl, offset); fprintf(outputfile, "\t%s\t$68\t\t\t; LAB\t%s+%d\n", DB, taglbl, offset);
printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset); fprintf(outputfile, "_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset);
} }
else else
{ {
printf("\t%s\t$68,$%02X,$%02X\t\t; LAB\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset); fprintf(outputfile, "\t%s\t$68,$%02X,$%02X\t\t; LAB\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset);
} }
} }
void emit_law(int tag, int offset, int type) void emit_law(int tag, int offset, int type)
@@ -706,12 +706,12 @@ void emit_law(int tag, int offset, int type)
{ {
int fixup = fixup_new(tag, type, FIXUP_WORD); int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type); char *taglbl = tag_string(tag, type);
printf("\t%s\t$6A\t\t\t; LAW\t%s+%d\n", DB, taglbl, offset); fprintf(outputfile, "\t%s\t$6A\t\t\t; LAW\t%s+%d\n", DB, taglbl, offset);
printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset); fprintf(outputfile, "_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset);
} }
else else
{ {
printf("\t%s\t$6A,$%02X,$%02X\t\t; LAW\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset); fprintf(outputfile, "\t%s\t$6A,$%02X,$%02X\t\t; LAW\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset);
} }
} }
void emit_addab(int tag, int offset, int type) void emit_addab(int tag, int offset, int type)
@@ -720,12 +720,12 @@ void emit_addab(int tag, int offset, int type)
{ {
int fixup = fixup_new(tag, type, FIXUP_WORD); int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type); char *taglbl = tag_string(tag, type);
printf("\t%s\t$B4\t\t\t; ADDAB\t%s+%d\n", DB, taglbl, offset); fprintf(outputfile, "\t%s\t$B4\t\t\t; ADDAB\t%s+%d\n", DB, taglbl, offset);
printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset); fprintf(outputfile, "_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset);
} }
else else
{ {
printf("\t%s\t$B4,$%02X,$%02X\t\t; ADDAB\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset); fprintf(outputfile, "\t%s\t$B4,$%02X,$%02X\t\t; ADDAB\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset);
} }
} }
void emit_addaw(int tag, int offset, int type) void emit_addaw(int tag, int offset, int type)
@@ -734,12 +734,12 @@ void emit_addaw(int tag, int offset, int type)
{ {
int fixup = fixup_new(tag, type, FIXUP_WORD); int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type); char *taglbl = tag_string(tag, type);
printf("\t%s\t$B6\t\t\t; ADDAW\t%s+%d\n", DB, taglbl, offset); fprintf(outputfile, "\t%s\t$B6\t\t\t; ADDAW\t%s+%d\n", DB, taglbl, offset);
printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset); fprintf(outputfile, "_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset);
} }
else else
{ {
printf("\t%s\t$B6,$%02X,$%02X\t\t; ADDAW\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset); fprintf(outputfile, "\t%s\t$B6,$%02X,$%02X\t\t; ADDAW\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset);
} }
} }
void emit_idxab(int tag, int offset, int type) void emit_idxab(int tag, int offset, int type)
@@ -748,12 +748,12 @@ void emit_idxab(int tag, int offset, int type)
{ {
int fixup = fixup_new(tag, type, FIXUP_WORD); int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type); char *taglbl = tag_string(tag, type);
printf("\t%s\t$BC\t\t\t; IDXAB\t%s+%d\n", DB, taglbl, offset); fprintf(outputfile, "\t%s\t$BC\t\t\t; IDXAB\t%s+%d\n", DB, taglbl, offset);
printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset); fprintf(outputfile, "_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset);
} }
else else
{ {
printf("\t%s\t$BC,$%02X,$%02X\t\t; IDXAB\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset); fprintf(outputfile, "\t%s\t$BC,$%02X,$%02X\t\t; IDXAB\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset);
} }
} }
void emit_idxaw(int tag, int offset, int type) void emit_idxaw(int tag, int offset, int type)
@@ -762,37 +762,37 @@ void emit_idxaw(int tag, int offset, int type)
{ {
int fixup = fixup_new(tag, type, FIXUP_WORD); int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type); char *taglbl = tag_string(tag, type);
printf("\t%s\t$BE\t\t\t; IDXAW\t%s+%d\n", DB, taglbl, offset); fprintf(outputfile, "\t%s\t$BE\t\t\t; IDXAW\t%s+%d\n", DB, taglbl, offset);
printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset); fprintf(outputfile, "_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset);
} }
else else
{ {
printf("\t%s\t$BE,$%02X,$%02X\t\t; IDXAW\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset); fprintf(outputfile, "\t%s\t$BE,$%02X,$%02X\t\t; IDXAW\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset);
} }
} }
void emit_sb(void) void emit_sb(void)
{ {
printf("\t%s\t$70\t\t\t; SB\n", DB); fprintf(outputfile, "\t%s\t$70\t\t\t; SB\n", DB);
} }
void emit_sw(void) void emit_sw(void)
{ {
printf("\t%s\t$72\t\t\t; SW\n", DB); fprintf(outputfile, "\t%s\t$72\t\t\t; SW\n", DB);
} }
void emit_slb(int index) void emit_slb(int index)
{ {
printf("\t%s\t$74,$%02X\t\t\t; SLB\t[%d]\n", DB, index, index); fprintf(outputfile, "\t%s\t$74,$%02X\t\t\t; SLB\t[%d]\n", DB, index, index);
} }
void emit_slw(int index) void emit_slw(int index)
{ {
printf("\t%s\t$76,$%02X\t\t\t; SLW\t[%d]\n", DB, index, index); fprintf(outputfile, "\t%s\t$76,$%02X\t\t\t; SLW\t[%d]\n", DB, index, index);
} }
void emit_dlb(int index) void emit_dlb(int index)
{ {
printf("\t%s\t$6C,$%02X\t\t\t; DLB\t[%d]\n", DB, index, index); fprintf(outputfile, "\t%s\t$6C,$%02X\t\t\t; DLB\t[%d]\n", DB, index, index);
} }
void emit_dlw(int index) void emit_dlw(int index)
{ {
printf("\t%s\t$6E,$%02X\t\t\t; DLW\t[%d]\n", DB, index, index); fprintf(outputfile, "\t%s\t$6E,$%02X\t\t\t; DLW\t[%d]\n", DB, index, index);
} }
void emit_sab(int tag, int offset, int type) void emit_sab(int tag, int offset, int type)
{ {
@@ -800,12 +800,12 @@ void emit_sab(int tag, int offset, int type)
{ {
int fixup = fixup_new(tag, type, FIXUP_WORD); int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type); char *taglbl = tag_string(tag, type);
printf("\t%s\t$78\t\t\t; SAB\t%s+%d\n", DB, taglbl, offset); fprintf(outputfile, "\t%s\t$78\t\t\t; SAB\t%s+%d\n", DB, taglbl, offset);
printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset); fprintf(outputfile, "_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset);
} }
else else
{ {
printf("\t%s\t$78,$%02X,$%02X\t\t; SAB\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset); fprintf(outputfile, "\t%s\t$78,$%02X,$%02X\t\t; SAB\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset);
} }
} }
void emit_saw(int tag, int offset, int type) void emit_saw(int tag, int offset, int type)
@@ -814,12 +814,12 @@ void emit_saw(int tag, int offset, int type)
{ {
int fixup = fixup_new(tag, type, FIXUP_WORD); int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type); char *taglbl = tag_string(tag, type);
printf("\t%s\t$7A\t\t\t; SAW\t%s+%d\n", DB, taglbl, offset); fprintf(outputfile, "\t%s\t$7A\t\t\t; SAW\t%s+%d\n", DB, taglbl, offset);
printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset); fprintf(outputfile, "_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset);
} }
else else
{ {
printf("\t%s\t$7A,$%02X,$%02X\t\t; SAW\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset); fprintf(outputfile, "\t%s\t$7A,$%02X,$%02X\t\t; SAW\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset);
} }
} }
void emit_dab(int tag, int offset, int type) void emit_dab(int tag, int offset, int type)
@@ -828,11 +828,11 @@ void emit_dab(int tag, int offset, int type)
{ {
int fixup = fixup_new(tag, type, FIXUP_WORD); int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type); char *taglbl = tag_string(tag, type);
printf("\t%s\t$7C\t\t\t; DAB\t%s+%d\n", DB, taglbl, offset); fprintf(outputfile, "\t%s\t$7C\t\t\t; DAB\t%s+%d\n", DB, taglbl, offset);
printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset); fprintf(outputfile, "_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset);
} }
else else
printf("\t%s\t$7C,$%02X,$%02X\t\t; DAB\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset); fprintf(outputfile, "\t%s\t$7C,$%02X,$%02X\t\t; DAB\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset);
} }
void emit_daw(int tag, int offset, int type) void emit_daw(int tag, int offset, int type)
{ {
@@ -840,36 +840,36 @@ void emit_daw(int tag, int offset, int type)
{ {
int fixup = fixup_new(tag, type, FIXUP_WORD); int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type); char *taglbl = tag_string(tag, type);
printf("\t%s\t$7E\t\t\t; DAW\t%s+%d\n", DB, taglbl, offset); fprintf(outputfile, "\t%s\t$7E\t\t\t; DAW\t%s+%d\n", DB, taglbl, offset);
printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset); fprintf(outputfile, "_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset);
} }
else else
printf("\t%s\t$7E,$%02X,$%02X\t\t; DAW\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset); fprintf(outputfile, "\t%s\t$7E,$%02X,$%02X\t\t; DAW\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset);
} }
void emit_localaddr(int index) void emit_localaddr(int index)
{ {
printf("\t%s\t$28,$%02X\t\t\t; LLA\t[%d]\n", DB, index, index); fprintf(outputfile, "\t%s\t$28,$%02X\t\t\t; LLA\t[%d]\n", DB, index, index);
} }
void emit_globaladdr(int tag, int offset, int type) void emit_globaladdr(int tag, int offset, int type)
{ {
int fixup = fixup_new(tag, type, FIXUP_WORD); int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type); char *taglbl = tag_string(tag, type);
printf("\t%s\t$26\t\t\t; LA\t%s+%d\n", DB, taglbl, offset); fprintf(outputfile, "\t%s\t$26\t\t\t; LA\t%s+%d\n", DB, taglbl, offset);
printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset); fprintf(outputfile, "_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset);
} }
void emit_indexbyte(void) void emit_indexbyte(void)
{ {
printf("\t%s\t$82\t\t\t; IDXB\n", DB); fprintf(outputfile, "\t%s\t$82\t\t\t; IDXB\n", DB);
} }
void emit_indexword(void) void emit_indexword(void)
{ {
printf("\t%s\t$9E\t\t\t; IDXW\n", DB); fprintf(outputfile, "\t%s\t$9E\t\t\t; IDXW\n", DB);
} }
void emit_select(int tag) void emit_select(int tag)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$52\t\t\t; SEL\n", DB); fprintf(outputfile, "\t%s\t$52\t\t\t; SEL\n", DB);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_caseblock(int casecnt, int *caseof, int *casetag) void emit_caseblock(int casecnt, int *caseof, int *casetag)
{ {
@@ -878,144 +878,144 @@ void emit_caseblock(int casecnt, int *caseof, int *casetag)
if (casecnt < 1 || casecnt > 256) if (casecnt < 1 || casecnt > 256)
parse_error("Switch count under/overflow\n"); parse_error("Switch count under/overflow\n");
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$%02X\t\t\t; CASEBLOCK\n", DB, casecnt & 0xFF); fprintf(outputfile, "\t%s\t$%02X\t\t\t; CASEBLOCK\n", DB, casecnt & 0xFF);
for (i = 0; i < casecnt; i++) for (i = 0; i < casecnt; i++)
{ {
printf("\t%s\t$%04X\n", DW, caseof[i] & 0xFFFF); fprintf(outputfile, "\t%s\t$%04X\n", DW, caseof[i] & 0xFFFF);
printf("\t%s\t_B%03d-*\n", DW, casetag[i]); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, casetag[i]);
} }
} }
void emit_breq(int tag) void emit_breq(int tag)
{ {
printf("\t%s\t$22\t\t\t; BREQ\t_B%03d\n", DB, tag); fprintf(outputfile, "\t%s\t$22\t\t\t; BREQ\t_B%03d\n", DB, tag);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_brne(int tag) void emit_brne(int tag)
{ {
printf("\t%s\t$24\t\t\t; BRNE\t_B%03d\n", DB, tag); fprintf(outputfile, "\t%s\t$24\t\t\t; BRNE\t_B%03d\n", DB, tag);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_brfls(int tag) void emit_brfls(int tag)
{ {
printf("\t%s\t$4C\t\t\t; BRFLS\t_B%03d\n", DB, tag); fprintf(outputfile, "\t%s\t$4C\t\t\t; BRFLS\t_B%03d\n", DB, tag);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_brtru(int tag) void emit_brtru(int tag)
{ {
printf("\t%s\t$4E\t\t\t; BRTRU\t_B%03d\n", DB, tag); fprintf(outputfile, "\t%s\t$4E\t\t\t; BRTRU\t_B%03d\n", DB, tag);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_brnch(int tag) void emit_brnch(int tag)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$50\t\t\t; BRNCH\t_B%03d\n", DB, tag); fprintf(outputfile, "\t%s\t$50\t\t\t; BRNCH\t_B%03d\n", DB, tag);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_brand(int tag) void emit_brand(int tag)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$AC\t\t\t; BRAND\t_B%03d\n", DB, tag); fprintf(outputfile, "\t%s\t$AC\t\t\t; BRAND\t_B%03d\n", DB, tag);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_bror(int tag) void emit_bror(int tag)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$AE\t\t\t; BROR\t_B%03d\n", DB, tag); fprintf(outputfile, "\t%s\t$AE\t\t\t; BROR\t_B%03d\n", DB, tag);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_brgt(int tag) void emit_brgt(int tag)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$A0\t\t\t; BRGT\t_B%03d\n", DB, tag); fprintf(outputfile, "\t%s\t$A0\t\t\t; BRGT\t_B%03d\n", DB, tag);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_brlt(int tag) void emit_brlt(int tag)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$A2\t\t\t; BRLT\t_B%03d\n", DB, tag); fprintf(outputfile, "\t%s\t$A2\t\t\t; BRLT\t_B%03d\n", DB, tag);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_incbrle(int tag) void emit_incbrle(int tag)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$A4\t\t\t; INCBRLE\t_B%03d\n", DB, tag); fprintf(outputfile, "\t%s\t$A4\t\t\t; INCBRLE\t_B%03d\n", DB, tag);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_addbrle(int tag) void emit_addbrle(int tag)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$A6\t\t\t; ADDBRLE\t_B%03d\n", DB, tag); fprintf(outputfile, "\t%s\t$A6\t\t\t; ADDBRLE\t_B%03d\n", DB, tag);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_decbrge(int tag) void emit_decbrge(int tag)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$A8\t\t\t; DECBRGE\t_B%03d\n", DB, tag); fprintf(outputfile, "\t%s\t$A8\t\t\t; DECBRGE\t_B%03d\n", DB, tag);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_subbrge(int tag) void emit_subbrge(int tag)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$AA\t\t\t; SUBBRGE\t_B%03d\n", DB, tag); fprintf(outputfile, "\t%s\t$AA\t\t\t; SUBBRGE\t_B%03d\n", DB, tag);
printf("\t%s\t_B%03d-*\n", DW, tag); fprintf(outputfile, "\t%s\t_B%03d-*\n", DW, tag);
} }
void emit_call(int tag, int type) void emit_call(int tag, int type)
{ {
if (type == CONST_TYPE) if (type == CONST_TYPE)
{ {
printf("\t%s\t$54\t\t\t; CALL\t%i\n", DB, tag); fprintf(outputfile, "\t%s\t$54\t\t\t; CALL\t%i\n", DB, tag);
printf("\t%s\t%i\t\t\n", DW, tag); fprintf(outputfile, "\t%s\t%i\t\t\n", DW, tag);
} }
else else
{ {
int fixup = fixup_new(tag, type, FIXUP_WORD); int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type); char *taglbl = tag_string(tag, type);
printf("\t%s\t$54\t\t\t; CALL\t%s\n", DB, taglbl); fprintf(outputfile, "\t%s\t$54\t\t\t; CALL\t%s\n", DB, taglbl);
printf("_F%03d%c\t%s\t%s\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl); fprintf(outputfile, "_F%03d%c\t%s\t%s\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl);
} }
} }
void emit_ical(void) void emit_ical(void)
{ {
printf("\t%s\t$56\t\t\t; ICAL\n", DB); fprintf(outputfile, "\t%s\t$56\t\t\t; ICAL\n", DB);
} }
void emit_leave(void) void emit_leave(void)
{ {
emit_pending_seq(); emit_pending_seq();
if (localsize) if (localsize)
printf("\t%s\t$5A,$%02X\t\t\t; LEAVE\t%d\n", DB, localsize, localsize); fprintf(outputfile, "\t%s\t$5A,$%02X\t\t\t; LEAVE\t%d\n", DB, localsize, localsize);
else else
printf("\t%s\t$5C\t\t\t; RET\n", DB); fprintf(outputfile, "\t%s\t$5C\t\t\t; RET\n", DB);
} }
void emit_ret(void) void emit_ret(void)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$5C\t\t\t; RET\n", DB); fprintf(outputfile, "\t%s\t$5C\t\t\t; RET\n", DB);
} }
void emit_enter(int cparams) void emit_enter(int cparams)
{ {
if (localsize) if (localsize)
printf("\t%s\t$58,$%02X,$%02X\t\t; ENTER\t%d,%d\n", DB, localsize, cparams, localsize, cparams); fprintf(outputfile, "\t%s\t$58,$%02X,$%02X\t\t; ENTER\t%d,%d\n", DB, localsize, cparams, localsize, cparams);
} }
void emit_start(void) void emit_start(void)
{ {
printf("_INIT%c\n", LBL); fprintf(outputfile, "_INIT%c\n", LBL);
outflags |= INIT; outflags |= INIT;
defs++; defs++;
} }
void emit_drop(void) void emit_drop(void)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$30\t\t\t; DROP \n", DB); fprintf(outputfile, "\t%s\t$30\t\t\t; DROP \n", DB);
} }
void emit_drop2(void) void emit_drop2(void)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$32\t\t\t; DROP2\n", DB); fprintf(outputfile, "\t%s\t$32\t\t\t; DROP2\n", DB);
} }
void emit_dup(void) void emit_dup(void)
{ {
emit_pending_seq(); emit_pending_seq();
printf("\t%s\t$34\t\t\t; DUP\n", DB); fprintf(outputfile, "\t%s\t$34\t\t\t; DUP\n", DB);
} }
int emit_unaryop(t_token op) int emit_unaryop(t_token op)
{ {
@@ -1023,19 +1023,19 @@ int emit_unaryop(t_token op)
switch (op) switch (op)
{ {
case NEG_TOKEN: case NEG_TOKEN:
printf("\t%s\t$90\t\t\t; NEG\n", DB); fprintf(outputfile, "\t%s\t$90\t\t\t; NEG\n", DB);
break; break;
case COMP_TOKEN: case COMP_TOKEN:
printf("\t%s\t$92\t\t\t; COMP\n", DB); fprintf(outputfile, "\t%s\t$92\t\t\t; COMP\n", DB);
break; break;
case LOGIC_NOT_TOKEN: case LOGIC_NOT_TOKEN:
printf("\t%s\t$80\t\t\t; NOT\n", DB); fprintf(outputfile, "\t%s\t$80\t\t\t; NOT\n", DB);
break; break;
case INC_TOKEN: case INC_TOKEN:
printf("\t%s\t$8C\t\t\t; INCR\n", DB); fprintf(outputfile, "\t%s\t$8C\t\t\t; INCR\n", DB);
break; break;
case DEC_TOKEN: case DEC_TOKEN:
printf("\t%s\t$8E\t\t\t; DECR\n", DB); fprintf(outputfile, "\t%s\t$8E\t\t\t; DECR\n", DB);
break; break;
case BPTR_TOKEN: case BPTR_TOKEN:
emit_lb(); emit_lb();
@@ -1055,52 +1055,52 @@ int emit_op(t_token op)
switch (op) switch (op)
{ {
case MUL_TOKEN: case MUL_TOKEN:
printf("\t%s\t$86\t\t\t; MUL\n", DB); fprintf(outputfile, "\t%s\t$86\t\t\t; MUL\n", DB);
break; break;
case DIV_TOKEN: case DIV_TOKEN:
printf("\t%s\t$88\t\t\t; DIV\n", DB); fprintf(outputfile, "\t%s\t$88\t\t\t; DIV\n", DB);
break; break;
case MOD_TOKEN: case MOD_TOKEN:
printf("\t%s\t$8A\t\t\t; MOD\n", DB); fprintf(outputfile, "\t%s\t$8A\t\t\t; MOD\n", DB);
break; break;
case ADD_TOKEN: case ADD_TOKEN:
printf("\t%s\t$82\t\t\t; ADD \n", DB); fprintf(outputfile, "\t%s\t$82\t\t\t; ADD \n", DB);
break; break;
case SUB_TOKEN: case SUB_TOKEN:
printf("\t%s\t$84\t\t\t; SUB \n", DB); fprintf(outputfile, "\t%s\t$84\t\t\t; SUB \n", DB);
break; break;
case SHL_TOKEN: case SHL_TOKEN:
printf("\t%s\t$9A\t\t\t; SHL\n", DB); fprintf(outputfile, "\t%s\t$9A\t\t\t; SHL\n", DB);
break; break;
case SHR_TOKEN: case SHR_TOKEN:
printf("\t%s\t$9C\t\t\t; SHR\n", DB); fprintf(outputfile, "\t%s\t$9C\t\t\t; SHR\n", DB);
break; break;
case AND_TOKEN: case AND_TOKEN:
printf("\t%s\t$94\t\t\t; AND \n", DB); fprintf(outputfile, "\t%s\t$94\t\t\t; AND \n", DB);
break; break;
case OR_TOKEN: case OR_TOKEN:
printf("\t%s\t$96\t\t\t; OR \n", DB); fprintf(outputfile, "\t%s\t$96\t\t\t; OR \n", DB);
break; break;
case EOR_TOKEN: case EOR_TOKEN:
printf("\t%s\t$98\t\t\t; XOR\n", DB); fprintf(outputfile, "\t%s\t$98\t\t\t; XOR\n", DB);
break; break;
case EQ_TOKEN: case EQ_TOKEN:
printf("\t%s\t$40\t\t\t; ISEQ\n", DB); fprintf(outputfile, "\t%s\t$40\t\t\t; ISEQ\n", DB);
break; break;
case NE_TOKEN: case NE_TOKEN:
printf("\t%s\t$42\t\t\t; ISNE\n", DB); fprintf(outputfile, "\t%s\t$42\t\t\t; ISNE\n", DB);
break; break;
case GE_TOKEN: case GE_TOKEN:
printf("\t%s\t$48\t\t\t; ISGE\n", DB); fprintf(outputfile, "\t%s\t$48\t\t\t; ISGE\n", DB);
break; break;
case LT_TOKEN: case LT_TOKEN:
printf("\t%s\t$46\t\t\t; ISLT\n", DB); fprintf(outputfile, "\t%s\t$46\t\t\t; ISLT\n", DB);
break; break;
case GT_TOKEN: case GT_TOKEN:
printf("\t%s\t$44\t\t\t; ISGT\n", DB); fprintf(outputfile, "\t%s\t$44\t\t\t; ISGT\n", DB);
break; break;
case LE_TOKEN: case LE_TOKEN:
printf("\t%s\t$4A\t\t\t; ISLE\n", DB); fprintf(outputfile, "\t%s\t$4A\t\t\t; ISLE\n", DB);
break; break;
case COMMA_TOKEN: case COMMA_TOKEN:
break; break;
@@ -2040,7 +2040,7 @@ int emit_pending_seq()
emit_brlt(op->tag); emit_brlt(op->tag);
break; break;
case CODETAG_CODE: case CODETAG_CODE:
printf("_B%03d%c\n", op->tag, LBL); fprintf(outputfile, "_B%03d%c\n", op->tag, LBL);
break; break;
case NOP_CODE: case NOP_CODE:
break; break;

View File

@@ -1615,7 +1615,7 @@ def cmdmode#0
word cmdptr, line word cmdptr, line
clrscrn clrscrn
puts("PLASMA Editor, Version 2.0 ALPHA2\n") puts("PLASMA Editor, Version 2.0 BETA\n")
while not exit while not exit
puts(@filename) puts(@filename)
cmdptr = gets($BA) cmdptr = gets($BA)

View File

@@ -9,8 +9,6 @@ char *statement, *tokenstr, *scanpos = "", *strpos = "";
t_token scantoken = EOL_TOKEN, prevtoken; t_token scantoken = EOL_TOKEN, prevtoken;
int tokenlen; int tokenlen;
long constval; long constval;
FILE* inputfile;
char *filename;
int lineno = 0; int lineno = 0;
FILE* outer_inputfile = NULL; FILE* outer_inputfile = NULL;
char* outer_filename; char* outer_filename;
@@ -448,14 +446,6 @@ int next_line(void)
t_token token; t_token token;
char* new_filename; char* new_filename;
strpos = conststr; strpos = conststr;
if (inputfile == NULL)
{
/*
* First-time init
*/
inputfile = stdin;
filename = "<stdin>";
}
if (*scanpos == ';') if (*scanpos == ';')
{ {
statement = ++scanpos; statement = ++scanpos;
@@ -500,7 +490,7 @@ int next_line(void)
inputline[len-1] = '\0'; inputline[len-1] = '\0';
lineno++; lineno++;
scantoken = EOL_TOKEN; scantoken = EOL_TOKEN;
printf("; %s: %04d: %s\n", filename, lineno, inputline); fprintf(outputfile, "; %s: %04d: %s\n", filename, lineno, inputline);
} }
token = scan(); token = scan();
/* /*

View File

@@ -1,11 +1,13 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h>
#include "plasm.h" #include "plasm.h"
#define LVALUE 0 #define LVALUE 0
#define RVALUE 1 #define RVALUE 1
#define MAX_LAMBDA 64 #define MAX_LAMBDA 64
int id_match(char *name, int len, char *id);
int parse_mods(void); int parse_mods(void);
int infunc = 0, break_tag = 0, cont_tag = 0, stack_loop = 0; int infunc = 0, break_tag = 0, cont_tag = 0, stack_loop = 0;
@@ -802,7 +804,8 @@ t_opseq *parse_expr(t_opseq *codeseq, int *stackdepth)
codeseq = gen_codetag(codeseq, tag_endtri); codeseq = gen_codetag(codeseq, tag_endtri);
} }
return (codeseq); return (codeseq);
}t_opseq *parse_set(t_opseq *codeseq) }
t_opseq *parse_set(t_opseq *codeseq)
{ {
char *setptr = tokenstr; char *setptr = tokenstr;
int lparms = 0, rparms = 0; int lparms = 0, rparms = 0;
@@ -1221,7 +1224,7 @@ int parse_stmnt(void)
} }
return (scan() == EOL_TOKEN); return (scan() == EOL_TOKEN);
} }
int parse_var(int type, long basesize) int parse_var(int type, long basesize, int ignore_var)
{ {
char *idstr; char *idstr;
long constval; long constval;
@@ -1267,7 +1270,7 @@ int parse_var(int type, long basesize)
else else
parse_error("Bad variable initializer"); parse_error("Bad variable initializer");
} }
else else if (!ignore_var)
{ {
if (idlen) if (idlen)
id_add(idstr, idlen, type, size); id_add(idstr, idlen, type, size);
@@ -1341,7 +1344,7 @@ int parse_struc(void)
scan(); scan();
return (1); return (1);
} }
int parse_vars(int type) int parse_vars(int type, int ignore_vars)
{ {
long value; long value;
int idlen, size, cfnparms, emit = 0; int idlen, size, cfnparms, emit = 0;
@@ -1358,6 +1361,8 @@ int parse_vars(int type)
emit_sysflags(value); emit_sysflags(value);
break; break;
case CONST_TOKEN: case CONST_TOKEN:
if (type & LOCAL_TYPE)
parse_error("Cannot define local constant");
if (scan() != ID_TOKEN) if (scan() != ID_TOKEN)
parse_error("Missing variable"); parse_error("Missing variable");
idstr = tokenstr; idstr = tokenstr;
@@ -1406,7 +1411,7 @@ int parse_vars(int type)
scan_rewind(tokenstr); scan_rewind(tokenstr);
if (type & WORD_TYPE) if (type & WORD_TYPE)
cfnvals *= 2; cfnvals *= 2;
do parse_var(type, cfnvals); while (scantoken == COMMA_TOKEN); do parse_var(type, cfnvals, ignore_vars); while (scantoken == COMMA_TOKEN);
emit = type == GLOBAL_TYPE; emit = type == GLOBAL_TYPE;
break; break;
case PREDEF_TOKEN: case PREDEF_TOKEN:
@@ -1463,13 +1468,18 @@ int parse_vars(int type)
} }
int parse_mods(void) int parse_mods(void)
{ {
int i, ignore_emit;
if (scantoken == IMPORT_TOKEN) if (scantoken == IMPORT_TOKEN)
{ {
if (scan() != ID_TOKEN) if (scan() != ID_TOKEN)
parse_error("Bad import definition"); parse_error("Bad import definition");
for (i = 0; i < tokenlen; i++)
tokenstr[i] = toupper(tokenstr[i]);
if (!(ignore_emit = id_match(tokenstr, tokenlen, modfile)))
emit_moddep(tokenstr, tokenlen); emit_moddep(tokenstr, tokenlen);
scan(); scan();
while (parse_vars(EXTERN_TYPE)) next_line(); while (parse_vars(EXTERN_TYPE, ignore_emit)) next_line();
if (scantoken != END_TOKEN) if (scantoken != END_TOKEN)
parse_error("Missing END"); parse_error("Missing END");
scan(); scan();
@@ -1549,7 +1559,7 @@ int parse_defs(void)
{ {
case CONST_TOKEN: case CONST_TOKEN:
case STRUC_TOKEN: case STRUC_TOKEN:
return parse_vars(GLOBAL_TYPE); return parse_vars(GLOBAL_TYPE, FALSE);
case EXPORT_TOKEN: case EXPORT_TOKEN:
if (scan() != DEF_TOKEN && scantoken != ASM_TOKEN) if (scan() != DEF_TOKEN && scantoken != ASM_TOKEN)
parse_error("Bad export definition"); parse_error("Bad export definition");
@@ -1617,7 +1627,7 @@ int parse_defs(void)
/* /*
* Parse local vars * Parse local vars
*/ */
while (parse_vars(LOCAL_TYPE)) next_line(); while (parse_vars(LOCAL_TYPE, FALSE)) next_line();
emit_enter(cfnparms); emit_enter(cfnparms);
prevstmnt = 0; prevstmnt = 0;
while (parse_stmnt()) next_line(); while (parse_stmnt()) next_line();
@@ -1714,7 +1724,7 @@ int parse_module(void)
if (next_line()) if (next_line())
{ {
while (parse_mods()) next_line(); while (parse_mods()) next_line();
while (parse_vars(GLOBAL_TYPE)) next_line(); while (parse_vars(GLOBAL_TYPE, FALSE)) next_line();
while (parse_defs()) next_line(); while (parse_defs()) next_line();
emit_bytecode_seg(); emit_bytecode_seg();
emit_start(); emit_start();

View File

@@ -1 +1,2 @@
int id_match(char *name, int len, char *id);
int parse_module(void); int parse_module(void);

View File

@@ -967,7 +967,7 @@ def parse_stmnt
wend wend
return scan == EOL_TKN return scan == EOL_TKN
end end
def parse_var(type, basesize)#0 def parse_var(type, basesize, ignore_var)#0
byte consttype, constsize, idlen byte consttype, constsize, idlen
word idptr, constval, arraysize, size word idptr, constval, arraysize, size
@@ -995,7 +995,7 @@ def parse_var(type, basesize)#0
arraysize = arraysize + emit_data(type, consttype, constval, constsize) arraysize = arraysize + emit_data(type, consttype, constval, constsize)
loop loop
size_iddata(PTR_TYPE, size, arraysize) size_iddata(PTR_TYPE, size, arraysize)
else elsif not ignore_var
if idlen if idlen
if infunc if infunc
new_idlocal(idptr, idlen, type, size) new_idlocal(idptr, idlen, type, size)
@@ -1066,7 +1066,7 @@ def parse_struc#0
if token <> END_TKN; exit_err(ERR_MISS|ERR_CLOSE|ERR_STATE); fin if token <> END_TKN; exit_err(ERR_MISS|ERR_CLOSE|ERR_STATE); fin
scan scan
end end
def parse_vars(type) def parse_vars(type, ignore_vars)
byte idlen, cfnparms, cfnvals byte idlen, cfnparms, cfnvals
word size, value, idptr word size, value, idptr
@@ -1076,6 +1076,7 @@ def parse_vars(type)
modsysflags, drop, drop = parse_constexpr modsysflags, drop, drop = parse_constexpr
break break
is CONST_TKN is CONST_TKN
if type & LOCAL_TYPE; exit_err(ERR_INVAL|ERR_GLOBAL|ERR_INIT); fin
if scan <> ID_TKN; exit_err(ERR_INVAL|ERR_CONST); fin if scan <> ID_TKN; exit_err(ERR_INVAL|ERR_CONST); fin
idptr = tknptr idptr = tknptr
idlen = tknlen idlen = tknlen
@@ -1107,7 +1108,7 @@ def parse_vars(type)
rewind(tknptr) rewind(tknptr)
fin fin
if type & WORD_TYPE; size = size * 2; fin if type & WORD_TYPE; size = size * 2; fin
repeat; parse_var(type, size); until token <> COMMA_TKN repeat; parse_var(type, size, ignore_vars); until token <> COMMA_TKN
break break
is PREDEF_TKN is PREDEF_TKN
repeat repeat
@@ -1149,11 +1150,23 @@ def parse_vars(type)
return TRUE return TRUE
end end
def parse_mods def parse_mods
byte i, ignore_emit
if token == IMPORT_TKN if token == IMPORT_TKN
if scan <> ID_TKN; exit_err(ERR_MISS|ERR_ID); fin if scan <> ID_TKN; exit_err(ERR_MISS|ERR_ID); fin
if tknlen == modfile
ignore_emit = TRUE
for i = 1 to tknlen
if toupper(tknptr->[i - 1]) <> modfile[i]; ignore_emit = FALSE; break; fin
next
else
ignore_emit = FALSE
fin
if not ignore_emit
new_moddep(tknptr, tknlen) new_moddep(tknptr, tknlen)
fin
scan scan
while parse_vars(EXTERN_TYPE); nextln; loop while parse_vars(EXTERN_TYPE, ignore_emit); nextln; loop
if token <> END_TKN; exit_err(ERR_MISS|ERR_CLOSE|ERR_STATE); fin if token <> END_TKN; exit_err(ERR_MISS|ERR_CLOSE|ERR_STATE); fin
scan scan
fin fin
@@ -1228,7 +1241,7 @@ def parse_defs
when token when token
is CONST_TKN is CONST_TKN
is STRUC_TKN is STRUC_TKN
return parse_vars(GLOBAL_TYPE) return parse_vars(GLOBAL_TYPE, FALSE)
is EXPORT_TKN is EXPORT_TKN
if scan <> DEF_TKN; exit_err(ERR_INVAL|ERR_STATE); fin if scan <> DEF_TKN; exit_err(ERR_INVAL|ERR_STATE); fin
type = type | EXPORT_TYPE type = type | EXPORT_TYPE
@@ -1273,7 +1286,7 @@ def parse_defs
defcodeptr = codeptr defcodeptr = codeptr
emit_tag(func_tag) emit_tag(func_tag)
new_dfd(func_tag) new_dfd(func_tag)
while parse_vars(LOCAL_TYPE); nextln; loop while parse_vars(LOCAL_TYPE, FALSE); nextln; loop
emit_enter(cfnparms) emit_enter(cfnparms)
prevstmnt = 0 prevstmnt = 0
while parse_stmnt; nextln; loop while parse_stmnt; nextln; loop
@@ -1299,18 +1312,19 @@ end
def parse_module#0 def parse_module#0
init_idglobal init_idglobal
init_idlocal init_idlocal
puts("Data+Code buffer size = "); puti(codebufsz); putln puts("Data+Code buffer size = "); puti(codebufsz); putln; putln
puts(@modfile); putln
if nextln if nextln
// //
// Compile module // Compile module
// //
puts("\nDATA:"); puts("DATA:");
while parse_mods; nextln; loop while parse_mods; nextln; loop
while parse_vars(GLOBAL_TYPE); nextln; loop while parse_vars(GLOBAL_TYPE, FALSE); nextln; loop
emit_codeseg emit_codeseg
puti(codeptr - codebuff); puts(@bytesln) puti(codeptr - codebuff); puts(@bytesln)
while parse_defs; nextln; loop while parse_defs; nextln; loop
puts("INIT:") puts("INIT:");
entrypoint = codeptr entrypoint = codeptr
prevstmnt = 0 prevstmnt = 0
init_idlocal init_idlocal

View File

@@ -1,11 +1,17 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <ctype.h>
#include "plasm.h" #include "plasm.h"
int outflags = 0; int outflags = 0;
FILE *inputfile = NULL, *outputfile;
char *filename, asmfile[128], modfile[17];
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int j, i, flags = 0; int k, j, i, flags = 0;
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
{ {
if (argv[i][0] == '-') if (argv[i][0] == '-')
@@ -29,14 +35,72 @@ int main(int argc, char **argv)
break; break;
case 'W': case 'W':
outflags |= WARNINGS; outflags |= WARNINGS;
break;
case 'S':
outflags |= STREAM;
break;
} }
} }
} }
else
{
if (inputfile == NULL)
{
filename = argv[i];
inputfile = fopen(filename, "r");
if (!inputfile)
{
printf("Error opening input file: %s\n", filename);
exit(1);
}
strcpy(asmfile, filename);
j = strlen(asmfile);
while (j && asmfile[j] != '.')
{
asmfile[j] = '\0';
j--;
}
asmfile[j+1] = 'a';
while (j && asmfile[j-1] != '/')
j--;
k = 1;
while (asmfile[j] != '.')
modfile[k++] = toupper(asmfile[j++]);
modfile[k] = '\0';
modfile[0] = k - 1;
if (outflags & STREAM)
{
strcpy(asmfile, "STDOUT");
outputfile = stdout;
}
else
{
outputfile = fopen(asmfile, "w");
if (!outputfile)
{
printf("Error opening output file %s\n", asmfile);
exit(1);
}
}
}
else
{
printf("Too many input files\n");
exit(1);
}
}
}
if (inputfile == NULL)
{
printf("Usage: %s [-AMONWS] <inputfile>\n", argv[0]);
return (0);
} }
emit_flags(outflags); emit_flags(outflags);
if (parse_module()) if (parse_module())
{ {
fprintf(stderr, "Compilation complete.\n"); fprintf(stderr, "Compilation complete.\n");
} }
fclose(inputfile);
fclose(outputfile);
return (0); return (0);
} }

View File

@@ -9,7 +9,12 @@
#define SYSFLAGS (1<<5) #define SYSFLAGS (1<<5)
#define WARNINGS (1<<6) #define WARNINGS (1<<6)
#define NO_COMBINE (1<<7) #define NO_COMBINE (1<<7)
#define STREAM (1<<8)
#define FALSE 0
#define TRUE (!FALSE)
extern int outflags; extern int outflags;
extern FILE *inputfile, *outputfile;
extern char *filename, modfile[17];
#include "tokens.h" #include "tokens.h"
#include "lex.h" #include "lex.h"
#include "symbols.h" #include "symbols.h"

View File

@@ -276,7 +276,7 @@ byte outflags
// ProDOS/SOS file references // ProDOS/SOS file references
// //
byte refnum, srcref, incref byte refnum, srcref, incref
byte[32] srcfile, incfile, relfile byte[32] srcfile, incfile, relfile, modfile
word parsefile // Pointer to current file word parsefile // Pointer to current file
word srcline // Saved source line number word srcline // Saved source line number
// //
@@ -508,7 +508,7 @@ include "toolsrc/parse.pla"
// //
// Look at command line arguments and compile module // Look at command line arguments and compile module
// //
puts("PLASMA Compiler, Version 2.0 ALPHA2\n") puts("PLASMA Compiler, Version 2.0 BETA\n")
arg = argNext(argFirst) arg = argNext(argFirst)
if ^arg and ^(arg + 1) == '-' if ^arg and ^(arg + 1) == '-'
opt = arg + 2 opt = arg + 2
@@ -560,6 +560,15 @@ if ^arg
// //
strcpy(@relfile, "A.OUT") strcpy(@relfile, "A.OUT")
fin fin
modfile = 0
for srcref = 1 to relfile
if relfile[srcref] == '/'
modfile = 0
else
modfile++
modfile[modfile] = toupper(relfile[srcref])
fin
next
fin fin
fin fin
if srcfile and relfile if srcfile and relfile

View File

@@ -369,7 +369,7 @@ def volumes#0
next next
end end
puts("TFTP Server Version 2.0 ALPHA1\n") puts("TFTP Server,Version 2.0\n")
if !iNet:initIP() if !iNet:initIP()
return -1 return -1
fin fin

View File

@@ -52,7 +52,7 @@ byte perr, refauto
// String pool. // String pool.
// //
byte autorun[] = "AUTORUN" byte autorun[] = "AUTORUN"
byte verstr[] = "\nPLASMA ALPHA2" byte verstr[] = "\nPLASMA BETA"
byte freestr[] = "MEM FREE:$" byte freestr[] = "MEM FREE:$"
byte errorstr[] = "ERR:$" byte errorstr[] = "ERR:$"
byte prompt[] = "PLASMA" byte prompt[] = "PLASMA"

View File

@@ -1377,7 +1377,7 @@ heap = @lastdef
// //
// Print PLASMA version // Print PLASMA version
// //
prstr("PLASMA 2.0 ALPHA2 64K\n")//; prbyte(version.1); cout('.'); prbyte(version.0); crout prstr("PLASMA 2.0 BETA 64K\n")//; prbyte(version.1); cout('.'); prbyte(version.0); crout
// //
// Init symbol table. // Init symbol table.
// //

View File

@@ -1454,7 +1454,7 @@ heap = @lastdef
// //
// Print PLASMA version // Print PLASMA version
// //
prstr("PLASMA 2.0 ALPHA2 128K\n")//; prbyte(version.1); cout('.'); prbyte(version.0); crout prstr("PLASMA 2.0 BETA 128K\n")//; prbyte(version.1); cout('.'); prbyte(version.0); crout
// //
// Init symbol table. // Init symbol table.
// //

View File

@@ -1263,7 +1263,7 @@ cmdlnptr = @cmdln
// Print PLASMA version // Print PLASMA version
// //
init_cons init_cons
prstr("PLASMA 2.0 ALPHA2\n")//; putb(version.1); putc('.'); putb(version.0); putln prstr("PLASMA 2.0 BETA\n")//; putb(version.1); putc('.'); putb(version.0); putln
prstr("MEM:$"); prword(availheap); crout prstr("MEM:$"); prword(availheap); crout
// //
// Exec command line parser // Exec command line parser

View File

@@ -1286,7 +1286,7 @@ cmdlnptr = @cmdln
// Print PLASMA version // Print PLASMA version
// //
init_cons init_cons
prstr("PLASMA 2.0 ALPHA2 JITC\n")//; putb(version.1); putc('.'); putb(version.0); putln prstr("PLASMA 2.0 BETA JITC\n")//; putb(version.1); putc('.'); putb(version.0); putln
prstr("MEM:$"); prword(availheap); crout prstr("MEM:$"); prword(availheap); crout
// //
// Exec command line parser // Exec command line parser