1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-09 13:33:26 +00:00

Fix predef paramaters, multiple per line, and asm defs with parameters

This commit is contained in:
Dave Schmenk 2017-06-07 19:26:03 -07:00
parent 92535477ff
commit 0b95baaefc
4 changed files with 54 additions and 47 deletions

Binary file not shown.

View File

@ -140,7 +140,7 @@ $(MON): samplesrc/mon.pla $(PLVM02) $(PLASM)
acme --setpc 4094 -o $(MON) samplesrc/mon.a
$(ROD): samplesrc/rod.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMO < samplesrc/rod.pla > samplesrc/rod.a
./$(PLASM) -AMOW < samplesrc/rod.pla > samplesrc/rod.a
acme --setpc 4094 -o $(ROD) samplesrc/rod.a
$(SIEVE): samplesrc/sieve.pla $(PLVM02) $(PLASM)
@ -220,19 +220,19 @@ $(DGRTEST): samplesrc/dgrtest.pla $(PLVM02) $(PLASM)
acme --setpc 4094 -o $(DGRTEST) samplesrc/dgrtest.a
$(ROGUE): samplesrc/rogue.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMO < samplesrc/rogue.pla > samplesrc/rogue.a
./$(PLASM) -AM < samplesrc/rogue.pla > samplesrc/rogue.a
acme --setpc 4094 -o $(ROGUE) samplesrc/rogue.a
$(ROGUEIO): samplesrc/rogue.io.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMO < samplesrc/rogue.io.pla > samplesrc/rogue.io.a
./$(PLASM) -AM < samplesrc/rogue.io.pla > samplesrc/rogue.io.a
acme --setpc 4094 -o $(ROGUEIO) samplesrc/rogue.io.a
$(ROGUECOMBAT): samplesrc/rogue.combat.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMO < samplesrc/rogue.combat.pla > samplesrc/rogue.combat.a
./$(PLASM) -AM < samplesrc/rogue.combat.pla > samplesrc/rogue.combat.a
acme --setpc 4094 -o $(ROGUECOMBAT) samplesrc/rogue.combat.a
$(ROGUEMAP): samplesrc/rogue.map.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMO < samplesrc/rogue.map.pla > samplesrc/rogue.map.a
./$(PLASM) -AM < samplesrc/rogue.map.pla > samplesrc/rogue.map.a
acme --setpc 4094 -o $(ROGUEMAP) samplesrc/rogue.map.a
$(HGR1): samplesrc/hgr1.pla samplesrc/hgr1test.pla $(PLVM02) $(PLASM)

View File

