mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-11-15 04:08:04 +00:00
Prepare for boot..
This commit is contained in:
parent
689e0542ce
commit
f0b629510e
@ -1,6 +1,5 @@
|
||||
const iobuffer = $0800
|
||||
const databuff = $0C00
|
||||
const autorun = $01FF
|
||||
byte version[] = "PLASMA VM VERSION 0.9"
|
||||
byte errorstr[] = "ERROR: $"
|
||||
byte okstr[] = "OK"
|
||||
@ -11,6 +10,39 @@ word cmdptr
|
||||
;
|
||||
; Utility functions
|
||||
;
|
||||
asm equates
|
||||
;*
|
||||
;* BANK SWITCHED MEM
|
||||
;*
|
||||
LCRDEN = $C080
|
||||
LCWTEN = $C081
|
||||
ROMEN = $C082
|
||||
LCRWEN = $C083
|
||||
LCBNK2 = $00
|
||||
LCBNK1 = $08
|
||||
;*
|
||||
;* ZERO PAGE USEAGE
|
||||
;*
|
||||
ESTKSZ = $20
|
||||
ESTK = $C0
|
||||
ESTKL = ESTK
|
||||
ESTKH = ESTK+ESTKSZ/2
|
||||
VMZP = ESTK+ESTKSZ
|
||||
IFP = VMZP
|
||||
IFPL = IFP
|
||||
IFPH = IFP+1
|
||||
IP = IFP+2
|
||||
IPL = IP
|
||||
IPH = IP+1
|
||||
IPY = IP+2
|
||||
SRC = $06
|
||||
SRCL = SRC
|
||||
SRCH = SRC+1
|
||||
DST = SRC+2
|
||||
DSTL = DST
|
||||
DSTH = DST+1
|
||||
ESP = DST+2
|
||||
end
|
||||
; CALL PRODOS
|
||||
; SYSCALL(CMD, PARAMS)
|
||||
;
|
||||
@ -26,7 +58,6 @@ asm prodos
|
||||
JSR $BF00
|
||||
CMD: !BYTE 00
|
||||
PARAMS: !WORD 0000
|
||||
BIT LCBNK2
|
||||
LDX ESP
|
||||
STA ESTKL,X
|
||||
LDY #$00
|
||||
@ -40,7 +71,6 @@ asm exec
|
||||
LDX #$FE
|
||||
TXS
|
||||
LDX ESTKSZ/2
|
||||
BIT ROMEN
|
||||
JMP $2000
|
||||
end
|
||||
;
|
||||
@ -333,7 +363,7 @@ def catalog(optpath)
|
||||
word entry, filecnt
|
||||
|
||||
if ^optpath
|
||||
memcpy(optpath, @path, ^optpath + 1)
|
||||
memcpy(@path, optpath, ^optpath + 1)
|
||||
else
|
||||
getpfx(@path)
|
||||
prstr(@path)
|
||||
@ -384,7 +414,7 @@ def catalog(optpath)
|
||||
end
|
||||
def stripchars(strptr)
|
||||
while ^strptr and ^(strptr + 1) <> ' '
|
||||
memcpy(strptr + 2, strptr + 1, ^strptr)
|
||||
memcpy(strptr + 1, strptr + 2, ^strptr)
|
||||
^strptr = ^strptr - 1
|
||||
loop
|
||||
return ^strptr
|
||||
@ -394,7 +424,7 @@ def stripspaces(strptr)
|
||||
^strptr = ^strptr - 1
|
||||
loop
|
||||
while ^strptr and ^(strptr + 1) <= ' '
|
||||
memcpy(strptr + 2, strptr + 1, ^strptr)
|
||||
memcpy(strptr + 1, strptr + 2, ^strptr)
|
||||
^strptr = ^strptr - 1
|
||||
loop
|
||||
end
|
||||
@ -415,7 +445,7 @@ def parsecmd(strptr)
|
||||
stripspaces(strptr)
|
||||
if ^strptr
|
||||
cmd = ^(strptr + 1)
|
||||
memcpy(strptr + 2, strptr + 1, ^strptr)
|
||||
memcpy(strptr + 1, strptr + 2, ^strptr)
|
||||
^strptr = ^strptr - 1
|
||||
fin
|
||||
stripspaces(strptr)
|
||||
@ -439,18 +469,18 @@ def execsys(sysfile)
|
||||
word len
|
||||
|
||||
if ^sysfile
|
||||
memcpy(sysfile, $280, ^sysfile + 1)
|
||||
memcpy($280, sysfile, ^sysfile + 1)
|
||||
striptrail(sysfile)
|
||||
refnum = open(sysfile, iobuffer)
|
||||
if refnum
|
||||
len = read(refnum, $2000, $FFFF)
|
||||
resetmemfiles()
|
||||
if len
|
||||
memcpy($280, sysfile, ^$280 + 1)
|
||||
memcpy(sysfile, $280, ^$280 + 1)
|
||||
if stripchars(sysfile) and ^$2000 == $4C and *$2003 == $EEEE
|
||||
stripspaces(sysfile)
|
||||
if ^$2006 <= ^sysfile
|
||||
memcpy(sysfile, $2006, ^sysfile + 1)
|
||||
memcpy($2006, sysfile, ^sysfile + 1)
|
||||
fin
|
||||
fin
|
||||
striptrail($280)
|
||||
@ -461,7 +491,6 @@ def execsys(sysfile)
|
||||
end
|
||||
|
||||
resetmemfiles()
|
||||
execsys(autorun)
|
||||
prstr(@version)
|
||||
crout();
|
||||
while 1
|
||||
|
@ -1,9 +1,7 @@
|
||||
const iobuffer = $0800
|
||||
const databuff = $0C00
|
||||
const memmap = $BF58
|
||||
const autorun = $01FF
|
||||
byte cmdline[] = "CMD"
|
||||
word cmd = @cmdline
|
||||
const sysfile = $0280
|
||||
byte syshalt[] = "SYSTEM HALTED..."
|
||||
byte perr
|
||||
|
||||
@ -35,6 +33,10 @@ end
|
||||
; CALL LOADED SYSTEM PROGRAM
|
||||
;
|
||||
asm exec
|
||||
LDA #$00
|
||||
STA IFPL
|
||||
LDA #$BF
|
||||
STA IFPH
|
||||
LDX #$FE
|
||||
TXS
|
||||
LDX ESTKSZ/2
|
||||
@ -207,16 +209,14 @@ def resetmemfiles
|
||||
^memmap.0 = $CF
|
||||
^memmap.23 = $01
|
||||
end
|
||||
def execsys(sysfile)
|
||||
def execsys
|
||||
byte refnum
|
||||
|
||||
if ^sysfile
|
||||
memcpy($280, sysfile, ^sysfile + 1)
|
||||
refnum = open(sysfile, iobuffer)
|
||||
if refnum
|
||||
if read(refnum, $2000, $FFFF)
|
||||
resetmemfiles()
|
||||
memcpy($280, sysfile, ^$280 + 1)
|
||||
exec()
|
||||
fin
|
||||
fin
|
||||
@ -224,10 +224,7 @@ def execsys(sysfile)
|
||||
end
|
||||
|
||||
resetmemfiles()
|
||||
if ^autorun
|
||||
cmd = autorun
|
||||
fin
|
||||
execsys(cmd)
|
||||
execsys
|
||||
prstr(@syshalt)
|
||||
cin()
|
||||
reboot()
|
||||
|
@ -3,6 +3,7 @@ AFLAGS = -o $@
|
||||
LFLAGS = -C default.cfg
|
||||
PLVM = plvm
|
||||
PLVM02 = PLVM02.SYS
|
||||
CMD = CMD.SYS
|
||||
PLASM = plasm
|
||||
INCS = tokens.h symbols.h lex.h parse.h codegen.h
|
||||
OBJS = plasm.c parse.o lex.o codegen.o
|
||||
@ -21,7 +22,7 @@ TXTTYPE = .TXT
|
||||
#SYSTYPE = \#ff0000
|
||||
#TXTTYPE = \#040000
|
||||
|
||||
all: $(PLASM) $(PLVM) $(PLVM02) TESTLIB
|
||||
all: $(PLASM) $(PLVM) $(PLVM02) $(CMD) TESTLIB
|
||||
|
||||
clean:
|
||||
-rm *.o *~ *.a *.SYM *.SYS *.BIN TESTLIB $(PLASM) $(PLVM)
|
||||
@ -38,6 +39,10 @@ cmdexec.a: cmdexec.pla $(PLASM)
|
||||
$(PLVM02): plvm02.s cmdexec.a
|
||||
acme -o $(PLVM02) -l PLVM02.SYM plvm02.s
|
||||
|
||||
$(CMD): cmd.pla $(PLVM) $(PLASM)
|
||||
./$(PLASM) -A < cmd.pla > cmd.a
|
||||
acme --setpc 8192 -o $(CMD) cmd.a
|
||||
|
||||
TESTLIB: testlib.pla $(PLVM) $(PLASM)
|
||||
./$(PLASM) -AM < testlib.pla > testlib.a
|
||||
acme --setpc 4096 -o TESTLIB testlib.a
|
||||
|
@ -76,7 +76,7 @@ ESP = DST+2
|
||||
;*
|
||||
;***********************************************
|
||||
* = $2000
|
||||
LDX #$FE
|
||||
LDX #$FF
|
||||
TXS
|
||||
;*
|
||||
;* INSTALL PAGE 3 VECTORS
|
||||
@ -132,7 +132,7 @@ ESP = DST+2
|
||||
BCC +
|
||||
JMP NOAUTO
|
||||
+ LDX READPARMS+6
|
||||
STX $01FF
|
||||
STX $0280
|
||||
NOAUTO JSR PRODOS
|
||||
!BYTE $CC
|
||||
!WORD CLOSEPARMS
|
||||
@ -144,9 +144,7 @@ NOAUTO JSR PRODOS
|
||||
STA $1000,Y
|
||||
INY
|
||||
BNE -
|
||||
LDA #$7F
|
||||
ADC #$01 ; SET V FLAG
|
||||
JMP $1007 ; CALL CMD
|
||||
JMP CMDEXEC ; CALL CMD
|
||||
AUTORUN !BYTE 7
|
||||
!TEXT "AUTORUN"
|
||||
OPENPARMS !BYTE 3
|
||||
@ -159,7 +157,7 @@ NLPARMS !BYTE 3
|
||||
!BYTE $0D
|
||||
READPARMS !BYTE 4
|
||||
!BYTE 0
|
||||
!WORD $0200
|
||||
!WORD $0281
|
||||
!WORD $0080
|
||||
!WORD 0
|
||||
CLOSEPARMS !BYTE 1
|
||||
@ -201,21 +199,24 @@ OPXTBL !WORD ZEROX,ADDX,SUBX,MULX,DIVX,MODX,INCRX,DECRX ; 00 02 04 06 08 0
|
||||
!WORD LBX,LWX,LLBX,LLWX,LABX,LAWX,DLBX,DLWX ; 60 62 64 66 68 6A 6C 6E
|
||||
!WORD SBX,SWX,SLBX,SLWX,SABX,SAWX,DABX,DAWX ; 70 72 74 76 78 7A 7C 7E
|
||||
;*
|
||||
;* COMMAND PROCESSING
|
||||
;* 'BYE' COMMAND PROCESSING
|
||||
;*
|
||||
!PSEUDOPC $1000 {
|
||||
;*
|
||||
;* CLEAR COMMAND LINE LENGTH BYTE IF CALLED FROM 'BYE'
|
||||
;*
|
||||
LDY #$00
|
||||
LDY DEFCMD
|
||||
STY $0280 ; SET DEFAULT COMMAND WHEN CALLED FROM 'BYE'
|
||||
- LDA DEFCMD,Y
|
||||
STA $0280,Y
|
||||
DEY
|
||||
BNE -
|
||||
LDX #$FE ; LEAVE ROOM FOR COMMAND LINE LENGTH BYTE
|
||||
TXS
|
||||
BVS +
|
||||
STY $01FF ; CLEAR AUTORUN COMMAND WHEN CALLED FROM 'BYE'
|
||||
;*
|
||||
;* MOVE REST OF CMD FROM LANGUAGE CARD
|
||||
;*
|
||||
+ STY SRCL
|
||||
CMDEXEC STY SRCL
|
||||
STY DSTL
|
||||
LDA #$D2
|
||||
STA SRCH
|
||||
@ -246,6 +247,8 @@ OPXTBL !WORD ZEROX,ADDX,SUBX,MULX,DIVX,MODX,INCRX,DECRX ; 00 02 04 06 08 0
|
||||
JSR $FC58 ; HOME
|
||||
JMP START
|
||||
DISABLE80 !BYTE 21, 13, '1', 26, 13
|
||||
DEFCMD !BYTE 3
|
||||
!TEXT "CMD"
|
||||
;*
|
||||
;* JUMP TO INTERPRETER
|
||||
;*
|
||||
|
Loading…
Reference in New Issue
Block a user