mirror of
https://github.com/A2osX/A2osX.git
synced 2024-06-26 09:29:30 +00:00
131 lines
3.1 KiB
Plaintext
131 lines
3.1 KiB
Plaintext
NEW
|
||
PREFIX
|
||
AUTO 4,1 Enable MASM3 auto line num
|
||
.LIST OFF
|
||
.OP 65C02 Target CPU, must match CPU level in header
|
||
.OR $2000 usualy $2000, but any value > $100 allowed
|
||
.TF BIN/CSH
|
||
*--------------------------------------
|
||
.INB INC/MACROS.I
|
||
.INB INC/A2OSX.I
|
||
.INB INC/MLI.I
|
||
.INB INC/MLI.E.I
|
||
*--------------------------------------
|
||
.INB USR/SRC/BIN/CSH.E
|
||
*--------------------------------------
|
||
* Zero Page Segment, up to 32 bytes
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR ZPBIN
|
||
ZS.START
|
||
ZPPtr1 .BS 2
|
||
ZPPtr2 .BS 2
|
||
ZPFileBufPtr .BS 2
|
||
|
||
ZPCSHSymbols .BS 2
|
||
ZPCSHData .BS 2
|
||
ZPCSHValue .BS 2
|
||
ZPCSHStack .BS 2
|
||
ZS.END .ED
|
||
*--------------------------------------
|
||
* File Header (16 Bytes)
|
||
*--------------------------------------
|
||
CS.START cld
|
||
jmp (.1,x)
|
||
.DA #$61 6502,Level 1 (65c02)
|
||
.DA #1 BIN Layout Version 1
|
||
.DA #0 S.PS.F.EVENT
|
||
.DA #0
|
||
.DA CS.END-CS.START Code Size (without Constants)
|
||
.DA DS.END-DS.START Data SegmentSize
|
||
.DA #16 Stack Size
|
||
.DA #ZS.END-ZS.START Zero Page Size
|
||
.DA 0
|
||
*--------------------------------------
|
||
* Relocation Table
|
||
*--------------------------------------
|
||
.1 .DA CS.INIT
|
||
.DA CS.RUN
|
||
.DA CS.DOEVENT
|
||
.DA CS.QUIT
|
||
L.MSG.GREETINGS .DA MSG.GREETINGS
|
||
.INB USR/SRC/BIN/CSH.R
|
||
.DA 0
|
||
*--------------------------------------
|
||
* Called once at process creation
|
||
* Put code for loading LIB here
|
||
*--------------------------------------
|
||
CS.INIT clc
|
||
rts
|
||
*--------------------------------------
|
||
* Called until exit with CS
|
||
* if RUN exits with CC, RN entered again
|
||
*--------------------------------------
|
||
CS.RUN >PUSHWI K.VER
|
||
>PUSHBI 2
|
||
>LDYA L.MSG.GREETINGS
|
||
>SYSCALL printf
|
||
bcs .99
|
||
|
||
jsr CSH.Init
|
||
bcs .99
|
||
|
||
ldy #S.PS.ARGC
|
||
lda (pPS),y
|
||
beq .90 no arg, usage
|
||
|
||
>PUSHWI 0 Aux type
|
||
>PUSHBI S.FI.T.TXT
|
||
>PUSHBI O.RDONLY
|
||
lda #1
|
||
>SYSCALL ArgV
|
||
>SYSCALL LoadTxtFile
|
||
bcs .99
|
||
|
||
txa
|
||
>STA.G hFileBuf
|
||
>SYSCALL GetMemPtr
|
||
>STYA ZPFileBufPtr
|
||
|
||
.1 >SLEEP
|
||
jsr CSH.Run
|
||
bcc .1
|
||
|
||
rts
|
||
|
||
.90 lda #E.SYN Exit Code = Succes
|
||
sec QUIT Process
|
||
.99 rts
|
||
*--------------------------------------
|
||
* Called if option S.PS.F.EVENT enabled in Header
|
||
* Timer Event : every 10th seconds
|
||
*--------------------------------------
|
||
CS.DOEVENT sec
|
||
rts
|
||
*--------------------------------------
|
||
* Called once, when RUN exited with CS
|
||
* Put code for unloading LIB here
|
||
*--------------------------------------
|
||
CS.QUIT jsr CSH.Quit
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
.INB USR/SRC/BIN/CSH.S.CORE
|
||
*--------------------------------------
|
||
CS.END
|
||
*--------------------------------------
|
||
* Initialized DATA
|
||
*--------------------------------------
|
||
MSG.Greetings .AZ "\r\nCSH-Shell %d.%d\r\n\r\n"
|
||
.INB USR/SRC/BIN/CSH.I
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR 0
|
||
DS.START .INB USR/SRC/BIN/CSH.D
|
||
DS.END
|
||
.ED
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE USR/SRC/BIN/CSH.S
|
||
ASM
|