@ -1,5 +1,5 @@
import cmdsys
predef syscall, call, memset, getc, putc, puts, modaddr
predef syscall(f,p)#1, call(adr,a,x,y,p)#1, memset(d,s,l)#1, getc#1, putc(c)#1, puts(s)#1, modaddr(a)#1
byte MACHID
end
//
@ -30,7 +30,7 @@ const page2 = 1
//
// Predefined functions.
//
predef a2keypressed, a2gotoxy, a2grmode, a2textmode
predef a2keypressed#1, a2gotoxy(x,y)#0, a2grmode(m)#0, a2textmode#0
//
// String data.
//
@ -71,7 +71,7 @@ end
//
// def grscrn(rowaddrs)
//
asm grscrn
asm grscrn(rowaddrs)#0
GRSCRN = $26
GRSCRNL = GRSCRN
GRSCRNH = GRSCRNL+1
@ -79,12 +79,13 @@ GRSCRNH = GRSCRNL+1
STA GRSCRNL
LDA ESTKH,X
STA GRSCRNH
INX
RTS
end
//
// def grcolor(color)
//
asm grcolor
asm grcolor(color)#0
GRCLR = $30
LDA #$0F
AND ESTKL,X
@ -95,12 +96,13 @@ GRCLR = $30
ASL
ORA GRCLR
STA GRCLR
INX
RTS
end
//
// def grplot(x, y)
//
asm grplot
asm grplot(x, y)#0
STY IPY
LDA ESTKL,X
AND #$FE
@ -125,56 +127,57 @@ asm grplot
STA (DST),Y
LDY IPY
INX
INX
RTS
end
//
// Apple II routines.
//
def a2keypressed
def a2keypressed#1
if ^keyboard >= 128
return ^keystrobe
fin
return FALSE
end
def a2gotoxy(x, y)
def a2gotoxy(x, y)#0
^$24 = x + ^$20
return call($FB5B, y + ^$22, 0, 0, 0)
call($FB5B, y + ^$22, 0, 0, 0)
end
def a2grmode(mix)
def a2grmode(mix)#0
call($FB2F, 0, 0, 0, 0) // initmode()
call($FB40, 0, 0, 0, 0) // grmode()
if !mix
^showfull
fin
call($FC58, 0, 0, 0, 0) // home()
return grscrn(@txt1scrn) // point to lo-res screen
grscrn(@txt1scrn) // point to lo-res screen
end
def a2textmode
def a2textmode#0
call($FB39, 0, 0, 0, 0) // textmode()
return call($FC58, 0, 0, 0, 0) // home()
call($FC58, 0, 0, 0, 0) // home()
end
//
// Apple III routines.
//
def dev_control(devnum, code, list)
def dev_control(devnum, code, list)#1
byte params[5]
params.0 = 3
params.1 = devnum
params.2 = code
params:3 = list
return syscall($83, @params)
end
def dev_status(devnum, code, list)
def dev_status(devnum, code, list)#1
byte params[5]
params.0 = 3
params.1 = devnum
params.2 = code
params:3 = list
return syscall($82, @params)
end
def a3keypressed
def a3keypressed#1
byte count
dev_status(devcons, 5, @count)
if count
@ -182,13 +185,13 @@ def a3keypressed
fin
return FALSE
end
def a3gotoxy(x, y)
def a3gotoxy(x, y)#0
putc(24)
putc(x)
putc(25)
return putc(y)
putc(y)
end
def a3viewport(left, top, width, height)
def a3viewport(left, top, width, height)#0
putc(1) // Reset viewport
putc(26)
putc(left)
@ -198,9 +201,9 @@ def a3viewport(left, top, width, height)
putc(left + width - 1)
putc(top + height - 1)
putc(3)
return a3gotoxy(0, 0)
a3gotoxy(0, 0)
end
def a3grmode(mix)
def a3grmode(mix)#0
byte i
if mix
mix = 19
@ -214,17 +217,17 @@ def a3grmode(mix)
memset(txt1scrn[i], $0000, 40) // text screen
memset(txt2scrn[i], $0000, 40) // color screen
next
return grscrn(@txt2scrn) // point to color screen
grscrn(@txt2scrn) // point to color screen
end
def a3textmode
def a3textmode#0
puts(@textbwmode)
a3viewport(0, 0, 40, 24)
return putc(28)
putc(28)
end
//
// Rod's Colors.
//
def rod
def rod#0
byte i, j, k, w, fmi, fmk, color
while TRUE
for w = 3 to 50
@ -234,16 +237,16 @@ def rod
color = (j * 3) / (i + 3) + i * w / 12
fmi = 40 - i
fmk = 40 - k
grcolor(color)
grplot(i, k)
grplot(k, i)
grplot(fmi, fmk)
grplot(fmk, fmi)
grplot(k, fmi)
grplot(fmi, k)
grplot(i, fmk)
grplot(fmk, i)
if keypressed()
grcolor(color)#0
grplot(i, k)#0
grplot(k, i)#0
grplot(fmi, fmk)#0
grplot(fmk, fmi)#0
grplot(k, fmi)#0
grplot(fmi, k)#0
grplot(i, fmk)#0
grplot(fmk, i)#0
if keypressed()#1
return
fin
next
@ -271,10 +274,10 @@ when MACHID & $C8
fin
otherwise // Apple ][
wend
grmode(MIXMODE)
gotoxy(11, 1)
grmode(MIXMODE)#0
gotoxy(11, 1)#0
puts(@exitmsg)
rod
textmode()
textmode()#0
puts(@goodbye)
done
done

View File

@ -1353,6 +1353,7 @@ int parse_vars(int type)
parse_error("Invalid def return value count");
return (0);
}
scan();
}
type |= funcparms_type(cfnparms) | funcvals_type(cfnvals);
idfunc_add(idstr, idlen, type, tag_new(type));
@ -1362,6 +1363,7 @@ int parse_vars(int type)
{
idstr = tokenstr;
idlen = tokenlen;
type &= ~FUNC_PARMVALS;
cfnparms = 0;
cfnvals = 1; // Default to one return value for compatibility
if (scan() == OPEN_PAREN_TOKEN)
@ -1388,6 +1390,7 @@ int parse_vars(int type)
parse_error("Invalid def return value count");
return (0);
}
scan();
}
type |= funcparms_type(cfnparms) | funcvals_type(cfnvals);
idfunc_add(idstr, idlen, type, tag_new(type));
@ -1597,6 +1600,7 @@ int parse_defs(void)
parse_error("Invalid def return value count");
return (0);
}
scan();
}
type |= funcparms_type(cfnparms) | funcvals_type(infuncvals);
if (idglobal_lookup(idstr, idlen) >= 0)
@ -1618,8 +1622,8 @@ int parse_defs(void)
func_tag = tag_new(type);
idfunc_add(idstr, idlen, type, func_tag);
}
c = tokenstr[idlen];
tokenstr[idlen] = '\0';
c = idstr[idlen];
idstr[idlen] = '\0';
emit_idfunc(func_tag, type, idstr, 0);
idstr[idlen] = c;
do