mirror of
https://github.com/A2osX/A2osX.git
synced 2025-02-26 08:29:46 +00:00
Kernel 0.94
This commit is contained in:
parent
a650cb83da
commit
67878e93ce
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -333,21 +333,27 @@ DisableRamDRV php
|
||||
lda DEVPTRS3D2
|
||||
cmp DEVPTRS S0D1=NOVEV
|
||||
bne .1
|
||||
|
||||
lda DEVPTRS3D2+1
|
||||
cmp DEVPTRS+1 S0D1=NODEV
|
||||
beq .9 S3D2=NODEV, nothing to do
|
||||
|
||||
.1 ldx DEVCNT
|
||||
|
||||
.2 lda DEVLST,x LOOKING FOR $BF, $BB, $B7, $B3
|
||||
and #$F3
|
||||
cmp #$B3
|
||||
beq .3
|
||||
|
||||
dex
|
||||
bpl .2
|
||||
|
||||
plp
|
||||
|
||||
lda #1 No device found, exit with error
|
||||
sec
|
||||
rts
|
||||
|
||||
.3 cpx DEVCNT
|
||||
beq .5
|
||||
|
||||
@ -364,13 +370,16 @@ DisableRamDRV php
|
||||
sta DEVPTRS3D2
|
||||
lda DEVPTRS+1
|
||||
sta DEVPTRS3D2+1
|
||||
|
||||
plp
|
||||
jsr MLI
|
||||
.DA #MLIONLINE
|
||||
.DA MLIONLINE01
|
||||
clc Success!!
|
||||
rts
|
||||
|
||||
.9 plp
|
||||
|
||||
lda #0 Not detected
|
||||
sec
|
||||
rts
|
||||
|
@ -336,20 +336,16 @@ CS.RUN.LL.DISKII
|
||||
jsr CS.RUN.ZeroPtr1 16 sectors filled with 0, give some time to spin up
|
||||
|
||||
stz CurTrack
|
||||
stz CurQTrack
|
||||
|
||||
lda TrkCnt
|
||||
sta Counter
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 jsr CS.RUN.CheckCtrlC
|
||||
bcs .9
|
||||
.1 >SLEEP
|
||||
|
||||
jsr CS.RUN.SeekToX
|
||||
jsr CS.RUN.CheckCtrlC
|
||||
bcs .9
|
||||
|
||||
>SLEEP
|
||||
|
||||
>PUSHW L.MSG.LLDISK2
|
||||
>PUSHB CurTrack
|
||||
inc
|
||||
@ -374,10 +370,10 @@ CS.RUN.LL.DISKII
|
||||
lda CurQTrack
|
||||
* clc
|
||||
adc Stepping
|
||||
|
||||
tax
|
||||
|
||||
bra .1
|
||||
|
||||
jsr CS.RUN.SeekToX
|
||||
bcc .1
|
||||
|
||||
.9 pha
|
||||
jsr CS.RUN.MotorOff
|
||||
@ -390,6 +386,9 @@ CS.RUN.LL.DISKII
|
||||
>SYSCALL PrintF
|
||||
bcs .9
|
||||
|
||||
ldx #0
|
||||
jsr CS.RUN.SeekToX
|
||||
|
||||
bit bVerify
|
||||
bpl .80
|
||||
|
||||
@ -399,10 +398,6 @@ CS.RUN.LL.DISKII
|
||||
.80 jmp CS.RUN.MotorOff
|
||||
*--------------------------------------
|
||||
CS.RUN.LL.DISKII.V
|
||||
>PUSHW L.MSG.VERIFY
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
|
||||
lda hTrackBuf
|
||||
bne .10
|
||||
>LDYAI 512
|
||||
@ -465,9 +460,8 @@ CS.RUN.LL.DISKII.V
|
||||
dec Counter
|
||||
bne .3
|
||||
|
||||
>PUSHW L.MSG.CRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
>LDYA L.MSG.OK
|
||||
>SYSCALL PutS
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
@ -495,12 +489,8 @@ CS.RUN.LL.DISKII.VBLK
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL PrintF
|
||||
plx
|
||||
rts
|
||||
|
||||
.8 lda #C.CR
|
||||
>SYSCALL PutChar
|
||||
plx
|
||||
|
||||
.8 plx
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.MotorOn sec
|
||||
@ -520,19 +510,22 @@ CS.RUN.SeekToX >PUSHB DSSS0000
|
||||
>LIBCALL hLIBBLKDEV,LIBBLKDEV.D2MoveHead
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.ZeroPtr1 >LDYA ZPPtr1
|
||||
>STYA ZPPtr2
|
||||
|
||||
lda #$AA
|
||||
CS.RUN.ZeroPtr1 lda ZPPtr1+1
|
||||
pha
|
||||
|
||||
lda #0
|
||||
tay
|
||||
|
||||
.10 sta (ZPPtr2),y
|
||||
.1 sta (ZPPtr1),y
|
||||
iny
|
||||
bne .10
|
||||
bne .1
|
||||
|
||||
inc ZPPtr2+1
|
||||
inc ZPPtr1+1
|
||||
dex
|
||||
bne .10
|
||||
bne .1
|
||||
|
||||
pla
|
||||
sta ZPPtr1+1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -671,6 +664,8 @@ CS.RUN.CheckCtrlC
|
||||
phx
|
||||
phy
|
||||
|
||||
>SLEEP
|
||||
|
||||
ldy #S.PS.hStdIn
|
||||
lda (pPS),y
|
||||
>SYSCALL FEOF
|
||||
@ -709,7 +704,7 @@ MSG.NOSIZE .AZ "Unable to get media size."
|
||||
MSG.INIT .AZ "Formatting %s, Volname:%s\r\n"
|
||||
MSG.LL .AZ "Low Level Format %D Blks\r\n"
|
||||
MSG.LLDISK2 .AZ "\rWriting Track %02d (%02d/%02d)..."
|
||||
MSG.VERIFY .AZ "Verifying Track %02d/%02d, Block %05D..."
|
||||
MSG.VERIFY .AZ "\rVerifying Track %02d/%02d, Block %05D..."
|
||||
MSG.WRITECAT .AZ "Writing Catalog..."
|
||||
FMT.BLANK .AZ "BLANK%H%H"
|
||||
*--------------------------------------
|
||||
|
266
BIN/FORTH.S.CL.txt
Normal file
266
BIN/FORTH.S.CL.txt
Normal file
@ -0,0 +1,266 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
CL.READN0A tax
|
||||
CL.READN0X >PUSHW ZPCLBuf
|
||||
>PUSHW L.FMT.Byte
|
||||
txa
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL SPrintF
|
||||
bcs .9
|
||||
|
||||
lda #$ff
|
||||
sta CL.bReady
|
||||
* clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CL.CHARIN tax
|
||||
|
||||
bit CL.bEscMode \e ?
|
||||
bpl .4
|
||||
|
||||
cpx #'['
|
||||
beq .8 \e[
|
||||
|
||||
stz CL.bEscMode
|
||||
txa
|
||||
|
||||
ldx #EscChars.Cnt-1
|
||||
|
||||
.1 cmp EscChars,x
|
||||
beq .2
|
||||
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
.8 rts invalid \e[ sequence
|
||||
|
||||
.2 lda CL.MaxCnt
|
||||
bne .3
|
||||
|
||||
lda EscChars.Remap,x
|
||||
bra CL.READN0A
|
||||
|
||||
.3 txa
|
||||
asl
|
||||
tax
|
||||
jmp (J.ESC,x)
|
||||
*--------------------------------------
|
||||
.4 cpx #C.ESC
|
||||
bne .5
|
||||
|
||||
lda #$ff
|
||||
sta CL.bEscMode
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.5 lda CL.MaxCnt
|
||||
beq CL.READN0X
|
||||
|
||||
cpx #C.SPACE
|
||||
bcc CL.CHARIN.CTRL
|
||||
|
||||
cpx #C.DEL
|
||||
bne CL.Insert
|
||||
*--------------------------------------
|
||||
* Erase char BEFORE cursor
|
||||
*--------------------------------------
|
||||
lda CL.Len
|
||||
beq .8
|
||||
|
||||
lda CL.Ptr
|
||||
beq .8
|
||||
|
||||
lda #C.BS
|
||||
>SYSCALL PutChar
|
||||
|
||||
dec CL.Ptr
|
||||
jmp CL.DEL
|
||||
*--------------------------------------
|
||||
CL.Insert ldy CL.Len
|
||||
cpy CL.MaxCnt
|
||||
beq .8 Buffer full, discard...
|
||||
|
||||
iny
|
||||
sty CL.Len
|
||||
|
||||
.1 dey
|
||||
lda (ZPCLBuf),y Move from Ptr To end of buffer forward...
|
||||
iny
|
||||
sta (ZPCLBuf),y
|
||||
dey
|
||||
cpy CL.Ptr
|
||||
bne .1
|
||||
|
||||
txa
|
||||
sta (ZPCLBuf),y
|
||||
inc CL.Ptr
|
||||
|
||||
>SYSCALL PutChar
|
||||
jsr CL.PrintEOL
|
||||
|
||||
dec CL.MaxCnt MaxCnt = 1, don't wait for CR
|
||||
bne .8
|
||||
|
||||
lda #$ff
|
||||
sta CL.bReady
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CL.CHARIN.CTRL cpx #C.CR
|
||||
beq .8
|
||||
|
||||
cpx #C.EOF
|
||||
beq .9
|
||||
|
||||
cpx #3 Ctrl-C
|
||||
beq CL.CLR
|
||||
|
||||
cpx #26 Ctrl-Z
|
||||
bne .8
|
||||
|
||||
jmp CL.SUPPR
|
||||
|
||||
.8 jsr CheckLFAfterCR
|
||||
bcs .9
|
||||
|
||||
lda #$ff
|
||||
sta CL.bReady
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CL.CLR lda (ZPCLBuf)
|
||||
beq CL.Reset.1
|
||||
|
||||
.1 lda CL.Ptr
|
||||
cmp CL.Len
|
||||
beq .2
|
||||
|
||||
inc
|
||||
sta CL.Ptr
|
||||
|
||||
lda #C.FS
|
||||
>SYSCALL PutChar
|
||||
bra .1
|
||||
|
||||
.2 ldy #0
|
||||
|
||||
.3 lda #C.DEL
|
||||
sta (ZPCLBuf),y
|
||||
iny
|
||||
lda (ZPCLBuf),y
|
||||
bne .3
|
||||
|
||||
jsr CL.PrintCLBuf
|
||||
*--------------------------------------
|
||||
CL.Reset lda #0
|
||||
sta (ZPCLBuf)
|
||||
|
||||
CL.Reset.1 ldx #CL.Ptr
|
||||
|
||||
.1 stz 0,x
|
||||
inx
|
||||
cpx #CL.bEscMode+1
|
||||
bne .1
|
||||
|
||||
>LDYA ZPCLBuf
|
||||
>STYA ZPCLBufPtr
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CL.BS lda CL.Ptr
|
||||
beq .9
|
||||
|
||||
dec CL.Ptr
|
||||
|
||||
lda #C.BS
|
||||
>SYSCALL PutChar
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CL.NAK lda CL.Ptr
|
||||
cmp CL.Len
|
||||
beq .9
|
||||
|
||||
inc
|
||||
sta CL.Ptr
|
||||
|
||||
lda #C.FS
|
||||
>SYSCALL PutChar
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
* Erase char UNDER cursor
|
||||
*--------------------------------------
|
||||
CL.SUPPR lda CL.Len
|
||||
beq CL.PrintEOL.8
|
||||
|
||||
lda CL.Ptr
|
||||
cmp CL.Len
|
||||
beq CL.PrintEOL.8
|
||||
*--------------------------------------
|
||||
CL.DEL ldy CL.Ptr
|
||||
|
||||
.1 iny
|
||||
lda (ZPCLBuf),y
|
||||
dey
|
||||
sta (ZPCLBuf),y
|
||||
iny
|
||||
cpy CL.Len
|
||||
bne .1
|
||||
|
||||
dec CL.Len
|
||||
*--------------------------------------
|
||||
CL.PrintEOL lda CL.Ptr
|
||||
|
||||
.1 cmp CL.Len
|
||||
beq .2
|
||||
|
||||
pha
|
||||
tay
|
||||
lda (ZPCLBuf),y
|
||||
>SYSCALL PutChar
|
||||
pla
|
||||
inc
|
||||
bra .1
|
||||
|
||||
.2 lda #C.SPACE
|
||||
>SYSCALL PutChar
|
||||
lda CL.Ptr
|
||||
|
||||
.3 cmp CL.Len
|
||||
beq .4
|
||||
|
||||
pha
|
||||
lda #C.BS
|
||||
>SYSCALL PutChar
|
||||
pla
|
||||
inc
|
||||
bra .3
|
||||
|
||||
.4 lda #C.BS
|
||||
>SYSCALL PutChar
|
||||
|
||||
CL.PrintEOL.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CL.PrintCLBuf ldy #S.PS.hStdOut
|
||||
lda (pPS),y
|
||||
>PUSHA
|
||||
>PUSHW ZPCLBuf
|
||||
|
||||
>SYSCALL FPutS
|
||||
rts
|
||||
*--------------------------------------
|
||||
CL.DN
|
||||
CL.UP clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/bin/forth.s.cl
|
||||
LOAD usr/src/bin/forth.s
|
||||
ASM
|
769
BIN/FORTH.S.KW.txt
Normal file
769
BIN/FORTH.S.KW.txt
Normal file
@ -0,0 +1,769 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
KW.Lookup >LDYA L.KEYWORDS
|
||||
>STYA ZPPtr1
|
||||
|
||||
>LDYA ZPCLBufPtr
|
||||
>STYA ZPPtr2
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 ldy #$ff
|
||||
|
||||
.2 jsr .7 get next valid char in src text
|
||||
bcs .3
|
||||
|
||||
.20 jsr ToUpperCase
|
||||
eor (ZPPtr1),y match table char ?
|
||||
asl compare only 7 bits
|
||||
bne .4 no match...get next table keyword
|
||||
|
||||
bcc .2 not last char in this keyword
|
||||
|
||||
jsr .7 next char in text...
|
||||
bcc .4 valid....failed
|
||||
|
||||
.8 tya Keyword Len
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.3 dey
|
||||
lda (ZPPtr1),y was last char in this keyword ?
|
||||
bmi .8
|
||||
|
||||
iny
|
||||
.41 jsr IncPtr1 skip chars to next keyword
|
||||
|
||||
.4 lda (ZPPtr1)
|
||||
bpl .41
|
||||
jsr IncPtr1
|
||||
|
||||
.6 inx
|
||||
lda (ZPPtr1) Array Ending 0, lookup failed
|
||||
bne .1
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
.7 iny
|
||||
lda (ZPPtr2),y Get Src text char...
|
||||
beq .9 end of text
|
||||
|
||||
jsr IsSpaceOrCR
|
||||
bcc .9 end of valid chars
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.DUP lda pStack
|
||||
sec
|
||||
sbc #2
|
||||
bcc .9
|
||||
|
||||
lda (pStack)
|
||||
tax
|
||||
ldy #1
|
||||
lda (pStack),y
|
||||
>PUSHA
|
||||
txa
|
||||
>PUSHA
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 lda #E.STKOVERFLOW
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.DROP lda pStack
|
||||
beq .9
|
||||
|
||||
inc pStack
|
||||
beq .9
|
||||
inc pStack
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 lda #E.STACKERROR
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.SWAP ldy #3
|
||||
lda (pStack),y
|
||||
pha
|
||||
|
||||
dey #2
|
||||
lda (pStack),y
|
||||
pha
|
||||
|
||||
lda (pStack)
|
||||
tax
|
||||
pla
|
||||
sta (pStack)
|
||||
|
||||
txa
|
||||
sta (pStack),y #2
|
||||
|
||||
dey #1
|
||||
lda (pStack),y
|
||||
tax
|
||||
pla
|
||||
sta (pStack),y
|
||||
|
||||
iny
|
||||
iny #3
|
||||
txa
|
||||
sta (pStack),y
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.OVER lda pStack
|
||||
sec
|
||||
sbc #2
|
||||
bcc .9
|
||||
|
||||
ldy #3
|
||||
lda (pStack),y
|
||||
>PUSHA
|
||||
lda (pStack),y
|
||||
>PUSHA
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 lda #E.STKOVERFLOW
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.ROT
|
||||
*--------------------------------------
|
||||
KW.mDUP
|
||||
*--------------------------------------
|
||||
KW.gR
|
||||
*--------------------------------------
|
||||
KW.Rg
|
||||
*--------------------------------------
|
||||
KW.R
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.Add jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
clc
|
||||
ldy #2
|
||||
lda (pStack),y
|
||||
adc (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
|
||||
lda (pStack),y
|
||||
adc (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.DAdd >FPU ADD32
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.Sub jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
sec
|
||||
ldy #2
|
||||
lda (pStack),y
|
||||
sbc (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
|
||||
lda (pStack),y
|
||||
sbc (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.Mul
|
||||
*--------------------------------------
|
||||
KW.Div
|
||||
*--------------------------------------
|
||||
KW.Mod
|
||||
*--------------------------------------
|
||||
KW.DivMod
|
||||
*--------------------------------------
|
||||
KW.MulDivMod
|
||||
*--------------------------------------
|
||||
KW.MulDiv
|
||||
*--------------------------------------
|
||||
KW.MAX jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
lda (pStack) LO
|
||||
ldy #2
|
||||
cmp (pStack),y
|
||||
|
||||
dey #1
|
||||
|
||||
lda (pStack),y HI
|
||||
iny
|
||||
iny #3
|
||||
sbc (pStack),y
|
||||
bcc .1
|
||||
|
||||
jsr KW.SWAP
|
||||
|
||||
.1 jmp KW.DROP
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.MIN jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
lda (pStack) LO
|
||||
ldy #2
|
||||
cmp (pStack),y
|
||||
|
||||
dey #1
|
||||
|
||||
lda (pStack),y HI
|
||||
iny
|
||||
iny #3
|
||||
sbc (pStack),y
|
||||
bcs .1
|
||||
|
||||
jsr KW.SWAP
|
||||
|
||||
.1 jmp KW.DROP
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.ABS
|
||||
*--------------------------------------
|
||||
KW.DABS
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.MINUS lda (pStack) LO
|
||||
eor #$ff
|
||||
sec
|
||||
adc #0
|
||||
sta (pStack)
|
||||
|
||||
ldy #1
|
||||
lda (pStack),y HI
|
||||
eor #$ff
|
||||
adc #0
|
||||
sta (pStack),y
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.DMINUS lda (pStack) LO
|
||||
eor #$ff
|
||||
sec
|
||||
adc #0
|
||||
sta (pStack)
|
||||
|
||||
ldy #1
|
||||
lda (pStack),y HI
|
||||
eor #$ff
|
||||
adc #0
|
||||
sta (pStack),y
|
||||
|
||||
iny
|
||||
lda (pStack),y
|
||||
eor #$ff
|
||||
adc #0
|
||||
sta (pStack),y
|
||||
|
||||
iny
|
||||
lda (pStack),y
|
||||
eor #$ff
|
||||
adc #0
|
||||
sta (pStack),y
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.AND jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
ldy #2
|
||||
lda (pStack),y
|
||||
and (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
|
||||
lda (pStack),y
|
||||
and (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
|
||||
clc
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.OR jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
ldy #2
|
||||
lda (pStack),y
|
||||
ora (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
|
||||
lda (pStack),y
|
||||
ora (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
|
||||
clc
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.XOR jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
ldy #2
|
||||
lda (pStack),y
|
||||
eor (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
|
||||
lda (pStack),y
|
||||
eor (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
|
||||
clc
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.LWR jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
ldy #2
|
||||
lda (pStack),y
|
||||
cmp (pStack)
|
||||
inc pStack
|
||||
|
||||
lda (pStack),y
|
||||
sbc (pStack),y
|
||||
inc pStack
|
||||
|
||||
inc pStack
|
||||
|
||||
rol
|
||||
sta (pStack)
|
||||
|
||||
clc
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.GTR jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
ldy #2
|
||||
lda (pStack),y
|
||||
cmp (pStack)
|
||||
inc pStack
|
||||
|
||||
lda (pStack),y
|
||||
sbc (pStack),y
|
||||
inc pStack
|
||||
|
||||
inc pStack
|
||||
|
||||
rol
|
||||
eor #$80
|
||||
sta (pStack)
|
||||
|
||||
clc
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.EQ jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
ldy #2
|
||||
lda (pStack),y
|
||||
sec
|
||||
sbc (pStack)
|
||||
tax
|
||||
inc pStack
|
||||
|
||||
lda (pStack),y
|
||||
sbc (pStack),y
|
||||
inc pStack
|
||||
|
||||
inc pStack
|
||||
|
||||
bcc .1
|
||||
|
||||
txa
|
||||
bne .1
|
||||
|
||||
sec
|
||||
.HS 90 BCC
|
||||
.1 clc
|
||||
ror
|
||||
sta (pStack)
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.NEGATIVE >PULLA
|
||||
>PULLA
|
||||
bpl .9
|
||||
|
||||
sec
|
||||
.HS 90 BCC
|
||||
.9 clc
|
||||
ror
|
||||
sta (pStack)
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.ZERO >PULLA
|
||||
tax
|
||||
>PULLA
|
||||
bne .9
|
||||
|
||||
txa
|
||||
bne .9
|
||||
|
||||
sec
|
||||
.HS 90 BCC
|
||||
.9 clc
|
||||
ror
|
||||
sta (pStack)
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.. jsr KW.DUP
|
||||
bcs .9
|
||||
|
||||
ldy #2
|
||||
lda L.FMT.int16
|
||||
sta (pStack),y
|
||||
iny
|
||||
lda L.FMT.int16+1
|
||||
sta (pStack),y
|
||||
>PUSHBI 2
|
||||
>SYSCALL PrintF
|
||||
|
||||
* clc
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW..R
|
||||
*--------------------------------------
|
||||
KW.D.
|
||||
*--------------------------------------
|
||||
KW.D.R
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.CR >PUSHW L.MSG.ECHOCRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.SPACE lda #C.SPACE
|
||||
>SYSCALL PutChar
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.SPACES >PULLA
|
||||
|
||||
beq .8
|
||||
|
||||
.1 dec
|
||||
|
||||
pha
|
||||
|
||||
lda #C.SPACE
|
||||
>SYSCALL PutChar
|
||||
pla
|
||||
bne .1
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.PRINT >LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPPtr1
|
||||
phx
|
||||
|
||||
ldy #$ff
|
||||
|
||||
clc
|
||||
|
||||
.1 iny
|
||||
lda (ZPCLBufPtr),y
|
||||
beq .2
|
||||
|
||||
sta (ZPPtr1),y
|
||||
eor #'"
|
||||
bne .1
|
||||
|
||||
sec
|
||||
|
||||
.2 sta (ZPPtr1),y
|
||||
tya
|
||||
adc ZPCLBufPtr
|
||||
sta ZPCLBufPtr
|
||||
bcc .3
|
||||
|
||||
inc ZPCLBufPtr+1
|
||||
|
||||
.3 >LDYA ZPPtr1
|
||||
>SYSCALL PutS
|
||||
|
||||
pla
|
||||
>SYSCALL freemem
|
||||
|
||||
jmp NextChar
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.DUMP
|
||||
*--------------------------------------
|
||||
KW.TYPE
|
||||
*--------------------------------------
|
||||
KW.COUNT
|
||||
*--------------------------------------
|
||||
KW.TERMINAL
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.KEY >SYSCALL GetChar
|
||||
bcs .9
|
||||
|
||||
>PUSHA
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.EMIT >PULLA
|
||||
>SYSCALL PutChar
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.EXPECT
|
||||
*--------------------------------------
|
||||
KW.WORD
|
||||
*--------------------------------------
|
||||
KW.NUMBER
|
||||
*--------------------------------------
|
||||
KW.STARTSTR
|
||||
*--------------------------------------
|
||||
KW.STRADD
|
||||
*--------------------------------------
|
||||
KW.STRDBL
|
||||
*--------------------------------------
|
||||
KW.SIGN
|
||||
*--------------------------------------
|
||||
KW.ENDSTR
|
||||
*--------------------------------------
|
||||
KW.HOLD
|
||||
*--------------------------------------
|
||||
KW.DECIMAL
|
||||
*--------------------------------------
|
||||
KW.HEX
|
||||
*--------------------------------------
|
||||
KW.OCTAL clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.FETCHW lda (pStack)
|
||||
sta ZPAddrPtr
|
||||
ldy #1
|
||||
lda (pStack),y
|
||||
sta ZPAddrPtr+1
|
||||
|
||||
lda (ZPAddrPtr)
|
||||
sta (pStack)
|
||||
lda (ZPAddrPtr),y
|
||||
sta (pStack),y
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.STOREW jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
>PULLW ZPAddrPtr
|
||||
>PULLA
|
||||
sta (ZPAddrPtr)
|
||||
>PULLA
|
||||
ldy #1
|
||||
sta (ZPAddrPtr),y
|
||||
|
||||
* clc
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.FETCHB >PULLW ZPAddrPtr
|
||||
lda (ZPAddrPtr)
|
||||
>PUSHA
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.STOREB >PULLW ZPAddrPtr
|
||||
>PULLA
|
||||
sta (ZPAddrPtr)
|
||||
clc
|
||||
KW.STOREB.RTS rts
|
||||
*--------------------------------------
|
||||
KW.FETCHPRINTW jsr KW.FETCHW
|
||||
bcs KW.STOREB.RTS
|
||||
jmp KW..
|
||||
*--------------------------------------
|
||||
KW.ADDTOW jsr KW.FETCHW
|
||||
bcs KW.STOREB.RTS
|
||||
jsr KW.Add
|
||||
bcs KW.STOREB.RTS
|
||||
jmp KW.STOREW
|
||||
*--------------------------------------
|
||||
KW.CMOVE
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.FILL >PULLA
|
||||
bra KW.FILL2
|
||||
|
||||
KW.ERASE lda #0
|
||||
bra KW.FILL2
|
||||
|
||||
KW.BLANKS lda #C.SPACE
|
||||
|
||||
KW.FILL2 tax
|
||||
|
||||
>PULLA
|
||||
tay
|
||||
|
||||
>PULLW ZPAddrPtr
|
||||
|
||||
txa
|
||||
|
||||
.1 dey
|
||||
sta (ZPAddrPtr),y
|
||||
cpy #0
|
||||
bne .1
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.HERE >PUSHW ZPUsrBufPtr
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.PAD >PUSHW ZPPadBuf
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.ALLOT
|
||||
KW.nCOMPILE
|
||||
KW.QUOTE
|
||||
KW.FORGET
|
||||
KW.DEFINITIONS
|
||||
KW.VOCABULARY
|
||||
KW.FORTH
|
||||
KW.EDITOR
|
||||
KW.ASSEMBLER
|
||||
KW.VLIST
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.BCOLON
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.ECOLON
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.VARIABLE >PUSHB.G hSList
|
||||
>PUSHW ZPCLBufPtr
|
||||
|
||||
>SYSCALL SListNewKey
|
||||
bcs .9
|
||||
|
||||
>STYA ZPKeyID
|
||||
|
||||
txa
|
||||
jsr NextKW
|
||||
|
||||
>LDYA L.PUSHADDR
|
||||
>STYA ZPUsrCodePtr
|
||||
|
||||
>PUSHB.G hSList
|
||||
>PUSHW ZPKeyID
|
||||
>PUSHWI ZPUsrBufPtr
|
||||
>PUSHWI 4 BufPtr+CodePtr
|
||||
>SYSCALL SListAddData
|
||||
bcs .9
|
||||
|
||||
>PULLA
|
||||
sta (ZPUsrBufPtr)
|
||||
>PULLA
|
||||
ldy #1
|
||||
sta (ZPUsrBufPtr),y
|
||||
|
||||
lda ZPUsrBufPtr
|
||||
clc
|
||||
adc #2
|
||||
sta ZPUsrBufPtr
|
||||
bcc .9
|
||||
|
||||
inc ZPUsrBufPtr+1
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.CONSTANT
|
||||
*--------------------------------------
|
||||
KW.ACODE
|
||||
*--------------------------------------
|
||||
KW.FCODE
|
||||
*--------------------------------------
|
||||
KW.DO
|
||||
*--------------------------------------
|
||||
KW.LOOP
|
||||
*--------------------------------------
|
||||
PW.pLOOP
|
||||
*--------------------------------------
|
||||
KW.I
|
||||
*--------------------------------------
|
||||
KW.LEAVE
|
||||
*--------------------------------------
|
||||
KW.IF
|
||||
*--------------------------------------
|
||||
KW.ELSE
|
||||
*--------------------------------------
|
||||
KW.ENDIF
|
||||
*--------------------------------------
|
||||
KW.BEGIN
|
||||
*--------------------------------------
|
||||
KW.UNTIL
|
||||
*--------------------------------------
|
||||
KW.REPEAT
|
||||
*--------------------------------------
|
||||
KW.WHILE
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.COMMENT clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/bin/forth.s.kw
|
||||
LOAD usr/src/bin/forth.s
|
||||
ASM
|
840
BIN/FORTH.S.txt
Normal file
840
BIN/FORTH.S.txt
Normal file
@ -0,0 +1,840 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF bin/forth
|
||||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/a2osx.i
|
||||
.INB inc/mli.i
|
||||
.INB inc/mli.e.i
|
||||
*--------------------------------------
|
||||
USERSPACE.SIZE .EQ 4096
|
||||
SCRATCH.SIZE .EQ 256
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPBIN
|
||||
ZS.START
|
||||
ZPCLBuf .BS 2
|
||||
ZPCLBufPtr .BS 2
|
||||
ZPFileBuf .BS 2
|
||||
ZPFileBufPtr .BS 2
|
||||
|
||||
ZPPadBuf .BS 2
|
||||
ZPKeyID .BS 2
|
||||
|
||||
ZPUsrBufPtr .BS 2
|
||||
ZPUsrCodePtr .BS 2
|
||||
|
||||
ZPAddrPtr .BS 2
|
||||
ZPCodePtr .BS 2
|
||||
|
||||
ZPPtr1 .BS 2
|
||||
ZPPtr2 .BS 2
|
||||
|
||||
ZPPtr3 .BS 2
|
||||
|
||||
CL.Ptr .BS 1
|
||||
CL.Len .BS 1
|
||||
CL.bReady .BS 1
|
||||
CL.bEscMode .BS 1
|
||||
CL.MaxCnt .BS 1
|
||||
|
||||
bCompile .EQ *
|
||||
ArgIndex .BS 1
|
||||
|
||||
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 #256 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
|
||||
L.MSG.USAGE .DA MSG.USAGE
|
||||
L.MSG.ECHOCRLF .DA MSG.ECHOCRLF
|
||||
L.MSG.DEBUG .DA MSG.DEBUG
|
||||
L.MSG.ERR .DA MSG.ERR
|
||||
L.MSG.PROMPT .DA MSG.PROMPT
|
||||
L.MSG.PROMPTCRLF .DA MSG.PROMPTCRLF
|
||||
L.FMT.Byte .DA FMT.Byte
|
||||
L.FMT.int16 .DA FMT.int16
|
||||
J.ESC .DA CL.BS left arrow
|
||||
.DA CL.DN
|
||||
.DA CL.UP
|
||||
* .DA HIS.GetNext
|
||||
* .DA HIS.GetPrev
|
||||
.DA CL.NAK right arrow
|
||||
L.PUSHADDR .DA PUSHADDR
|
||||
L.KEYWORDS .DA KEYWORDS
|
||||
J.KEYWORDS .DA KW.DUP
|
||||
.DA KW.DROP
|
||||
.DA KW.SWAP
|
||||
.DA KW.OVER
|
||||
.DA KW.ROT
|
||||
.DA KW.mDUP
|
||||
.DA KW.gR
|
||||
.DA KW.Rg
|
||||
.DA KW.R
|
||||
.DA KW.Add
|
||||
.DA KW.DAdd
|
||||
.DA KW.Sub
|
||||
.DA KW.Mul
|
||||
.DA KW.Div
|
||||
.DA KW.Mod
|
||||
.DA KW.DivMod
|
||||
.DA KW.MulDivMod
|
||||
.DA KW.MulDiv
|
||||
.DA KW.MAX
|
||||
.DA KW.MIN
|
||||
.DA KW.ABS
|
||||
.DA KW.DABS
|
||||
.DA KW.MINUS
|
||||
.DA KW.DMINUS
|
||||
.DA KW.AND
|
||||
.DA KW.OR
|
||||
.DA KW.XOR
|
||||
.DA KW.LWR
|
||||
.DA KW.GTR
|
||||
.DA KW.EQ
|
||||
.DA KW.NEGATIVE
|
||||
.DA KW.ZERO
|
||||
.DA KW..
|
||||
.DA KW..R
|
||||
.DA KW.D.
|
||||
.DA KW.D.R
|
||||
.DA KW.CR
|
||||
.DA KW.SPACE
|
||||
.DA KW.SPACES
|
||||
.DA KW.PRINT
|
||||
.DA KW.DUMP
|
||||
.DA KW.TYPE
|
||||
.DA KW.COUNT
|
||||
.DA KW.TERMINAL
|
||||
.DA KW.KEY
|
||||
.DA KW.EMIT
|
||||
.DA KW.EXPECT
|
||||
.DA KW.WORD
|
||||
.DA KW.NUMBER
|
||||
.DA KW.STARTSTR
|
||||
.DA KW.STRADD
|
||||
.DA KW.STRDBL
|
||||
.DA KW.SIGN
|
||||
.DA KW.ENDSTR
|
||||
.DA KW.HOLD
|
||||
.DA KW.DECIMAL
|
||||
.DA KW.HEX
|
||||
.DA KW.OCTAL
|
||||
.DA KW.FETCHW
|
||||
.DA KW.STOREW
|
||||
.DA KW.FETCHB
|
||||
.DA KW.STOREB
|
||||
.DA KW.FETCHPRINTW
|
||||
.DA KW.ADDTOW
|
||||
.DA KW.CMOVE
|
||||
.DA KW.FILL
|
||||
.DA KW.ERASE
|
||||
.DA KW.BLANKS
|
||||
.DA KW.HERE
|
||||
.DA KW.PAD
|
||||
.DA KW.ALLOT
|
||||
.DA KW.nCOMPILE
|
||||
.DA KW.QUOTE
|
||||
.DA KW.FORGET
|
||||
.DA KW.DEFINITIONS
|
||||
.DA KW.VOCABULARY
|
||||
.DA KW.FORTH
|
||||
.DA KW.EDITOR
|
||||
.DA KW.ASSEMBLER
|
||||
.DA KW.VLIST
|
||||
.DA KW.BCOLON
|
||||
.DA KW.ECOLON
|
||||
.DA KW.VARIABLE
|
||||
.DA KW.CONSTANT
|
||||
.DA KW.ACODE
|
||||
.DA KW.FCODE
|
||||
.DA KW.DO
|
||||
.DA KW.LOOP
|
||||
.DA PW.pLOOP
|
||||
.DA KW.I
|
||||
.DA KW.LEAVE
|
||||
.DA KW.IF
|
||||
.DA KW.ELSE
|
||||
.DA KW.ENDIF
|
||||
.DA KW.BEGIN
|
||||
.DA KW.UNTIL
|
||||
.DA KW.REPEAT
|
||||
.DA KW.WHILE
|
||||
.DA KW.COMMENT
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT clc
|
||||
CS.INIT.RTS rts
|
||||
*--------------------------------------
|
||||
CS.RUN >PUSHW L.MSG.GREETINGS
|
||||
>PUSHW A2osX.KVER
|
||||
>PUSHBI 2
|
||||
>SYSCALL PrintF
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
jsr CS.RUN.ARGS
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
>LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
>STYA ZPCLBuf
|
||||
txa
|
||||
>STA.G hCLBuf
|
||||
|
||||
>LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
>STYA ZPPadBuf
|
||||
txa
|
||||
>STA.G hPadBuf
|
||||
|
||||
>LDYAI USERSPACE.SIZE
|
||||
>SYSCALL GetMem
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
>STYA ZPUsrBufPtr
|
||||
>STYA.G UsrBuf
|
||||
txa
|
||||
>STA.G hUsrBuf
|
||||
|
||||
>SYSCALL SListNew
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
>STA.G hSList
|
||||
|
||||
stz bCompile
|
||||
|
||||
.1 >SLEEP
|
||||
|
||||
>LDA.G bDebug
|
||||
bpl .2
|
||||
|
||||
jsr PrintDebugMsg
|
||||
|
||||
.2 >LDA.G bTrace
|
||||
bpl .3
|
||||
|
||||
>LDYA ZPFileBufPtr
|
||||
jsr PrintTraceMsg
|
||||
|
||||
.3 jsr CS.FORTH.Run
|
||||
bcc .1
|
||||
|
||||
cmp #MLI.E.EOF
|
||||
beq .8
|
||||
|
||||
cmp #3
|
||||
beq .99
|
||||
|
||||
pha
|
||||
>LDA.G bExitOnEOF
|
||||
bmi .9
|
||||
|
||||
pla
|
||||
>PUSHA
|
||||
>PUSHW ZPCLBuf
|
||||
>SYSCALL GetErrorMessage
|
||||
>LDYA ZPCLBuf
|
||||
>SYSCALL PutS
|
||||
bra .1
|
||||
|
||||
* jsr PrintErrMsg
|
||||
|
||||
.9 pla
|
||||
.99 sec
|
||||
rts
|
||||
|
||||
.8 lda #0 Exit Code = Success
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.ARGS inc ArgIndex
|
||||
|
||||
lda ArgIndex
|
||||
>SYSCALL ArgV
|
||||
bcs .8
|
||||
|
||||
>STYA ZPPtr1
|
||||
lda (ZPPtr1)
|
||||
cmp #'-'
|
||||
bne .4
|
||||
|
||||
ldy #1
|
||||
lda (ZPPtr1),y
|
||||
|
||||
ldx #OptionVars-OptionList-1
|
||||
|
||||
.1 cmp OptionList,x
|
||||
beq .2
|
||||
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
bra .90
|
||||
|
||||
.2 ldy OptionVars,x
|
||||
lda #$ff
|
||||
sta (pData),y
|
||||
bra CS.RUN.ARGS
|
||||
|
||||
.4 >LDA.G hFileBuf
|
||||
bne .90
|
||||
|
||||
>LDYA ZPPtr1
|
||||
jsr CS.RUN.LoadFile
|
||||
bcs .9
|
||||
|
||||
>STA.G hFileBuf
|
||||
bra CS.RUN.ARGS
|
||||
|
||||
.8 clc
|
||||
.9 rts
|
||||
|
||||
.90 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
|
||||
lda #E.SYN
|
||||
sec QUIT Process
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.FORTH.Run >LDA.G hFileBuf
|
||||
bne CS.FORTH.Run.File
|
||||
|
||||
jsr CL.Reset
|
||||
|
||||
lda #80
|
||||
sta CL.MaxCnt
|
||||
|
||||
jsr PrintPrompt
|
||||
bcs .9
|
||||
|
||||
.1 >SYSCALL GetChar
|
||||
bcs .9 I/O error
|
||||
|
||||
.2 cmp #3 Ctrl-C
|
||||
beq .9 CS
|
||||
|
||||
jsr CL.CHARIN
|
||||
|
||||
bit CL.bReady Something to execute ?
|
||||
bpl .1
|
||||
|
||||
>PUSHW L.MSG.PROMPTCRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
|
||||
jmp CS.RUN.EXEC
|
||||
|
||||
.9 rts
|
||||
|
||||
CS.FORTH.Run.File
|
||||
lda (ZPFileBufPtr)
|
||||
beq .8
|
||||
|
||||
ldy #$ff
|
||||
|
||||
.3 iny
|
||||
lda (ZPFileBufPtr),y
|
||||
sta (ZPCLBuf),y
|
||||
beq .4
|
||||
|
||||
eor #C.CR
|
||||
bne .3
|
||||
|
||||
sta (ZPCLBuf),y
|
||||
|
||||
iny
|
||||
|
||||
.4 tya
|
||||
|
||||
clc
|
||||
adc ZPFileBufPtr
|
||||
sta ZPFileBufPtr
|
||||
bcc .5
|
||||
|
||||
inc ZPFileBufPtr+1
|
||||
|
||||
.5 lda (ZPCLBuf)
|
||||
beq CS.FORTH.Run.File
|
||||
|
||||
cmp #'#'
|
||||
beq CS.FORTH.Run.File
|
||||
|
||||
>LDYA ZPCLBuf
|
||||
>STYA ZPCLBufPtr
|
||||
|
||||
jmp CS.RUN.EXEC
|
||||
|
||||
.8 lda #MLI.E.EOF
|
||||
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.EXEC lda (ZPCLBufPtr)
|
||||
beq .8
|
||||
|
||||
.1 jsr KW.Lookup
|
||||
bcs .2
|
||||
|
||||
tya
|
||||
jsr NextKW
|
||||
|
||||
jsr .7
|
||||
bcc CS.RUN.EXEC
|
||||
|
||||
rts
|
||||
|
||||
.2 >PUSHB.G hSList
|
||||
>PUSHW ZPCLBufPtr
|
||||
>SYSCALL SListLookup
|
||||
bcs .5
|
||||
|
||||
>STYA ZPKeyID
|
||||
|
||||
>PUSHB.G hSList
|
||||
>PUSHW ZPKeyID
|
||||
>PUSHWI ZPAddrPtr
|
||||
>PUSHWI 4 4 bytes
|
||||
>PUSHWZ From Start
|
||||
|
||||
>SYSCALL SListGetData
|
||||
bcs .9
|
||||
|
||||
jmp (ZPCodePtr)
|
||||
|
||||
.8 clc
|
||||
.9 rts
|
||||
|
||||
.5 >PUSHW ZPCLBufPtr
|
||||
>PUSHWI ZPCLBufPtr
|
||||
>PUSHBI 10
|
||||
>SYSCALL StrToL
|
||||
bcs .9
|
||||
|
||||
ldy #2
|
||||
lda (pStack)
|
||||
sta (pStack),y
|
||||
|
||||
inc pStack
|
||||
|
||||
lda (pStack)
|
||||
sta (pStack),y
|
||||
|
||||
inc pStack
|
||||
|
||||
.6 jsr NextChar Skip SPACE if any
|
||||
beq .8
|
||||
|
||||
jmp .1
|
||||
|
||||
.7 txa
|
||||
asl
|
||||
tax
|
||||
|
||||
jmp (J.KEYWORDS,x)
|
||||
*--------------------------------------
|
||||
CS.RUN.LoadFile >PUSHYA
|
||||
>PUSHBI O.RDONLY
|
||||
>PUSHBI S.FI.T.TXT
|
||||
>PUSHWZ Aux type
|
||||
>SYSCALL LoadTxtFile
|
||||
bcs .9
|
||||
|
||||
phx
|
||||
txa
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPFileBuf
|
||||
>STYA ZPFileBufPtr
|
||||
pla
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.DOEVENT sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.QUIT >LDA.G hSList
|
||||
beq .1
|
||||
|
||||
>PUSHA
|
||||
>SYSCALL SListFree
|
||||
|
||||
.1 ldy #hFileBuf
|
||||
jsr .7
|
||||
|
||||
ldy #hUsrBuf
|
||||
jsr .7
|
||||
|
||||
ldy #hCLBuf
|
||||
|
||||
.7 lda (pData),y
|
||||
beq .8
|
||||
|
||||
>SYSCALL FreeMem
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintPrompt >PUSHW L.MSG.PROMPT
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintErrMsg >LDYA ZPFileBuf
|
||||
>STYA ZPPtr1
|
||||
|
||||
stz ZPPtr2
|
||||
stz ZPPtr2+1 Line counter
|
||||
|
||||
.1 inc ZPPtr2
|
||||
bne .2
|
||||
inc ZPPtr2+1
|
||||
|
||||
.2 >LDYA ZPPtr1
|
||||
>STYA ZPPtr3 save line start
|
||||
|
||||
.20 lda (ZPPtr1)
|
||||
beq .4 EoF
|
||||
|
||||
inc ZPPtr1
|
||||
bne .3
|
||||
inc ZPPtr1+1
|
||||
.3 cmp #C.CR
|
||||
bne .20 Scan until EoL
|
||||
|
||||
ldx ZPPtr1
|
||||
cpx ZPFileBufPtr
|
||||
lda ZPPtr1+1
|
||||
sbc ZPFileBufPtr+1
|
||||
bcc .1 not this line....
|
||||
|
||||
.4 >LDA.G bTrace
|
||||
bmi .5
|
||||
|
||||
jsr PrintTraceMsg.3
|
||||
|
||||
.5 lda ZPPtr3
|
||||
cmp ZPFileBufPtr
|
||||
bne .6
|
||||
|
||||
lda ZPPtr3+1
|
||||
cmp ZPFileBufPtr+1
|
||||
beq .8
|
||||
|
||||
.6 >PUSHBI '-'
|
||||
ldy #S.PS.hStdErr
|
||||
lda (pPS),y
|
||||
>SYSCALL FPutC
|
||||
inc ZPPtr3
|
||||
bne .5
|
||||
inc ZPPtr3+1
|
||||
bra .5
|
||||
|
||||
.8 ldy #S.PS.hStdErr
|
||||
lda (pPS),y
|
||||
>PUSHA
|
||||
>PUSHW L.MSG.ERR
|
||||
>PUSHW ZPPtr2 Line counter
|
||||
>PUSHBI 2
|
||||
>SYSCALL FPrintF
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintDebugMsg
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintTraceMsg >STYA ZPPtr3
|
||||
|
||||
PrintTraceMsg.3 >PUSHBI '>'
|
||||
ldy #S.PS.hStdErr
|
||||
lda (pPS),y
|
||||
>SYSCALL FPutC
|
||||
|
||||
ldy #$ff
|
||||
|
||||
.1 iny
|
||||
lda (ZPPtr3),y
|
||||
beq .8
|
||||
|
||||
cmp #C.CR
|
||||
beq .8
|
||||
|
||||
phy
|
||||
>PUSHA
|
||||
ldy #S.PS.hStdErr
|
||||
lda (pPS),y
|
||||
>SYSCALL FPutC
|
||||
ply
|
||||
bra .1
|
||||
|
||||
.8 ldy #S.PS.hStdErr
|
||||
lda (pPS),y
|
||||
>PUSHA
|
||||
|
||||
>PUSHW L.MSG.ECHOCRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL FPrintF
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CheckLFAfterCR ldy #S.PS.hStdIn Check for any extra LF
|
||||
lda (pPS),y
|
||||
>SYSCALL FEOF
|
||||
bcs .9
|
||||
|
||||
tay
|
||||
bne .9
|
||||
>SYSCALL GetChar
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
IncPtr1 inc ZPPtr1
|
||||
bne IncPtr1.8
|
||||
inc ZPPtr1+1
|
||||
IncPtr1.8 rts
|
||||
*--------------------------------------
|
||||
NextKW clc
|
||||
adc ZPCLBufPtr
|
||||
sta ZPCLBufPtr
|
||||
bcc NextCharNB
|
||||
inc ZPCLBufPtr+1
|
||||
*--------------------------------------
|
||||
NextCharNB lda (ZPCLBufPtr)
|
||||
beq .8
|
||||
|
||||
jsr IsSpaceOrCR
|
||||
bcs .8
|
||||
|
||||
inc ZPCLBufPtr
|
||||
bne NextCharNB
|
||||
inc ZPCLBufPtr+1
|
||||
bra NextCharNB
|
||||
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
NextChar lda (ZPCLBufPtr)
|
||||
beq .8
|
||||
|
||||
inc ZPCLBufPtr
|
||||
bne .8
|
||||
|
||||
inc ZPCLBufPtr+1
|
||||
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
ToUpperCase cmp #'a'
|
||||
bcc .8
|
||||
|
||||
cmp #'z'+1
|
||||
bcs .8
|
||||
|
||||
eor #$20
|
||||
|
||||
.8 clc exit CC to allow Jmp to
|
||||
rts
|
||||
*--------------------------------------
|
||||
IsSpaceOrCR cmp #C.SPACE
|
||||
beq IsEndKW.8
|
||||
|
||||
cmp #C.CR
|
||||
beq IsEndKW.8
|
||||
|
||||
sec
|
||||
rts
|
||||
|
||||
IsEndKW.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
PUSHADDR lda ZPAddrPtr+1
|
||||
>PUSHA
|
||||
lda ZPAddrPtr
|
||||
>PUSHA
|
||||
rts
|
||||
*--------------------------------------
|
||||
CheckStackPop4 lda pStack
|
||||
sec
|
||||
sbc #4
|
||||
bcc .9
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 lda #E.STACKERROR
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
.INB usr/src/bin/forth.s.cl
|
||||
.INB usr/src/bin/forth.s.kw
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
MSG.GREETINGS .AZ "\r\nA2osX-FORTH %d.%d (figForth)\r\n\r\n"
|
||||
MSG.USAGE .AS "Usage : FORTH <option> file\r\n"
|
||||
.AS " -D : Debug Mode\r\n"
|
||||
.AS " -T : Trace On"
|
||||
MSG.ECHOCRLF .AZ "\r\n"
|
||||
MSG.DEBUG .AZ "pStack=%H"
|
||||
MSG.ERR .AZ "^\r\nLine #%D:"
|
||||
MSG.PROMPT .AZ "\e[?7hOK\r\n> " Enable Line Wrap
|
||||
MSG.PROMPTCRLF .AZ "\e[?7l\r\n" Disable Line Wrap
|
||||
FMT.Byte .AZ "%d "
|
||||
FMT.int16 .AZ "%I "
|
||||
*--------------------------------------
|
||||
OptionList .AS "DdTt"
|
||||
OptionVars .DA #bDebug,#bDebug,#bTrace,#bTrace
|
||||
*--------------------------------------
|
||||
EscChars .AS 'DBAC'
|
||||
EscChars.Cnt .EQ *-EscChars
|
||||
EscChars.Remap .DA #C.BS,#C.VT,#C.LF,#C.FS
|
||||
*--------------------------------------
|
||||
KEYWORDS .AT "DUP" ( n - n n ) Duplicate top of stack.
|
||||
.AT "DROP" ( n - ) Discard top of stack.
|
||||
.AT "SWAP" ( n1 n2 - n2 n1 ) Reverse top two stack items.
|
||||
.AT "OVER" ( n1 n2 - n1 n2 n1 ) Copy second item to top.
|
||||
.AT "ROT" ( n1 n2 n3 - n2 n3 n1 ) Rotate third item to top.
|
||||
.AT "-DUP" ( n - n ? ) Duplicate only if non-zero.
|
||||
.AT ">R" ( n - ) Move top item to return stack.
|
||||
.AT "R>" ( - n ) Retrieve item from return stack.
|
||||
.AT "R" ( - n ) Copy top of return stack onto stack.
|
||||
.AT "+" ( n1 n2 - sum ) Add.
|
||||
.AT "D+" ( d1 d2 - sum ) Add double-precision numbers.
|
||||
.AT "-" ( n1 n2 - diff ) Subtract (n1-n2).
|
||||
.AT "*" ( n1 n2 - prod ) Multiply.
|
||||
.AT "/" ( n1 n2 - quot ) Divide (n1/n2).
|
||||
.AT "MOD" ( n1 n2 - rem ) Modulo (remainder from division).
|
||||
.AT "/MOD" ( n1 n2 - rem quot ) Divide, giving remainder and quotient.
|
||||
.AT "*/MOD" ( n1 n2 - rem quot ) Multiply, then divide (n1*n2/n3), with double-precision intermediate.
|
||||
.AT "*/" ( n1 n2 - quot ) Like */MOD, but give quotient only.
|
||||
.AT "MAX" ( n1 n2 - max ) Maximum.
|
||||
.AT "MIN" ( n1 n2 - min ) Minimum.
|
||||
.AT "ABS" ( n - absolute ) Absolute value.
|
||||
.AT "DABS" ( d - absolute ) Absolute value of double-precision number.
|
||||
.AT "MINUS" ( n - -n ) Change sign.
|
||||
.AT "DMINUS" ( d - -d ) Change sign of double-precision number.
|
||||
.AT "AND" ( n1 n2 - and ) Logical bitwise AND.
|
||||
.AT "OR" ( n1 n2 - or ) Logical bitwise OR.
|
||||
.AT "XOR" ( n1 n2 - xor ) Logical bitwise exclusive OR.
|
||||
.AT "<" ( n1 n2 - f ) True if n1 less than n2.
|
||||
.AT ">" ( n1 n2 - f ) True if n1 greater than n2.
|
||||
.AT "=" ( n1 n2 - f ) True if n1 equal to n2.
|
||||
.AT "0<" ( n - f ) True if top number negative.
|
||||
.AT "0=" ( n - f ) True if top number zero.
|
||||
*--------------------------------------
|
||||
.AT "." ( n - ) Print number.
|
||||
.AT ".R" ( n u - ) Print number, right-justified in u column.
|
||||
.AT "D." ( d - ) Print double-precision number.
|
||||
.AT "D.R" ( d u - ) Print double-precision number in u column.
|
||||
.AT "CR" ( - ) Do a carriage-return.
|
||||
.AT "SPACE" ( - ) Type one space.
|
||||
.AT "SPACES" ( u - ) Type u spaces.
|
||||
.AT '."' ( - ) Print message (terminated by ").
|
||||
.AT "DUMP" ( addr u - ) Dump u numbers starting at address.
|
||||
.AT "TYPE" ( addr u - ) Type u characters starting at address.
|
||||
.AT "COUNT" ( addr - addr+1 u ) Change length byte string to TYPE form.
|
||||
.AT "?TERMINAL" ( - f ) True if terminal break request present.
|
||||
.AT "KEY" ( - c ) Read key, put ASCII value on stack.
|
||||
.AT "EMIT" ( c - ) Type ASCII character from stack.
|
||||
.AT "EXPECT" ( addr u - ) Read u characters (or until carriage-return) from input device to address.
|
||||
.AT "WORD" ( c - ) Read one word from input stream, delimited by c.
|
||||
.AT "NUMBER" ( addr - d ) Convert string at address to double number.
|
||||
.AT "<#" ( - ) Start output string.
|
||||
.AT "#" ( d1 - d2 ) Convert one digit of double number and add character to output string.
|
||||
.AT "#S" ( d - 0 0 ) Convert all significant digits of double number to output string.
|
||||
.AT "SIGN" ( n d - d ) Insert sign of n to output string.
|
||||
.AT "#>" ( d - addr u ) Terminate output string for TYPE.
|
||||
.AT "HOLD" ( c - ) Insert ASCII character into output string.
|
||||
.AT "DECIMAL" ( - ) Set decimal base.
|
||||
.AT "HEX" ( - ) Set hexadecimal base.
|
||||
.AT "OCTAL" ( - ) Set octal base.
|
||||
*--------------------------------------
|
||||
.AT "@" ( addr - n ) Replace word address by contents.
|
||||
.AT "!" ( n addr - ) Store second word at address on top.
|
||||
.AT "C@" ( addr - b ) Fetch one byte only.
|
||||
.AT "C!" ( b addr - ) Store one byte only.
|
||||
.AT "?" ( addr - ) Print contents of address.
|
||||
.AT "+!" ( n addr - ) Add second number to contents of address.
|
||||
.AT "CMOVE" ( from to u - ) Move u bytes in memory.
|
||||
.AT "FILL" ( addr u b - ) Fill u bytes in memory with b beginning at address.
|
||||
.AT "ERASE" ( addr u - ) Fill u bytes in memory with zeros.
|
||||
.AT "BLANKS" ( addr u - ) Fill u bytes in memory with blanks.
|
||||
.AT "HERE" ( - addr ) Return address above dictionary.
|
||||
.AT "PAD" ( - addr ) Return address of scratch area.
|
||||
.AT "ALLOT" ( u - ) Leave a gap of n bytes in the dictionary.
|
||||
.AT "," ( n - ) Compile number n into the dictionary.
|
||||
.AT "'" ( - addr ) Find address of next string in dictionary.
|
||||
.AT "FORGET" ( - ) Delete all definitions above and including the following definition.
|
||||
.AT "DEFINITIONS" ( - ) Set current vocabulary to context vocabulary.
|
||||
.AT "VOCABULARY" ( - ) Create new vocabulary.
|
||||
.AT "FORTH" ( - ) Set context vocabulary to Forth vocabulary.
|
||||
.AT "EDITOR" ( - ) Set context vocabulary to Editor vocabulary.
|
||||
.AT "ASSEMBLER" ( - ) Set context vocabulary to Assembler.
|
||||
.AT "VLIST" ( - ) Print names in context vocabulary.
|
||||
*--------------------------------------
|
||||
.AT ":" ( - ) Begin a colon definition.
|
||||
.AT ";" ( - ) End of a colon definition.
|
||||
.AT "VARIABLE" ( n - ) Create a variable with initial value n.
|
||||
* ( - addr ) Return address when executed.
|
||||
.AT "CONSTANT" ( n - ) Create a constant with value n.
|
||||
* ( - n ) Return the value n when executed.
|
||||
.AT "CODE" ( - ) Create assembly-language definition.
|
||||
.AT ";CODE" ( - ) Create a new defining word, with runtime code routine in high-level Forth.
|
||||
.AT "DO" ( end+1 start - ) Set up loop, given index range.
|
||||
.AT "LOOP" ( - ) Increment index, terminate loop if equal to limit.
|
||||
.AT "+LOOP" ( n - ) Increment index by n. Terminate loop if outside limit.
|
||||
.AT "I" ( - index ) Place loop index on stack.
|
||||
.AT "LEAVE" ( - ) Terminate loop at next LOOP or +LOOP.
|
||||
.AT "IF" ( f - ) If top of stack is true, execute true clause.
|
||||
.AT "ELSE" ( - ) Beginning of the false clause.
|
||||
.AT "ENDIF" ( - ) End of the IF-ELSE structure.
|
||||
.AT "BEGIN" ( - ) Start an indefinite loop.
|
||||
.AT "UNTIL" ( f - ) Loop back to BEGIN until f is true.
|
||||
.AT "REPEAT" ( - ) Loop back to BEGIN unconditionally.
|
||||
.AT "WHILE" ( f - ) Exit loop immediately if f is false.
|
||||
*--------------------------------------
|
||||
.AT "(" ( - ) Begin comment, terminated by ).
|
||||
*--------------------------------------
|
||||
.DA #0
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR 0
|
||||
DS.START
|
||||
bDebug .BS 1
|
||||
bTrace .BS 1
|
||||
bExitOnEOF .BS 1
|
||||
hCLBuf .BS 1
|
||||
hPadBuf .BS 1
|
||||
hUsrBuf .BS 1
|
||||
UsrBuf .BS 2
|
||||
hFileBuf .BS 1
|
||||
hSList .BS 1
|
||||
|
||||
DS.END .ED
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/bin/forth.s
|
||||
ASM
|
@ -144,7 +144,21 @@ CS.RUN.WAIT >PUSHW L.MSG.SHUTDOWN
|
||||
|
||||
.1 >SLEEP
|
||||
|
||||
lda bSec
|
||||
ldy #S.PS.hStdIn
|
||||
lda (pPS),y
|
||||
>SYSCALL FEOF
|
||||
bcs .2
|
||||
|
||||
tay
|
||||
bne .2 CC
|
||||
|
||||
>SYSCALL GetChar
|
||||
bcs .9
|
||||
|
||||
cmp #$03 Ctrl-C
|
||||
beq .9 CS
|
||||
|
||||
.2 lda bSec
|
||||
bpl .1
|
||||
|
||||
stz bSec
|
||||
@ -157,7 +171,7 @@ CS.RUN.WAIT >PUSHW L.MSG.SHUTDOWN
|
||||
>SYSCALL PrintF
|
||||
|
||||
clc
|
||||
rts
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.RUN.PS stz Count
|
||||
|
||||
@ -348,7 +362,7 @@ CS.QUIT clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
MSG.USAGE .AS "Usage : SHUTDOWN <NEXT.STSTEM>\r\n"
|
||||
MSG.USAGE .AS "Usage : SHUTDOWN <NEXT.SYSTEM>\r\n"
|
||||
.AS " -R : Restart System\r\n"
|
||||
.AS " -T <seconds> : default to 60"
|
||||
MSG.CRLF .AZ "\r\n"
|
||||
|
270
BIN/UNAME.S.txt
Normal file
270
BIN/UNAME.S.txt
Normal file
@ -0,0 +1,270 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF bin/uname
|
||||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/a2osx.i
|
||||
.INB inc/mli.e.i
|
||||
.INB inc/kernel.i
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPBIN
|
||||
ZS.START
|
||||
ZPPtr1 .BS 2
|
||||
ZPPtr2 .BS 2
|
||||
|
||||
Index .BS 1
|
||||
Count .BS 1
|
||||
|
||||
bHostName .BS 1
|
||||
bMachineType .BS 1
|
||||
bCPUType .BS 1
|
||||
bCPUSpeed .BS 1
|
||||
bAltCPU .BS 1
|
||||
bKernelVersion .BS 1
|
||||
bKernelMode .BS 1
|
||||
bKernelClk .BS 1
|
||||
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 #32 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.USAGE .DA MSG.USAGE
|
||||
L.MSG.CRLF .DA MSG.CRLF
|
||||
L.TYPES .DA TYPE.UNKNOWN
|
||||
.DA TYPE.IIe
|
||||
.DA TYPE.IIc
|
||||
.DA TYPE.IIgs
|
||||
L.CPUS .DA CPU.65C02
|
||||
.DA CPU.65R02
|
||||
.DA CPU.65816
|
||||
L.CPU.SPEED .DA CPU.SPEED
|
||||
L.KERNEL.VER .DA KERNEL.VER
|
||||
L.KERNEL.MODES .DA KERNEL.POLLING
|
||||
.DA KERNEL.IRQ
|
||||
.DA KERNEL.PREEMPT
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN ldy #S.PS.ARGC
|
||||
lda (pPS),y
|
||||
beq .8
|
||||
|
||||
.1 inc Index
|
||||
lda Index
|
||||
>SYSCALL ArgV
|
||||
bcs CS.RUN.PRINT
|
||||
|
||||
>STYA ZPPtr1
|
||||
lda (ZPPtr1)
|
||||
cmp #'-'
|
||||
bne .99
|
||||
|
||||
ldy #1
|
||||
lda (ZPPtr1),y
|
||||
beq .99
|
||||
|
||||
jsr CS.RUN.CheckOpt
|
||||
bcc .1
|
||||
|
||||
.99 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
|
||||
.8 lda #$ff
|
||||
sta bKernelVersion
|
||||
sta bKernelMode
|
||||
sta bMachineType
|
||||
sta bCPUType
|
||||
sta bCPUSpeed
|
||||
*--------------------------------------
|
||||
CS.RUN.PRINT bit bHostName
|
||||
bpl .1
|
||||
|
||||
|
||||
|
||||
.1 bit bMachineType
|
||||
bpl .2
|
||||
|
||||
lda A2osX.HWType
|
||||
asl
|
||||
tax
|
||||
|
||||
>LDYA L.TYPES,x
|
||||
jsr CS.RUN.PRINTYA
|
||||
|
||||
.2 bit bCPUType
|
||||
bpl .3
|
||||
|
||||
lda A2osX.CPUTYPE
|
||||
|
||||
asl
|
||||
and #$0F
|
||||
tax
|
||||
|
||||
>LDYA L.CPUS-2,x
|
||||
jsr CS.RUN.PRINTYA
|
||||
|
||||
.3 bit bCPUSpeed
|
||||
bpl .4
|
||||
|
||||
>PUSHW L.CPU.SPEED
|
||||
>PUSHW A2osX.CPUSPEED
|
||||
>PUSHBI 2
|
||||
jsr CS.RUN.PRINTF
|
||||
|
||||
.4 bit bAltCPU
|
||||
bpl .5
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.5 bit bKernelVersion
|
||||
bpl .6
|
||||
|
||||
>PUSHW L.KERNEL.VER
|
||||
>PUSHW A2osX.KVER
|
||||
>PUSHBI 2
|
||||
jsr CS.RUN.PRINTF
|
||||
|
||||
.6 bit bKernelMode
|
||||
bpl .7
|
||||
|
||||
ldx #0
|
||||
bit A2osX.IRQMode
|
||||
bpl .60
|
||||
|
||||
inx
|
||||
inx
|
||||
bit A2osX.F
|
||||
bvc .60
|
||||
|
||||
inx
|
||||
inx
|
||||
|
||||
.60 >LDYA L.KERNEL.MODES,x
|
||||
jsr CS.RUN.PRINTYA
|
||||
|
||||
.7 bit bKernelClk
|
||||
bpl .8
|
||||
|
||||
|
||||
.8 >PUSHW L.MSG.CRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
|
||||
|
||||
lda #0
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.PRINTYA >PUSHYA
|
||||
>PUSHBI 0
|
||||
|
||||
CS.RUN.PRINTF lda Count
|
||||
beq .1
|
||||
|
||||
lda #C.SPACE
|
||||
>SYSCALL PutChar
|
||||
|
||||
.1 >SYSCALL PrintF
|
||||
|
||||
inc Count
|
||||
|
||||
CS.DOEVENT sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.QUIT
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.CheckOpt ldy #1
|
||||
lda (ZPPtr1),y
|
||||
|
||||
ldx #OptionVars-OptionList-1
|
||||
|
||||
.2 cmp OptionList,x
|
||||
beq .3
|
||||
|
||||
dex
|
||||
bpl .2
|
||||
|
||||
sec
|
||||
rts
|
||||
|
||||
.3 ldy OptionVars,x
|
||||
ldx #$ff
|
||||
stx 0,y
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
OptionList .AS "HhMmCcSsAaVvKkZz"
|
||||
OptionVars .DA #bHostName,#bHostName
|
||||
.DA #bMachineType,#bMachineType
|
||||
.DA #bCPUType,#bCPUType
|
||||
.DA #bCPUSpeed,#bCPUSpeed
|
||||
.DA #bAltCPU,#bAltCPU
|
||||
.DA #bKernelVersion,#bKernelVersion
|
||||
.DA #bKernelMode,#bKernelMode
|
||||
.DA #bKernelClk,#bKernelClk
|
||||
*--------------------------------------
|
||||
MSG.USAGE .AS "Usage : UNAME\r\n"
|
||||
.AS " -H : Hostname\r\n"
|
||||
.AS " -M : Machine Type/SubType\r\n"
|
||||
.AS " -C : CPU Type\r\n"
|
||||
.AS " -S : CPU Speed\r\n"
|
||||
.AS " -A : Alternate CPU\r\n"
|
||||
.AS " -V : Kernel Version\r\n"
|
||||
.AS " -K : Kernel Mode\r\n"
|
||||
.AS " -Z : Kernel Timing\r\n"
|
||||
MSG.CRLF .AZ "\r\n"
|
||||
TYPE.UNKNOWN .AZ "Unknown_HW"
|
||||
TYPE.IIe .AZ "Apple//e"
|
||||
TYPE.IIc .AZ "Apple//c"
|
||||
TYPE.IIgs .AZ "AppleIIgs"
|
||||
CPU.65C02 .AZ "65c02"
|
||||
CPU.65R02 .AZ "65r02"
|
||||
CPU.65816 .AZ "65816"
|
||||
CPU.SPEED .AZ "%d.%02dmhz"
|
||||
KERNEL.VER .AZ "A2osX_%d.%02d"
|
||||
KERNEL.POLLING .AZ "Polling_Mode"
|
||||
KERNEL.IRQ .AZ "IRQ_Mode"
|
||||
KERNEL.PREEMPT .AZ "Preemptive_Mode"
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR 0
|
||||
DS.START
|
||||
DS.END .ED
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/bin/uname.s
|
||||
ASM
|
@ -58,7 +58,11 @@ A2osX.SLEEP .EQ $BC10
|
||||
*--------------------------------------
|
||||
A2osX.SCRNDEVS .EQ $BED0 0=console, 1-8=VT100, 9=GFX
|
||||
A2osX.ASCREEN .EQ $BEDA Active Screen
|
||||
* free BEDB -> BEE5
|
||||
* free BEDB -> BEDF
|
||||
A2osX.KVER .EQ $BEE0
|
||||
A2osX.IRQMode .EQ $BEE3
|
||||
|
||||
A2osX.FSID .EQ $BEE5
|
||||
A2osX.CPUTYPE .EQ $BEE6
|
||||
A2osX.CPUSPEED .EQ $BEE7 WORD, (->255.99 Mhz)
|
||||
|
||||
|
@ -2,10 +2,10 @@ NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
IO.D2.SeekTimeR .EQ 140 LIBBLKDEV Recalibration
|
||||
IO.D2.SeekTimeF .EQ 140 LIBBLKDEV Track Formatter
|
||||
IO.D2.SeekTimeB .EQ 140 LIBBLKDEV Boot Block
|
||||
IO.D2.SeekTimeP .EQ 60 ProDOS.FX initial
|
||||
IO.D2.SeekTimeI .EQ 20 ProDOS.FX increment -> until > 128
|
||||
IO.D2.SeekTimeF .EQ 68 LIBBLKDEV Track Formatter
|
||||
IO.D2.SeekTimeB .EQ 68 LIBBLKDEV Boot Block
|
||||
IO.D2.SeekTimeP .EQ 68 ProDOS.FX initial
|
||||
IO.D2.SeekTimeI .EQ 10 ProDOS.FX increment -> until > 128
|
||||
*--------------------------------------
|
||||
IO.D2.Ph0Off .EQ $C080
|
||||
IO.D2.Ph0On .EQ $C081
|
||||
|
@ -239,6 +239,9 @@ goread lda iobuff
|
||||
sta buff+1
|
||||
jmp (dent)
|
||||
*--------------------------------------
|
||||
BB.PhX .HS 00
|
||||
BB.Phy .HS 0002020404060600
|
||||
*--------------------------------------
|
||||
mods .DA #mod1,#mod2,#mod3,#mod4,#mod5,#mod6,#mod7,#mod8,#mod8+1,#mod9
|
||||
mods.cnt .EQ *-mods
|
||||
chgs .DA #chg1,#chg2,#chg3,#chg4,#chg5,#chg6,#chg7,#$91,#BB.HdrPtr,#BB.HdrTrk
|
||||
@ -320,47 +323,21 @@ BB.Seek lda BB.HdrTrk get track we're on
|
||||
.2 dec
|
||||
|
||||
sta BB.CurrentQTrack
|
||||
|
||||
pha
|
||||
|
||||
and #6
|
||||
and #7
|
||||
tax
|
||||
lda BB.PhY,x
|
||||
ora BB.Slotn0
|
||||
tay
|
||||
lda BB.PhX,x
|
||||
ora BB.Slotn0
|
||||
tax
|
||||
|
||||
pla
|
||||
|
||||
bcs .3
|
||||
|
||||
* Current < Target, must move in
|
||||
|
||||
inc
|
||||
|
||||
.HS B0 BCS
|
||||
|
||||
* Current > Target, must move out
|
||||
|
||||
.3 dec
|
||||
|
||||
and #6
|
||||
ora BB.Slotn0
|
||||
|
||||
bcc .4
|
||||
|
||||
* move out : invert 2 phases
|
||||
|
||||
phx
|
||||
tax
|
||||
pla
|
||||
|
||||
.4 tay
|
||||
|
||||
|
||||
php
|
||||
sei
|
||||
lda IO.D2.Ph0On,x
|
||||
nop
|
||||
nop
|
||||
|
||||
lda IO.D2.Ph0On,y
|
||||
nop
|
||||
nop
|
||||
plp
|
||||
|
||||
lda #IO.D2.SeekTimeB
|
||||
jsr BB.Wait
|
||||
@ -376,32 +353,23 @@ BB.Seek lda BB.HdrTrk get track we're on
|
||||
jsr BB.PhasesOff
|
||||
bra BB.Read
|
||||
*--------------------------------------
|
||||
BB.PhasesOff bit IO.D2.Ph0Off,x
|
||||
nop
|
||||
nop
|
||||
|
||||
BB.PhasesOff php
|
||||
sei
|
||||
bit IO.D2.Ph0Off,x
|
||||
ldx IO.D2.Ph0Off,y
|
||||
nop
|
||||
nop
|
||||
plp
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
BB.Wait phx (3)
|
||||
|
||||
.1 ldx #17 (2)
|
||||
.1 ldx #20 (2)
|
||||
|
||||
.2 dex (2) delay 86 usec.
|
||||
bne .2 (2+) 2 + 5x17 + 2 + 2
|
||||
|
||||
ldx BB.Slotn0 (3)
|
||||
bit IO.D2.DrvOn,x (4) Slow down ACC boards
|
||||
|
||||
* sec (2)
|
||||
* sbc #1 (2)
|
||||
.2 dex (2)
|
||||
bne .2 (3)
|
||||
|
||||
dec (2)
|
||||
|
||||
bne .1 (2+)
|
||||
bne .1 (3)
|
||||
|
||||
plx (4)
|
||||
|
||||
|
@ -24,28 +24,30 @@ D2Recalibrate >PULLB DrvSlt
|
||||
jsr CheckDiskII
|
||||
bcs .9
|
||||
|
||||
ldx Slotn0
|
||||
ldy Slotn0
|
||||
|
||||
lda IO.D2.DrvOn,x
|
||||
lda IO.D2.DrvOn,y
|
||||
nop
|
||||
nop
|
||||
|
||||
ldy #168
|
||||
lda #168
|
||||
|
||||
.1 lda IO.D2.Ph0Off,x
|
||||
.1 sta IO.D2.Ph0Off,y
|
||||
|
||||
dey
|
||||
dey
|
||||
dec
|
||||
dec
|
||||
|
||||
tya
|
||||
pha
|
||||
|
||||
and #6
|
||||
ora Slotn0
|
||||
tax
|
||||
lda IO.D2.Ph0On,x
|
||||
tay
|
||||
sta IO.D2.Ph0On,y
|
||||
|
||||
lda #IO.D2.SeekTimeR
|
||||
jsr D2.Wait100usecA
|
||||
|
||||
tya
|
||||
pla
|
||||
bne .1
|
||||
|
||||
jsr D2.Wait25600usec
|
||||
@ -65,109 +67,109 @@ D2MoveHead >PULLB MoveTo
|
||||
jsr CheckDiskII
|
||||
bcs .9
|
||||
|
||||
ldx Slotn0
|
||||
ldy Slotn0
|
||||
|
||||
.1 lda MoveFrom
|
||||
lda MoveFrom
|
||||
cmp MoveTo
|
||||
beq .7
|
||||
beq .9
|
||||
|
||||
jsr .8
|
||||
|
||||
bcs .2
|
||||
php
|
||||
sei
|
||||
|
||||
* Current < Target, must move in
|
||||
|
||||
inc
|
||||
|
||||
.HS B0 BCS
|
||||
|
||||
* Current > Target, must move out
|
||||
|
||||
.2 dec
|
||||
|
||||
sta MoveFrom
|
||||
|
||||
pha
|
||||
|
||||
bcs .10
|
||||
|
||||
and #6
|
||||
ora Slotn0
|
||||
tax
|
||||
|
||||
pla
|
||||
|
||||
bcs .3
|
||||
|
||||
* Current < Target, must move in
|
||||
|
||||
inc
|
||||
|
||||
.HS B0 BCS
|
||||
|
||||
* Current > Target, must move out
|
||||
|
||||
.3 dec
|
||||
|
||||
and #6
|
||||
.10 and #6
|
||||
ora Slotn0
|
||||
|
||||
bcc .4
|
||||
|
||||
* move out : invert 2 phases
|
||||
|
||||
phx
|
||||
tax
|
||||
pla
|
||||
|
||||
.4 tay
|
||||
|
||||
ora #$80
|
||||
sta .7+1
|
||||
stz .6+1
|
||||
|
||||
lda IO.D2.Ph0On,x
|
||||
nop
|
||||
nop
|
||||
* lda #IO.D2.SeekTimeF
|
||||
* jsr D2.Wait100usecA
|
||||
|
||||
lda IO.D2.Ph0On,y
|
||||
pla
|
||||
|
||||
.1 bcc .2
|
||||
|
||||
* Current > Target, must move out
|
||||
|
||||
dec
|
||||
|
||||
.HS 90 BCC
|
||||
|
||||
* Current < Target, must move in
|
||||
|
||||
.2 inc
|
||||
|
||||
sta MoveFrom
|
||||
|
||||
and #7
|
||||
tay
|
||||
|
||||
bcs .3
|
||||
|
||||
lda D2.PhIn,y
|
||||
|
||||
bcc .4
|
||||
|
||||
.3 lda D2.PhOut,y
|
||||
|
||||
.4 ora Slotn0
|
||||
sta .5+1
|
||||
|
||||
lsr
|
||||
bcc .5
|
||||
|
||||
asl
|
||||
|
||||
ldx .7+1
|
||||
stx .6+1
|
||||
|
||||
sta .7+1
|
||||
|
||||
.5 sta $C000
|
||||
nop
|
||||
nop
|
||||
|
||||
lda #IO.D2.SeekTimeF
|
||||
jsr D2.Wait100usecA
|
||||
|
||||
bra .1
|
||||
lda MoveFrom
|
||||
cmp MoveTo
|
||||
bne .1
|
||||
|
||||
.7 jsr D2.Wait25600usec
|
||||
|
||||
clc
|
||||
|
||||
.8 bit IO.D2.Ph0Off,x
|
||||
jsr D2.Wait25600usec
|
||||
|
||||
.6 sta $C000
|
||||
nop
|
||||
nop
|
||||
|
||||
ldx IO.D2.Ph0Off,y
|
||||
.7 sta $C000
|
||||
nop
|
||||
nop
|
||||
|
||||
.9 rts
|
||||
plp
|
||||
|
||||
.9 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
D2.Wait25600usec
|
||||
lda #0
|
||||
|
||||
D2.Wait100usecA
|
||||
phx (3)
|
||||
|
||||
.1 ldx #18 (2)
|
||||
.1 ldx #20 (2)
|
||||
|
||||
.2 dex (2)
|
||||
bne .2 (3)
|
||||
|
||||
ldx Slotn0 (3)
|
||||
bit IO.D2.DrvOn,x (4) Slow down ACC boards
|
||||
|
||||
sec (2)
|
||||
sbc #1 (2)
|
||||
dec (2)
|
||||
bne .1 (3)
|
||||
|
||||
plx (4)
|
||||
|
||||
rts (6)
|
||||
*/--------------------------------------
|
||||
* # D2TrkRead16s
|
||||
@ -316,7 +318,17 @@ CheckDiskII pha
|
||||
adc Slotn0
|
||||
tax
|
||||
lda $C000,x
|
||||
|
||||
|
||||
ldx Slotn0
|
||||
|
||||
lda IO.D2.ReadMode,x
|
||||
lda IO.D2.RData,x
|
||||
|
||||
lda IO.D2.Ph0Off,x
|
||||
lda IO.D2.Ph1Off,x
|
||||
lda IO.D2.Ph2Off,x
|
||||
lda IO.D2.Ph3Off,x
|
||||
|
||||
* clc
|
||||
rts
|
||||
|
||||
@ -330,8 +342,10 @@ CheckDiskII pha
|
||||
DrvSpinCheck ldy #0
|
||||
|
||||
lda IO.D2.RData,x
|
||||
|
||||
.1 cmp IO.D2.RData,x
|
||||
bne .8 spinning
|
||||
|
||||
dey
|
||||
bne .1
|
||||
|
||||
@ -346,6 +360,7 @@ PutSyncBytePtr2 lda #$7f
|
||||
.1 jsr PutBytePtr2
|
||||
dey
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
PutAddrHeadPtr2 ldy #2
|
||||
@ -354,6 +369,7 @@ PutAddrHeadPtr2 ldy #2
|
||||
jsr PutBytePtr2
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
PutDataHeadPtr2 ldy #2
|
||||
@ -362,6 +378,7 @@ PutDataHeadPtr2 ldy #2
|
||||
jsr PutBytePtr2
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
PutTailPtr2 ldy #2
|
||||
@ -370,6 +387,7 @@ PutTailPtr2 ldy #2
|
||||
jsr PutBytePtr2
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
HeaderCheckSum lda VolNum
|
||||
|
@ -22,7 +22,7 @@ TRACK16.GAP2 .EQ 6 60 bits
|
||||
*Data field = D5AAAD + 342 + CS + DEAAEB = 349 2792 bits
|
||||
TRACK16.GAP3 .EQ 17 170 bits
|
||||
* )
|
||||
* 80 + 16 * (14 + 6 + 349 + 17) = 6256 50144 bits
|
||||
* 80 + 16 * (14 + 6 + 349 + 17) = 6256 800 + 50144 bits
|
||||
*--------------------------------------
|
||||
TRACK9.LEN .EQ 6511
|
||||
*--------------------------------------
|
||||
@ -396,6 +396,24 @@ TrkWriter.Start lda IO.D2.ReadProt,x
|
||||
TrkWriter.Size .EQ *-TrkWriter.Start
|
||||
.EP
|
||||
*--------------------------------------
|
||||
D2.PhIn .DA #IO.D2.Ph3Off 7->0
|
||||
.DA #IO.D2.Ph1On 0->1
|
||||
.DA #IO.D2.Ph0Off 1->2
|
||||
.DA #IO.D2.Ph2On 2->3
|
||||
.DA #IO.D2.Ph1Off 3->4
|
||||
.DA #IO.D2.Ph3On 4->5
|
||||
.DA #IO.D2.Ph2Off 5->6
|
||||
.DA #IO.D2.Ph0On 6->7
|
||||
|
||||
D2.PhOut .DA #IO.D2.Ph1Off 1->0
|
||||
.DA #IO.D2.Ph0on 2->1
|
||||
.DA #IO.D2.Ph2off 3->2
|
||||
.DA #IO.D2.Ph1On 4->3
|
||||
.DA #IO.D2.Ph3Off 5->4
|
||||
.DA #IO.D2.Ph2On 6->5
|
||||
.DA #IO.D2.Ph0Off 7->6
|
||||
.DA #IO.D2.Ph3On 0->7
|
||||
*--------------------------------------
|
||||
ADDR.Head .HS 96AAD5
|
||||
DATA.Head .HS ADAAD5
|
||||
TAIL .HS EBAADE
|
||||
|
@ -866,6 +866,7 @@ LDR.ScrInit80 sta CLRC3ROM
|
||||
.DO LOGO
|
||||
lda #20
|
||||
sta CV
|
||||
jsr VTAB
|
||||
|
||||
lda #LOGO.PAKED
|
||||
sta ZPInBufPtr
|
||||
|
@ -4,8 +4,6 @@ NEW
|
||||
XDOS cld no decimal.
|
||||
sty mliy save x and y
|
||||
stx mlix
|
||||
* pla get processor status
|
||||
* sta spare1 save it temporarily
|
||||
|
||||
ply get processor status
|
||||
|
||||
@ -19,9 +17,6 @@ XDOS cld no decimal.
|
||||
adc #$00
|
||||
sta mliretn+1
|
||||
|
||||
* lda spare1
|
||||
* pha pull processor status
|
||||
|
||||
phy pull processor status
|
||||
plp to re-enable interrupts.
|
||||
|
||||
@ -50,11 +45,11 @@ XDOS cld no decimal.
|
||||
sta A3L+1
|
||||
pla
|
||||
sta A3L
|
||||
* ldy #$00
|
||||
|
||||
lda XDOS.ParamCnt,x make sure parameter list has the correct # of parameters.
|
||||
beq goclock clock has 0 parameters.
|
||||
|
||||
cmp (A3L) ,y
|
||||
cmp (A3L)
|
||||
bne scperr error if wrong count.
|
||||
|
||||
lda XDOS.CmdNums,x get call # again
|
||||
|
@ -1,14 +1,15 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
XRWDBG .EQ 1
|
||||
* If Called by ProDOS : SEI
|
||||
* If Called directly from DEVPTRS vectors : ????
|
||||
*--------------------------------------
|
||||
XRW.START cld $D8 to flag language card bank 1 (main)
|
||||
|
||||
lda unitnum get unit number.
|
||||
|
||||
|
||||
pha
|
||||
|
||||
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
@ -19,10 +20,11 @@ XRW.START cld $D8 to flag language card bank 1 (main)
|
||||
bne .10
|
||||
|
||||
lda #IO.D2.SeekTimeP
|
||||
sta XRW.D2SeekTime-1,x
|
||||
|
||||
.10 pla
|
||||
|
||||
|
||||
.10 sta XRW.SeekTime
|
||||
|
||||
pla
|
||||
|
||||
and #$7F mask off high bit.
|
||||
sta A2L 0SSS0000 for IO indexing
|
||||
|
||||
@ -45,7 +47,7 @@ XRW.START cld $D8 to flag language card bank 1 (main)
|
||||
|
||||
lda #1
|
||||
jsr XRW.Wait100usecA
|
||||
|
||||
|
||||
lda XRW.montimeh
|
||||
bne .1
|
||||
*--------------------------------------
|
||||
@ -75,6 +77,8 @@ L59BD lda bloknml
|
||||
|
||||
jsr XRW.CheckMotorOn
|
||||
|
||||
php SAVE IRQ STATE
|
||||
|
||||
php save motor on state : NZ if on
|
||||
|
||||
lda #$E8 24 up to 0
|
||||
@ -87,6 +91,7 @@ L59BD lda bloknml
|
||||
|
||||
asl get drive # into carry.
|
||||
bcc .3 branch if drive 1 selected.
|
||||
|
||||
inx select drive 2.
|
||||
|
||||
.3 lda IO.D2.DrvSel1,x
|
||||
@ -104,7 +109,7 @@ L59BD lda bloknml
|
||||
.4 jsr XRW.Wait25600usec 150 ms delay before stepping.
|
||||
dey
|
||||
bne .4
|
||||
|
||||
|
||||
php Z set
|
||||
|
||||
.5 plp was motor on ?
|
||||
@ -114,9 +119,9 @@ L59BD lda bloknml
|
||||
|
||||
.6 lda #1
|
||||
jsr XRW.Wait100usecA wait 100us for each count in montime
|
||||
|
||||
|
||||
lda XRW.montimeh
|
||||
bmi .6 count up to 0000
|
||||
bmi .6 count up to 0000
|
||||
|
||||
* motor should be up to speed,
|
||||
* if it looks stopped then the drive is not present
|
||||
@ -126,30 +131,34 @@ L59BD lda bloknml
|
||||
*--------------------------------------
|
||||
L538E lda A4L get command #
|
||||
bne .1
|
||||
|
||||
|
||||
jsr XRW.TestWP 0 = status
|
||||
bcs XRW.E.WP
|
||||
|
||||
bra XRW.E.OK
|
||||
bcc XRW.E.OK
|
||||
|
||||
.1 cmp #4 3 = format
|
||||
bcs XRW.E.IO
|
||||
|
||||
cmp #2 Write ?
|
||||
bne .2
|
||||
cmp #2 2 = Write, 1 = Read
|
||||
|
||||
ror XRW.bWrite b7 = 1 if Write
|
||||
bpl .2
|
||||
|
||||
jsr XRW.TestWP
|
||||
bcs XRW.E.WP
|
||||
*--------------------------------------
|
||||
.2 jsr regrwts
|
||||
.2 sei DISABLE IRQ
|
||||
|
||||
jsr XRW.SectorIO
|
||||
bcs XRW.E.IO
|
||||
|
||||
inc buf+1
|
||||
|
||||
|
||||
inc XRW.ReqSector
|
||||
inc XRW.ReqSector
|
||||
|
||||
jsr regrwts get 2nd half of block
|
||||
jsr XRW.SectorIO get 2nd half of block
|
||||
dec buf+1
|
||||
|
||||
bcc XRW.E.OK
|
||||
@ -160,49 +169,42 @@ XRW.E.WP lda #MLI.E.WRTPROT
|
||||
.HS 2C BIT ABS
|
||||
XRW.E.ND lda #MLI.E.NODEV
|
||||
|
||||
plp RESTORE IRQ STATE
|
||||
sec
|
||||
bra XRW.E.EXIT
|
||||
|
||||
.HS 2C BIT ABS
|
||||
XRW.E.OK lda #0
|
||||
XRW.E.OK plp RESTORE IRQ STATE
|
||||
clc
|
||||
lda #0
|
||||
|
||||
ldx A2L
|
||||
XRW.E.EXIT ldx A2L
|
||||
bit IO.D2.DrvOff,x turn off
|
||||
rts
|
||||
*--------------------------------------
|
||||
regrwts lda #1
|
||||
XRW.SectorIO lda #2
|
||||
sta XRW.RecalibrateCnt
|
||||
|
||||
sta XRW.BadSeek
|
||||
|
||||
lda A4L get command #
|
||||
|
||||
lsr set carry = 1 for read, 0 for write.
|
||||
bcs .1 must prenibblize for write
|
||||
|
||||
jsr XRW.PreNibble
|
||||
bit XRW.bWrite
|
||||
bpl .1
|
||||
|
||||
jsr XRW.PreNibble must prenibblize for write
|
||||
|
||||
.1 stz XRW.RetryCnt
|
||||
|
||||
.1 ldy #64
|
||||
sty XRW.RetryCnt
|
||||
|
||||
.2 jsr XRW.ReadAddr read next address field.
|
||||
bcc .4 if CC, A = current track
|
||||
|
||||
.3 dec XRW.RetryCnt one less chance.
|
||||
bne .2 branch to retry.
|
||||
.3 inc XRW.RetryCnt one less chance.
|
||||
bpl .2 branch if < 128
|
||||
|
||||
dec XRW.RecalibrateCnt
|
||||
sec
|
||||
bmi .9
|
||||
|
||||
.DO XRWDBG=1
|
||||
jsr XRW.DEBUG
|
||||
.FIN
|
||||
beq .9
|
||||
|
||||
ldx XRW.UnitIndex
|
||||
|
||||
lda #41
|
||||
sta XRW.D2Trk-1,x
|
||||
|
||||
lda #0
|
||||
sta XRW.D2VolNum-1,x
|
||||
|
||||
@ -212,67 +214,39 @@ regrwts lda #1
|
||||
.4 cmp XRW.ReqTrack
|
||||
beq .6
|
||||
|
||||
lda XRW.BadSeek
|
||||
beq .40 2 bad seeks, already
|
||||
|
||||
dec XRW.BadSeek
|
||||
bpl .5
|
||||
|
||||
ldx XRW.UnitIndex
|
||||
lda XRW.D2SeekTime-1,x
|
||||
bmi .5
|
||||
|
||||
bne .5
|
||||
|
||||
.40 lda XRW.SeekTime
|
||||
bmi .5 seektime = 140
|
||||
|
||||
clc
|
||||
adc #IO.D2.SeekTimeI
|
||||
sta XRW.SeekTime
|
||||
|
||||
ldx XRW.UnitIndex
|
||||
sta XRW.D2SeekTime-1,x
|
||||
|
||||
|
||||
.5 lda XRW.ReqTrack
|
||||
jsr XRW.Seek
|
||||
bra .3
|
||||
|
||||
.6 lda XRW.AddrField.S is this the right sector ?
|
||||
.6 lda XRW.AddrField.S is this the right sector ?
|
||||
cmp XRW.ReqSector
|
||||
bne .3 no, try another sector.
|
||||
|
||||
lda A4L read or write ?
|
||||
lsr the carry will tell.
|
||||
bcc .7 branch if write
|
||||
bit XRW.bWrite
|
||||
bpl .7 branch if write
|
||||
|
||||
jsr XRW.Read
|
||||
jmp XRW.Write
|
||||
|
||||
.7 jsr XRW.Read
|
||||
bcs .3 if bad read
|
||||
|
||||
.9 rts
|
||||
|
||||
.7 jmp XRW.Write
|
||||
*--------------------------------------
|
||||
* determine if motor is stopped
|
||||
*
|
||||
* if stopped, controller's shift register will not be changing.
|
||||
* return y = 0 and zero flag set if it is stopped.
|
||||
*--------------------------------------
|
||||
XRW.CheckMotorOn
|
||||
ldx A2L
|
||||
XRW.CheckMotorOnX
|
||||
ldy #0 init loop counter.
|
||||
|
||||
.1 lda IO.D2.RData,x read the shift register.
|
||||
jsr .9 delay
|
||||
|
||||
pha
|
||||
pla more delay.
|
||||
|
||||
cmp IO.D2.RData,x has shift reg changed ?
|
||||
bne .9 yes, motor is moving.
|
||||
|
||||
lda #MLI.E.NODEV anticipate error.
|
||||
dey no, dec retry counter
|
||||
bne .1 and try 256 times.
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
XRW.TestWP ldx A2L
|
||||
lda IO.D2.ReadProt,x test for write protected
|
||||
lda IO.D2.ReadMode,x
|
||||
rol write protect-->carry-->bit 0=1
|
||||
lda IO.D2.RData,x keep in read mode
|
||||
rts
|
||||
*--------------------------------------
|
||||
* preniblize subroutine (16 sector format)
|
||||
*
|
||||
@ -405,11 +379,13 @@ L596F ldy #$FF index to last byte of data to write.
|
||||
* on exit: carry set if error (write protect violation).
|
||||
* if no error, acc=uncertain, x=unchanged, y=0, carry clear.
|
||||
*--------------------------------------
|
||||
XRW.Write lda nbuf2
|
||||
sta pcl
|
||||
.LIST ON
|
||||
XRW.Write lda IO.D2.ReadProt,x PREWRITE MODE
|
||||
.LIST OFF
|
||||
lda IO.D2.ReadMode,x
|
||||
|
||||
bit IO.D2.ReadProt,x PREWRITE MODE
|
||||
bit IO.D2.ReadMode,x
|
||||
lda nbuf2
|
||||
sta pcl
|
||||
|
||||
lda #$FF Self Sync Byte
|
||||
|
||||
@ -449,7 +425,7 @@ L583D eor nbuf2-1,y (4) xor with current (NO MORE PAGE CROSS)
|
||||
|
||||
* ldx A2L (3) restore slot index
|
||||
ldx >A2L (4) absolute reference to zero page
|
||||
|
||||
|
||||
sta IO.D2.WLoad,x (5) store encoded byte
|
||||
lda IO.D2.WShift,x (4) handshake
|
||||
dey (2)
|
||||
@ -458,7 +434,7 @@ L583D eor nbuf2-1,y (4) xor with current (NO MORE PAGE CROSS)
|
||||
* end of write byte loop
|
||||
|
||||
lda pcl (3) get prior nibl (from nbuf2)
|
||||
|
||||
|
||||
wrefd1 ldy #$00 (2) warning: load value modified by prenib.
|
||||
|
||||
wrefa1 eor $1000,y (4) warning: address modified by prenib.
|
||||
@ -471,7 +447,7 @@ wrefd2 ldx #$60 (2) warning: value modified by prenib.
|
||||
wrefa2 lda $1000,y (4) prior nibl. warning: address modified by prenib.
|
||||
iny (2) all done with this page ?
|
||||
bne wrefa1 (3-) loop until page end.
|
||||
|
||||
|
||||
lda pch (3) get next (precalculated & translated) nibl.
|
||||
beq L58C0 (2+) branch if code written was page aligned.
|
||||
|
||||
@ -526,32 +502,41 @@ wrefd5 ldx #$60 (2) restore slot. warning: modified by prenib
|
||||
sta IO.D2.WLoad,x (5)
|
||||
lda IO.D2.WShift,x (4)
|
||||
|
||||
ldy #$00 (2) set y = index end mark table.
|
||||
ldy #2 (2) set y = index end mark table.
|
||||
pha (3) waste another 11 micro-seconds
|
||||
pla (4)
|
||||
nop (2)
|
||||
nop (2)
|
||||
|
||||
L58D3 lda XRW.EndDataMark,y (4) dm4, dm5, dm6 and turn off byte.
|
||||
.1 nop (2)
|
||||
|
||||
lda XRW.EndMark,y (4) DE AA EB
|
||||
jsr wnibl (15,6) write it
|
||||
iny (2)
|
||||
cpy #$04 (2) have all end marks been written ?
|
||||
bne L58D3 (3) if not.
|
||||
dey (2)
|
||||
bpl .1 (3) if not.
|
||||
|
||||
clc (2,9)
|
||||
clc (2)
|
||||
|
||||
lda IO.D2.ReadMode,x out of write mode
|
||||
lda #$FF (2)
|
||||
nop (2)
|
||||
|
||||
jsr wnibl (15,6) write turn off byte.
|
||||
|
||||
XRW.ReadMode lda IO.D2.ReadMode,x out of write mode
|
||||
lda IO.D2.WShift,x to read mode.
|
||||
rts return from write.
|
||||
|
||||
* 7-bit nibl write subroutines
|
||||
|
||||
wnibl9 clc (2) 9 cycles, then write.
|
||||
|
||||
wnibl7 pha (3) 7 cycles, then write.
|
||||
pla (4)
|
||||
|
||||
wnibl sta IO.D2.WLoad,x (5) nibl write
|
||||
ora IO.D2.WShift,x (4) clobbers acc, not carry
|
||||
.LIST ON
|
||||
XRW.Write.RTS rts (6)
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
* delays a specified number of 100 usec intervals for motor timing.
|
||||
* on entry: acc holds number of 100 usec intervals to delay.
|
||||
@ -560,25 +545,16 @@ XRW.Write.RTS rts (6)
|
||||
* for motor on timing.
|
||||
*--------------------------------------
|
||||
XRW.WaitSeekTime
|
||||
* lda #IO.D2.SeekTime
|
||||
phy
|
||||
ldy XRW.UnitIndex
|
||||
lda XRW.D2SeekTime-1,y
|
||||
ply
|
||||
lda XRW.SeekTime
|
||||
.HS 2C BIT ABS
|
||||
XRW.Wait25600usec
|
||||
lda #0
|
||||
XRW.Wait100usecA
|
||||
phx (3)
|
||||
|
||||
.1 ldx #16 (2)
|
||||
.1 ldx #18 (2)
|
||||
|
||||
.2 dex (2)
|
||||
bne .2 (3)
|
||||
|
||||
ldx A2L (3)
|
||||
bit IO.D2.DrvOn,x (4) Slow down ACC boards
|
||||
|
||||
inc XRW.montimel (6)
|
||||
bne .3 (3)
|
||||
|
||||
@ -586,8 +562,7 @@ XRW.Wait100usecA
|
||||
|
||||
.3 dec (2)
|
||||
bne .1 (3)
|
||||
|
||||
plx (4)
|
||||
|
||||
rts (6)
|
||||
*--------------------------------------
|
||||
* read subroutine (16-sector format)
|
||||
@ -599,7 +574,9 @@ XRW.Wait100usecA
|
||||
* acc=$AA, x=unchanged, y=0, carry clear.
|
||||
* observe 'no page cross' on some branches !!
|
||||
*--------------------------------------
|
||||
.LIST ON
|
||||
XRW.Read txa get slot #
|
||||
.LIST OFF
|
||||
ora #$8C prepare mods to read routine.
|
||||
sta rd4+1 warning: the read routine is
|
||||
sta rd5+1 self modified !!
|
||||
@ -672,7 +649,7 @@ rd4 ldx IO.D2.RData+$60 warning: self modified
|
||||
ldy #$AA now read directly into user buffer.
|
||||
bne rd5 always taken.
|
||||
|
||||
L576D sec error
|
||||
L576D sec error
|
||||
rts
|
||||
|
||||
ref1 sta $1000,y warning: self modified
|
||||
@ -736,129 +713,118 @@ L57CC sec
|
||||
L57CD pla place last byte into user buffer
|
||||
ldy #$55
|
||||
sta (buf),y
|
||||
.LIST ON
|
||||
XRW.Read.RTS rts
|
||||
*--------------------------------------
|
||||
XRW.Reset ldx A2L
|
||||
|
||||
lda IO.D2.ReadMode,x turn off write enable X = slot $S0
|
||||
|
||||
nop
|
||||
nop
|
||||
|
||||
ldy #4
|
||||
|
||||
.1 lda IO.D2.Ph0Off,x
|
||||
inx
|
||||
inx
|
||||
dey
|
||||
bne .1
|
||||
|
||||
rts
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
* A = target track
|
||||
*--------------------------------------
|
||||
XRW.Seek ldx XRW.UnitIndex
|
||||
|
||||
cmp XRW.D2Trk-1,x
|
||||
beq XRW.Read.RTS
|
||||
|
||||
pha save target track
|
||||
|
||||
|
||||
jsr XRW.Trk2Qtrk
|
||||
sta XRW.TargetQTrack
|
||||
|
||||
.DO XRWDBG=1
|
||||
jsr XRW.DEBUG3
|
||||
.FIN
|
||||
|
||||
lda XRW.D2Trk-1,x
|
||||
|
||||
jsr XRW.Trk2Qtrk
|
||||
sta XRW.CurrentQTrack
|
||||
|
||||
.DO XRWDBG=1
|
||||
jsr XRW.DEBUG2
|
||||
.FIN
|
||||
|
||||
pla
|
||||
sta XRW.D2Trk-1,x will be current track at the end
|
||||
|
||||
ldx A2L
|
||||
ldy A2L
|
||||
|
||||
.1 lda XRW.CurrentQTrack
|
||||
lda XRW.CurrentQTrack
|
||||
cmp XRW.TargetQTrack
|
||||
beq .7
|
||||
|
||||
jsr .8
|
||||
|
||||
bcs .2
|
||||
|
||||
* Current < Target, must move in
|
||||
|
||||
inc
|
||||
|
||||
.HS B0 BCS
|
||||
|
||||
* Current > Target, must move out
|
||||
|
||||
.2 dec
|
||||
|
||||
sta XRW.CurrentQTrack
|
||||
|
||||
pha
|
||||
|
||||
and #6
|
||||
ora A2L
|
||||
tax
|
||||
bcs .10
|
||||
|
||||
pla
|
||||
|
||||
bcs .3
|
||||
|
||||
* Current < Target, must move in
|
||||
|
||||
inc
|
||||
|
||||
.HS B0 BCS
|
||||
|
||||
* Current > Target, must move out
|
||||
|
||||
.3 dec
|
||||
|
||||
and #6
|
||||
.10 and #6
|
||||
ora A2L
|
||||
|
||||
bcc .4
|
||||
|
||||
* move out : invert 2 phases
|
||||
|
||||
phx
|
||||
tax
|
||||
pla
|
||||
|
||||
.4 tay
|
||||
|
||||
|
||||
ora #$80
|
||||
sta .7+1
|
||||
stz .6+1
|
||||
|
||||
lda IO.D2.Ph0On,x
|
||||
nop
|
||||
nop
|
||||
* jsr XRW.WaitSeekTime
|
||||
|
||||
lda IO.D2.Ph0On,y
|
||||
pla
|
||||
|
||||
.1 bcc .2
|
||||
|
||||
* Current > Target, must move out
|
||||
|
||||
dec
|
||||
|
||||
.HS 90 BCC
|
||||
|
||||
* Current < Target, must move in
|
||||
|
||||
.2 inc
|
||||
|
||||
sta XRW.CurrentQTrack
|
||||
|
||||
and #7
|
||||
tay
|
||||
|
||||
bcs .3
|
||||
|
||||
lda XRW.PhIn,y
|
||||
|
||||
bcc .4
|
||||
|
||||
.3 lda XRW.PhOut,y
|
||||
|
||||
.4 ora A2L
|
||||
sta .5+1
|
||||
|
||||
lsr
|
||||
bcc .5
|
||||
|
||||
asl
|
||||
|
||||
ldx .7+1
|
||||
stx .6+1
|
||||
|
||||
sta .7+1
|
||||
|
||||
.5 sta $C000 SELF MODIFIED
|
||||
nop
|
||||
nop
|
||||
|
||||
jsr XRW.WaitSeekTime
|
||||
|
||||
bra .1
|
||||
|
||||
.7 jsr XRW.Wait25600usec
|
||||
lda XRW.CurrentQTrack
|
||||
cmp XRW.TargetQTrack
|
||||
bne .1
|
||||
|
||||
.8 bit IO.D2.Ph0Off,x
|
||||
jsr XRW.Wait25600usec
|
||||
|
||||
.6 sta $C000 SELF MODIFIED
|
||||
nop
|
||||
nop
|
||||
|
||||
ldx IO.D2.Ph0Off,y
|
||||
.7 sta $C000 SELF MODIFIED
|
||||
nop
|
||||
nop
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
XRW.Reset ldx A2L
|
||||
|
||||
rts
|
||||
lda IO.D2.Ph0Off,x
|
||||
lda IO.D2.Ph1Off,x
|
||||
lda IO.D2.Ph2Off,x
|
||||
lda IO.D2.Ph3Off,x
|
||||
|
||||
jmp XRW.ReadMode
|
||||
*--------------------------------------
|
||||
XRW.Trk2Qtrk asl x2
|
||||
sta .1+1
|
||||
@ -866,38 +832,40 @@ XRW.Trk2Qtrk asl x2
|
||||
bit XRW.D2VolNum-1,x
|
||||
bpl .1 x4
|
||||
bvs .1 > $C0 ? (VOL=254)
|
||||
|
||||
|
||||
lsr x3
|
||||
|
||||
|
||||
.1 adc #$ff SELF MODIFIED
|
||||
rts
|
||||
*--------------------------------------
|
||||
.LIST ON
|
||||
XRW.ReadAddr ldy #$FC
|
||||
.LIST OFF
|
||||
sty XRW.CheckSum init nibble counter to $FCFC
|
||||
|
||||
|
||||
ldx A2L get slot #
|
||||
|
||||
.1 iny
|
||||
bne .2 counter LO
|
||||
|
||||
|
||||
inc XRW.CheckSum counter HI
|
||||
beq .99
|
||||
|
||||
|
||||
.2 lda IO.D2.RData,x read nibl
|
||||
bpl .2
|
||||
|
||||
|
||||
.3 cmp #$D5 address mark 1 ?
|
||||
bne .1
|
||||
|
||||
nop nibl delay
|
||||
|
||||
|
||||
nop
|
||||
|
||||
.4 lda IO.D2.RData,x
|
||||
bpl .4
|
||||
|
||||
cmp #$AA address mark 2 ?
|
||||
bne .3 if not, is it address mark 1 ?
|
||||
|
||||
ldy #$03 index for 4 byte read
|
||||
ldy #3 index for 4 byte read
|
||||
|
||||
.5 lda IO.D2.RData,x
|
||||
bpl .5
|
||||
@ -905,105 +873,99 @@ XRW.ReadAddr ldy #$FC
|
||||
cmp #$96 address mark 3 ?
|
||||
bne .3 if not, is it address mark 1
|
||||
|
||||
sei ???ALREADY DONE by XDOS.devmgr??? no interrupts until address is tested.
|
||||
lda #$00 init checksum
|
||||
|
||||
.6 sta XRW.CheckSum
|
||||
lda #0 init Chksum
|
||||
|
||||
.6 sta XRW.CheckSum
|
||||
|
||||
.7 lda IO.D2.RData,x read 'odd bit' nibl
|
||||
bpl .7
|
||||
|
||||
rol align odd bits, '1' into lsb.
|
||||
sta XRW.Temp4x4 save them.
|
||||
|
||||
|
||||
.8 lda IO.D2.RData,x read 'even bit' nibl
|
||||
bpl .8
|
||||
|
||||
|
||||
and XRW.Temp4x4 merge odd and even bits.
|
||||
sta XRW.AddrField.C,y store data byte.
|
||||
eor XRW.CheckSum
|
||||
dey
|
||||
bpl .6 loop on 4 data bytes.
|
||||
|
||||
|
||||
tay if final checksum non-zero,
|
||||
bne .99 then error.
|
||||
|
||||
clc
|
||||
|
||||
.9 lda IO.D2.RData,x
|
||||
bpl .9
|
||||
|
||||
|
||||
eor #$DE
|
||||
bne .99
|
||||
|
||||
*.10 lda IO.D2.RData,x
|
||||
* bpl .10
|
||||
|
||||
* eor #$AA
|
||||
* bne .99
|
||||
|
||||
|
||||
ldy XRW.UnitIndex
|
||||
lda XRW.AddrField.V ....save time doing it now
|
||||
lda XRW.AddrField.V
|
||||
sta XRW.D2VolNum-1,y
|
||||
|
||||
lda XRW.AddrField.T Successful Read, update Drive table
|
||||
sta XRW.D2Trk-1,y and exit with A = Trk
|
||||
|
||||
clc normal read ok
|
||||
|
||||
rts
|
||||
|
||||
.99 sec
|
||||
.99 sec
|
||||
.LIST ON
|
||||
XRW.ReadAddr.RTS
|
||||
rts
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
* determine if motor is stopped
|
||||
*
|
||||
* if stopped, controller's shift register will not be changing.
|
||||
* return y = 0 and zero flag set if it is stopped.
|
||||
*--------------------------------------
|
||||
XRW.CheckMotorOn
|
||||
ldx A2L
|
||||
XRW.CheckMotorOnX
|
||||
ldy #0 init loop counter.
|
||||
|
||||
.1 lda IO.D2.RData,x read the shift register.
|
||||
jsr .9 delay
|
||||
|
||||
pha
|
||||
pla more delay.
|
||||
|
||||
cmp IO.D2.RData,x has shift reg changed ?
|
||||
bne .9 yes, motor is moving.
|
||||
|
||||
dey no, dec retry counter
|
||||
bne .1 and try 256 times.
|
||||
|
||||
.9 rts Z if motor OFF
|
||||
*--------------------------------------
|
||||
XRW.TestWP ldx A2L
|
||||
lda IO.D2.ReadProt,x test for write protected
|
||||
lda IO.D2.ReadMode,x
|
||||
rol write protect-->carry-->bit 0=1
|
||||
lda IO.D2.RData,x keep in read mode
|
||||
rts
|
||||
*--------------------------------------
|
||||
.DO XRWDBG=1
|
||||
XRW.DEBUG phx
|
||||
XRW.PhIn .DA #IO.D2.Ph3Off 7->0
|
||||
.DA #IO.D2.Ph1On 0->1
|
||||
.DA #IO.D2.Ph0Off 1->2
|
||||
.DA #IO.D2.Ph2On 2->3
|
||||
.DA #IO.D2.Ph1Off 3->4
|
||||
.DA #IO.D2.Ph3On 4->5
|
||||
.DA #IO.D2.Ph2Off 5->6
|
||||
.DA #IO.D2.Ph0On 6->7
|
||||
|
||||
ldx #26
|
||||
lda XRW.AddrField.V
|
||||
jsr XRW.DEBUG.PRINT
|
||||
|
||||
lda XRW.AddrField.T
|
||||
jsr XRW.DEBUG.PRINT
|
||||
|
||||
lda XRW.AddrField.S
|
||||
jsr XRW.DEBUG.PRINT
|
||||
|
||||
inx
|
||||
|
||||
lda XRW.ReqTrack
|
||||
jsr XRW.DEBUG.PRINT
|
||||
|
||||
plx
|
||||
rts
|
||||
|
||||
XRW.DEBUG2 phx
|
||||
ldx #36
|
||||
bra XRW.DEBUG31
|
||||
|
||||
XRW.DEBUG3 phx
|
||||
ldx #38
|
||||
XRW.DEBUG31 jsr XRW.DEBUG.PRINT
|
||||
plx
|
||||
rts
|
||||
|
||||
XRW.DEBUG.PRINT
|
||||
sta CLRPAGE2
|
||||
pha
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
jsr .7
|
||||
|
||||
pla
|
||||
and #$0F
|
||||
|
||||
.7 ora #$B0
|
||||
cmp #"9"+1
|
||||
bcc .8
|
||||
adc #6
|
||||
.8 sta $700,x
|
||||
inx
|
||||
rts
|
||||
.FIN
|
||||
XRW.PhOut .DA #IO.D2.Ph1Off 1->0
|
||||
.DA #IO.D2.Ph0on 2->1
|
||||
.DA #IO.D2.Ph2off 3->2
|
||||
.DA #IO.D2.Ph1On 4->3
|
||||
.DA #IO.D2.Ph3Off 5->4
|
||||
.DA #IO.D2.Ph2On 6->5
|
||||
.DA #IO.D2.Ph0Off 7->6
|
||||
.DA #IO.D2.Ph3On 0->7
|
||||
*--------------------------------------
|
||||
.LIST ON
|
||||
XRW.FREE .EQ $D540-*
|
||||
@ -1021,7 +983,7 @@ nbuf2 .BS $56 nibl buffer for read/write of low 2-bits of each byte.
|
||||
*
|
||||
* nibbles in the ranges of $A0-$A3, $C0-$C7, $E0-$E3 are used for
|
||||
* other tables since no valid nibbles are in these ranges.
|
||||
* aligned to page boundary + $96
|
||||
* aligned to page boundary + $96
|
||||
*--------------------------------------
|
||||
XRW.Nib2FC .HS 0004
|
||||
* .HS FFFF
|
||||
@ -1046,14 +1008,14 @@ XRW.ReqSector .HS 00
|
||||
XRW.BadSeek .HS 00
|
||||
.HS 5054585C606468
|
||||
XRW.00XX0000 .HS 00201030 used in fast prenib.
|
||||
XRW.EndDataMark .HS DEAAEB table using 'unused' nibbles ($C4,$C5,$C6,$C7)
|
||||
XRW.EndMark .HS EBAADE table using 'unused' nibbles ($C4,$C5,$C6,$C7)
|
||||
* .HS FFFFFFFF
|
||||
XRW.AddrField.C .HS 00 AddrField Checksum
|
||||
XRW.AddrField.S .HS 00 AddrField Sector
|
||||
XRW.AddrField.T .HS 00 AddrField Track
|
||||
XRW.AddrField.V .HS 00 AddrField Volume
|
||||
.HS 6C
|
||||
.HS FF
|
||||
XRW.SeekTime .HS 00
|
||||
*ibstat .HS 00
|
||||
.HS 707478
|
||||
.HS FFFFFF
|
||||
@ -1074,7 +1036,7 @@ XRW.TargetQTrack .HS 00
|
||||
.HS B0B4B8BCC0C4C8
|
||||
.HS FFFF
|
||||
.HS CCD0D4D8DCE0
|
||||
.HS FF
|
||||
XRW.bWrite .HS 00
|
||||
.HS E4E8ECF0F4F8FC
|
||||
*--------------------------------------
|
||||
* 6-bit to 2-bit conversion tables:
|
||||
|
@ -97,8 +97,8 @@ WND.Test >PUSHBI S.WND.F.RESIZE+S.WND.F.MOVE+S.WND.F.CLOSE+S.WND.F.MAX+S.WND.F.
|
||||
|
||||
>PUSHW MouseData+S.MOUSE.X1
|
||||
>PUSHW MouseData+S.MOUSE.Y1
|
||||
>PUSHWI 360
|
||||
>PUSHWI 96
|
||||
>PUSHWI 360 witdh
|
||||
>PUSHWI 96 height
|
||||
>LIBCALL hLIBGUI,LIBGUI.WND.New
|
||||
bcs CS.QUIT.RTS
|
||||
sta hWND
|
||||
|
@ -1,16 +1,5 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR FAC 13 Bytes
|
||||
BIN.hMem .BS 1
|
||||
BIN.R.CS.Start .BS 2
|
||||
BIN.R.CS.End .BS 2
|
||||
BIN.R.End .BS 2
|
||||
BIN.R.Size .BS 2
|
||||
BIN.R.Offset .BS 2
|
||||
BIN.R.Stop .BS 2
|
||||
.ED
|
||||
*--------------------------------------
|
||||
* LoadLib
|
||||
* in :
|
||||
@ -106,7 +95,7 @@ BIN.Load.Cleanup.RTS
|
||||
* Y,A = MEMPTR
|
||||
* X = hMem of Code Segment
|
||||
*--------------------------------------
|
||||
BIN.Load lda CORE.FSID
|
||||
BIN.Load lda A2osX.FSID
|
||||
bne .11
|
||||
|
||||
ldx #$ff
|
||||
|
@ -187,10 +187,12 @@ CORE.UpdateParentPS
|
||||
CORE.GetEvents lda #Evt.Table
|
||||
sta pEvent point to start of event list
|
||||
stz CORE.EvtCount reset Size
|
||||
bit CORE.IRQMode do we have IRQ enabled for Ticks ?
|
||||
bit A2osX.IRQMode do we have IRQ enabled for Ticks ?
|
||||
bpl .1 no, regular poll
|
||||
|
||||
lda IRQ.Tick a Tick ?
|
||||
beq .8 no, no event
|
||||
|
||||
dec IRQ.Tick
|
||||
bra .2
|
||||
|
||||
@ -198,9 +200,11 @@ CORE.GetEvents lda #Evt.Table
|
||||
tax
|
||||
eor CORE.VBLState
|
||||
bpl .8 no change,no tick
|
||||
|
||||
txa
|
||||
sta CORE.VBLState save new
|
||||
bpl .8 Up2down transition,no tick
|
||||
|
||||
.2 lda #0
|
||||
dec CORE.TickSec
|
||||
bne .3 not yet One Sec
|
||||
@ -211,7 +215,9 @@ CORE.GetEvents lda #Evt.Table
|
||||
ldx A2osX.ASCREEN
|
||||
cpx #3 devID 3 is /DEV/CONSOLE
|
||||
bne .22
|
||||
|
||||
sta SYS.BASL0+38
|
||||
|
||||
.22 ldx CORE.TickPerSec
|
||||
stx CORE.TickSec
|
||||
|
||||
@ -224,6 +230,7 @@ CORE.GetEvents lda #Evt.Table
|
||||
.4 inc DevMgr.Timer
|
||||
inc A2osX.TIMER16
|
||||
bne .5
|
||||
|
||||
inc A2osX.TIMER16+1
|
||||
|
||||
.5 ldx CORE.TickPer10t
|
||||
@ -232,6 +239,7 @@ CORE.GetEvents lda #Evt.Table
|
||||
ora #S.EVT.F.T10TH
|
||||
.6 tax Finally, do we have an event ?
|
||||
beq .8 no....
|
||||
|
||||
sta (pEvent)
|
||||
inc CORE.EvtCount Add one event to Queue
|
||||
|
||||
@ -244,8 +252,10 @@ CORE.GetEvents lda #Evt.Table
|
||||
|
||||
.8 lda CORE.EvtCount if 0, exit with CS (from cmp), and A=0 "no event"
|
||||
beq .9
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -477,14 +487,12 @@ GP.RomCall.JmpX jmp (.1-FPU.FADD,x)
|
||||
.DA $ED36 FOUT.1 PrintF
|
||||
*--------------------------------------
|
||||
CORE.VBLState .BS 1
|
||||
CORE.IRQMode .BS 1
|
||||
CORE.TickPerSec .BS 1
|
||||
CORE.TickPer10t .BS 1
|
||||
CORE.TickSec .BS 1
|
||||
CORE.Tick10t .BS 1
|
||||
CORE.CPUStatCnt .DA #100
|
||||
CORE.LastPSID .DA #0
|
||||
CORE.FSID .BS 1
|
||||
*--------------------------------------
|
||||
CORE.EvtIndex .BS 1
|
||||
CORE.EvtCount .BS 1
|
||||
|
@ -47,7 +47,7 @@ ZPTMP .EQ $67 ->$84 29 bytes
|
||||
*--------------------------------------
|
||||
* X.UNPAK temp ZP (with ZPPtr1 &ZPPtr2)
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.DUMMY UNPAK
|
||||
.OR ZPTMP
|
||||
ZPInBufPtr .BS 2
|
||||
ZPOutBufPtr .BS 2
|
||||
@ -77,7 +77,48 @@ ARG32 .EQ ARG+1
|
||||
* CHARGOT .EQ $B7
|
||||
TXTPTR .EQ $B8
|
||||
*--------------------------------------
|
||||
* Memory Map
|
||||
.DUMMY
|
||||
.OR FAC 13 Bytes
|
||||
BIN.hMem .BS 1
|
||||
BIN.R.CS.Start .BS 2
|
||||
BIN.R.CS.End .BS 2
|
||||
BIN.R.End .BS 2
|
||||
BIN.R.Size .BS 2
|
||||
BIN.R.Offset .BS 2
|
||||
BIN.R.Stop .BS 2
|
||||
.ED
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPDRV
|
||||
ENV.BufPtr .BS 1
|
||||
ENV.VarEndChar .BS 1
|
||||
ENV.bNoExp .BS 1
|
||||
ENV.bExp .BS 1
|
||||
.ED
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPTMP 5 Bytes
|
||||
PS.bTXT .BS 1
|
||||
PS.hMem .BS 1
|
||||
PS.MemPtr .BS 2
|
||||
PS.hFILE .BS 1
|
||||
.ED
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPTMP+8 7 Bytes
|
||||
PS.Flags .BS 1
|
||||
PS.ArgV .BS 2
|
||||
PS.ArgSize .BS 2
|
||||
PS.NewPSPtr .BS 2
|
||||
.ED
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPTMP+20 7 Bytes
|
||||
IO.Open.FLAGS .BS 1
|
||||
IO.Open.TYPE .BS 1
|
||||
IO.Open.AUXTYPE .BS 2
|
||||
IO.hFD .BS 1
|
||||
.ED
|
||||
*--------------------------------------
|
||||
A2osX.SaveSM .EQ $100 Aux
|
||||
A2osX.SaveSX .EQ $101 Aux
|
||||
|
@ -62,7 +62,7 @@ K.OpenDir jsr PFT.CheckPathYA
|
||||
* A = EC
|
||||
* note : A = 0 means no more entry
|
||||
*\--------------------------------------
|
||||
.DUMMY
|
||||
.DUMMY ZPTMP,9
|
||||
.OR ZPTMP 9 Bytes
|
||||
K.ReadDir.hBlk .BS 1
|
||||
K.ReadDir.ECIB .BS 1
|
||||
|
@ -10,6 +10,7 @@ DRV.DiskII cld
|
||||
bcs DRV.RamDrive.9
|
||||
>STYA pIOCTL
|
||||
jmp (.1,x)
|
||||
|
||||
.1 .DA DRV.DiskII.STATUS
|
||||
.DA DRV.BLK READ
|
||||
.DA DRV.BLK WRITE
|
||||
@ -116,11 +117,13 @@ DRV.BLK txa
|
||||
sta DRV.BLK.PARAMS+1 UNITNUM
|
||||
ldx #3
|
||||
ldy #S.IOCTL.BUFPTR+3
|
||||
|
||||
.1 lda (pIOCTL),y BUF,BLKNUM
|
||||
sta DRV.BLK.PARAMS+2,x
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
ldy #S.FD.DEV.BUSPTR
|
||||
lda (pFD),y
|
||||
sta .3+1
|
||||
@ -131,10 +134,12 @@ DRV.BLK txa
|
||||
jsr GO.ProDOS
|
||||
|
||||
ldx #5
|
||||
|
||||
.2 lda DRV.BLK.PARAMS,x
|
||||
sta $42,x
|
||||
dex
|
||||
bpl .2
|
||||
|
||||
.3 jsr $ffff SELF MODIFIED
|
||||
|
||||
jsr GO.A2osX
|
||||
@ -215,8 +220,10 @@ DRV.STATUS.YA >STYA .2+1
|
||||
ldy #S.IOCTL.STATCODE
|
||||
lda (pIOCTL),y
|
||||
beq .1
|
||||
|
||||
cmp #S.IOCTL.STATCODE.GETDIB
|
||||
bne .9
|
||||
|
||||
ldx #S.DIB-1
|
||||
.HS 2C bit abs
|
||||
.1 ldx #3
|
||||
@ -227,10 +234,12 @@ DRV.STATUS.YA >STYA .2+1
|
||||
iny
|
||||
lda (pIOCTL),y
|
||||
sta .3+2
|
||||
|
||||
.2 lda $ffff,x SELF MODIFIED
|
||||
.3 sta $ffff,x SELF MODIFIED
|
||||
dex
|
||||
bpl .2
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
|
@ -210,7 +210,7 @@ FS.STAT.YA >PUSHYA
|
||||
.9 >POP 4
|
||||
FS.STAT.YA.RTS rts
|
||||
*--------------------------------------
|
||||
FS.Stat bit CORE.FSID
|
||||
FS.Stat bit A2osX.FSID
|
||||
bmi FS.Stat.FX
|
||||
|
||||
FS.Stat.203 >MLICALL MLIGETFILEINFO
|
||||
@ -312,7 +312,7 @@ FS.ClrStat ldx #S.STAT-1
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
lda CORE.FSID
|
||||
lda A2osX.FSID
|
||||
sta K.S.STAT+S.STAT.FSID
|
||||
|
||||
rts
|
||||
|
@ -110,10 +110,16 @@ Kernel.Init2 sei
|
||||
Kernel.Init3 sta SETALTZP
|
||||
bit RRAMWRAMBNK1
|
||||
bit RRAMWRAMBNK1
|
||||
|
||||
lda #$ff Make sure we are in Kernel Mode during setup
|
||||
sta IRQ.InKernel
|
||||
stz IRQ.InLib
|
||||
|
||||
lda /K.VER
|
||||
sta A2osX.KVER
|
||||
lda #K.VER
|
||||
sta A2osX.KVER+1
|
||||
|
||||
sta SETALTCHAR
|
||||
sta CLRMIXED
|
||||
sta CLRHIRES
|
||||
@ -167,7 +173,7 @@ Kernel.Init3C >PUSHWI MSG.Init3
|
||||
|
||||
jsr HW.Detect
|
||||
|
||||
jsr CPU.Init.6502
|
||||
jsr CPU.Init
|
||||
|
||||
jsr CPU.Init.Z80
|
||||
|
||||
@ -220,11 +226,11 @@ KConfigLoad >LDYAI MSG.KCREAD
|
||||
eor #MLI.E.BADCALL
|
||||
beq .2 regular ProDOS
|
||||
|
||||
ror CORE.FSID Bad file, but ProDOS.FX detected
|
||||
ror A2osX.FSID Bad file, but ProDOS.FX detected
|
||||
bra .9
|
||||
|
||||
.1 sec
|
||||
ror CORE.FSID File Present & ProDOS.FX detected
|
||||
ror A2osX.FSID File Present & ProDOS.FX detected
|
||||
|
||||
.2 jsr MLI
|
||||
.DA #MLIOPEN
|
||||
@ -252,7 +258,7 @@ KConfigLoad >LDYAI MSG.KCREAD
|
||||
.9 >LDYAI MSG.KCREAD.KO
|
||||
|
||||
.8 jsr PrintFYA
|
||||
lda CORE.FSID
|
||||
lda A2osX.FSID
|
||||
beq .99
|
||||
|
||||
>LDYAI MSG.PRODOSFX
|
||||
@ -438,7 +444,7 @@ HW.Detect >PUSHWI MSG.HW
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CPU.Init.6502 >PUSHWI MSG.CPU
|
||||
CPU.Init >PUSHWI MSG.CPU
|
||||
>PUSHBI 0
|
||||
>SYSCALL2 printf
|
||||
jsr Detect6502 A = CPU type
|
||||
@ -456,127 +462,114 @@ CPU.Init.6502 >PUSHWI MSG.CPU
|
||||
>SYSCALL2 printf
|
||||
|
||||
ldy #0
|
||||
stz A2osX.RANDOM16+1
|
||||
|
||||
stz A2osX.CPUSPEED+1
|
||||
|
||||
php
|
||||
sei
|
||||
|
||||
ldx A2osX.HZ
|
||||
|
||||
lda A2osX.HZ2Cnt-5,x
|
||||
asl
|
||||
tax 2 VBL states (up & down)
|
||||
clc CC for //e
|
||||
|
||||
lda MACHID
|
||||
and #MACHID.T
|
||||
eor #MACHID.T.IIc
|
||||
bne .1
|
||||
beq CPU.Init2c
|
||||
|
||||
txa if //c, only one change (IRQ up)
|
||||
lsr
|
||||
lda A2osX.HZ
|
||||
asl
|
||||
tax
|
||||
sec CS for //c
|
||||
|
||||
sta CLRIOUDIS
|
||||
lda IO.IIC.RDVBLMSK
|
||||
sta ZPPtr1+1 Save VBLIRQ enable
|
||||
|
||||
sta IO.IIC.ENVBL
|
||||
lda IO.IIC.CLRVBLIRQ
|
||||
|
||||
.1 bit VBL Wait VBL high....
|
||||
|
||||
.1 bit VBL //e : Wait VBL high....
|
||||
bpl .1
|
||||
|
||||
bcc .2 skip if //e
|
||||
|
||||
lda IO.IIC.CLRVBLIRQ clear //c IRQ
|
||||
lda #0 reset A = LOW
|
||||
|
||||
bra .3
|
||||
|
||||
.2 lda VBL //e : wait VBL low
|
||||
bmi .2
|
||||
*--------------------------------------
|
||||
.3 nop (2)
|
||||
nop (2)
|
||||
nop (2)
|
||||
|
||||
nop (2)
|
||||
nop (2)
|
||||
nop (2)
|
||||
|
||||
nop (2)
|
||||
nop (2)
|
||||
nop (2)
|
||||
|
||||
nop (2)
|
||||
nop (2)
|
||||
|
||||
iny (2)
|
||||
bne .4 (2*)
|
||||
|
||||
inc A2osX.RANDOM16+1 (6)
|
||||
|
||||
bra .5 (3) 2+6+3
|
||||
|
||||
.4 nop (2)
|
||||
nop (2)
|
||||
nop (2)
|
||||
|
||||
nop (2) 3+2+2+2+2 if from BNE
|
||||
.3 pha (3)
|
||||
pla (4)
|
||||
pha (3)
|
||||
pla (4)
|
||||
pha (3)
|
||||
pla (4)
|
||||
pha (3)
|
||||
pla (4)
|
||||
pha (3)
|
||||
pla (4)
|
||||
pha (3)
|
||||
pla (4)
|
||||
|
||||
iny
|
||||
cpy #100
|
||||
bne .5
|
||||
|
||||
ldy #0
|
||||
inc A2osX.CPUSPEED+1
|
||||
|
||||
.5 eor VBL (4)
|
||||
bpl .3 (2*)
|
||||
|
||||
bcc .51 skip if //e
|
||||
|
||||
lda IO.IIC.CLRVBLIRQ clear //c IRQ
|
||||
lda #0 reset A = LOW
|
||||
|
||||
.51 dex
|
||||
dex
|
||||
bne .3
|
||||
|
||||
bcc .60 skip if //e
|
||||
bra CPU.InitOK
|
||||
*--------------------------------------
|
||||
CPU.Init2c sta CLRIOUDIS
|
||||
lda IO.IIC.RDVBLMSK
|
||||
pha Save VBLIRQ enable
|
||||
|
||||
bit ZPPtr1+1 Disable VBLIRQ ?
|
||||
bpl .60
|
||||
sta IO.IIC.ENVBL
|
||||
lda IO.IIC.CLRVBLIRQ
|
||||
|
||||
ldx A2osX.HZ
|
||||
|
||||
.1 bit VBL Wait VBL high....
|
||||
bpl .1
|
||||
|
||||
bit IO.IIC.CLRVBLIRQ clear //c IRQ
|
||||
|
||||
.3 pha (3)
|
||||
pla (4)
|
||||
pha (3)
|
||||
pla (4)
|
||||
pha (3)
|
||||
pla (4)
|
||||
pha (3)
|
||||
pla (4)
|
||||
pha (3)
|
||||
pla (4)
|
||||
pha (3)
|
||||
pla (4)
|
||||
|
||||
iny
|
||||
cpy #100
|
||||
bne .5
|
||||
|
||||
inc A2osX.CPUSPEED+1
|
||||
ldy #0
|
||||
|
||||
.5 bit VBL Wait VBL high....
|
||||
bpl .3
|
||||
|
||||
bit IO.IIC.CLRVBLIRQ clear //c IRQ
|
||||
|
||||
dex
|
||||
bne .3
|
||||
|
||||
pla Disable VBLIRQ ?
|
||||
bpl CPU.InitOk
|
||||
|
||||
sta IO.IIC.DISVBL
|
||||
|
||||
.60 plp
|
||||
*--------------------------------------
|
||||
sty A2osX.RANDOM16
|
||||
CPU.InitOk plp
|
||||
|
||||
stz A2osX.CPUSPEED
|
||||
|
||||
lsr A2osX.RANDOM16+1
|
||||
ror A2osX.RANDOM16
|
||||
|
||||
.7 lda A2osX.RANDOM16
|
||||
sec
|
||||
sbc #100
|
||||
tax
|
||||
lda A2osX.RANDOM16+1
|
||||
sbc /100
|
||||
bcc .8
|
||||
|
||||
stx A2osX.RANDOM16
|
||||
sta A2osX.RANDOM16+1
|
||||
inc A2osX.CPUSPEED
|
||||
bra .7
|
||||
|
||||
.8 lda A2osX.RANDOM16
|
||||
sta A2osX.CPUSPEED+1
|
||||
sty A2osX.CPUSPEED
|
||||
|
||||
>PUSHWI MSG.CPU.SPEEDOK
|
||||
lda A2osX.CPUSPEED
|
||||
>PUSHA push CPU speed HI
|
||||
lda A2osX.CPUSPEED+1
|
||||
>PUSHA push CPU speed HI
|
||||
lda A2osX.CPUSPEED
|
||||
>PUSHA push CPU speed LO
|
||||
>PUSHBI 2
|
||||
>SYSCALL2 printf
|
||||
|
||||
>DEBUGOA
|
||||
rts
|
||||
*--------------------------------------
|
||||
CPU.Init.Z80 >PUSHWI MSG.Z80
|
||||
@ -943,7 +936,7 @@ IrqMgrInit.TClock
|
||||
lda #11
|
||||
sta CORE.TickPer10t
|
||||
sta CORE.Tick10t
|
||||
dec CORE.IRQMode
|
||||
dec A2osX.IRQMode
|
||||
plp
|
||||
clc
|
||||
rts
|
||||
@ -1007,7 +1000,7 @@ IrqMgrInit.Mouse
|
||||
sta CORE.IRQ.MOUSE.2+1
|
||||
|
||||
jsr IrqMgrInit.HZ2Tick
|
||||
dec CORE.IRQMode
|
||||
dec A2osX.IRQMode
|
||||
|
||||
plp
|
||||
clc
|
||||
@ -1171,8 +1164,6 @@ Z80Code.Start .HS 31FF00 START: LD SP,000FFH Init Stack
|
||||
.HS 00 FLAG: .DB 0
|
||||
Z80Code.Size .EQ *-Z80Code.Start
|
||||
*--------------------------------------
|
||||
A2osX.HZ2Cnt .DA #30,#25
|
||||
*--------------------------------------
|
||||
Mouse.OFS .HS 05070B0CFB
|
||||
Mouse.SIG .HS 38180120D6
|
||||
*--------------------------------------
|
||||
|
@ -88,7 +88,7 @@ IRQ.3 pla Must keep Carry
|
||||
|
||||
sta SETPAGE2
|
||||
|
||||
.30 bvc IRQ.4 if not V, skip task switching
|
||||
.30 bvc IRQ.4 if not V, skip task switching
|
||||
|
||||
tsx Check Stack if before "dec IRQ.InKernel"
|
||||
cpx #$fc $1ff-PChi-PClo-P = $1fc
|
||||
@ -117,10 +117,6 @@ IRQ.3 pla Must keep Carry
|
||||
lda /A2osX.SLEEP with RTS=PC IRQ-1
|
||||
sta $103,x
|
||||
|
||||
.5 lda #$60+'S'
|
||||
eor SYS.BASL0+39
|
||||
sta SYS.BASL0+39
|
||||
|
||||
.8 clc
|
||||
|
||||
IRQ.4 ldy #$ff Self Modified
|
||||
|
@ -1,7 +1,7 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.DUMMY ZPTMP,6
|
||||
.OR ZPTMP 29 bytes
|
||||
ZS.START
|
||||
ZPCtxPtr .BS 2
|
||||
|
@ -1,13 +1,5 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPTMP+8 7 Bytes
|
||||
PS.Flags .BS 1
|
||||
PS.ArgV .BS 2
|
||||
PS.ArgSize .BS 2
|
||||
PS.NewPSPtr .BS 2
|
||||
.ED
|
||||
*/--------------------------------------
|
||||
* # ExecL
|
||||
* ## C / CSH
|
||||
@ -765,14 +757,6 @@ K.Kill.2 ldy #S.PS.hSession
|
||||
* Y,A = File Length (without ending 0)
|
||||
* X = hMem of Loaded File
|
||||
*\--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPTMP 5 Bytes
|
||||
FIO.bTXT .BS 1
|
||||
FIO.hMem .BS 1
|
||||
FIO.MemPtr .BS 2
|
||||
FIO.hFILE .BS 1
|
||||
.ED
|
||||
*--------------------------------------
|
||||
K.LoadTxtFile sec
|
||||
.HS 90 BCC
|
||||
*/--------------------------------------
|
||||
@ -793,12 +777,12 @@ K.LoadTxtFile sec
|
||||
*\--------------------------------------
|
||||
K.LoadFile clc
|
||||
|
||||
ror FIO.bTXT
|
||||
ror PS.bTXT
|
||||
|
||||
>SYSCALL2 FOpen
|
||||
bcs .99
|
||||
|
||||
sta FIO.hFILE
|
||||
sta PS.hFILE
|
||||
|
||||
jsr FS.FSTAT.A
|
||||
bcs .98
|
||||
@ -809,7 +793,7 @@ K.LoadFile clc
|
||||
|
||||
>LDYA K.S.Stat+S.STAT.SIZE
|
||||
|
||||
bit FIO.bTXT Add 1 to buffer size for ending 0
|
||||
bit PS.bTXT Add 1 to buffer size for ending 0
|
||||
bpl .1
|
||||
iny
|
||||
bne .1
|
||||
@ -819,7 +803,7 @@ K.LoadFile clc
|
||||
.97 lda #E.FTB
|
||||
|
||||
.98 pha
|
||||
lda FIO.hFILE
|
||||
lda PS.hFILE
|
||||
>SYSCALL2 FClose
|
||||
pla
|
||||
sec
|
||||
@ -828,18 +812,18 @@ K.LoadFile clc
|
||||
.1 jsr K.GetMem
|
||||
bcs .96
|
||||
|
||||
>STYA FIO.MemPtr
|
||||
stx FIO.hMem
|
||||
>STYA PS.MemPtr
|
||||
stx PS.hMem
|
||||
|
||||
>PUSHWI $ffff
|
||||
>PUSHW FIO.MemPtr
|
||||
lda FIO.hFILE
|
||||
>PUSHW PS.MemPtr
|
||||
lda PS.hFILE
|
||||
>SYSCALL2 FRead
|
||||
bcs .96
|
||||
|
||||
sty .7+1
|
||||
sta .8+1
|
||||
bit FIO.bTXT
|
||||
bit PS.bTXT
|
||||
bpl .5
|
||||
|
||||
pha set ending 0
|
||||
@ -847,10 +831,10 @@ K.LoadFile clc
|
||||
|
||||
* clc
|
||||
|
||||
adc FIO.MemPtr
|
||||
adc PS.MemPtr
|
||||
sta .4+1
|
||||
pla
|
||||
adc FIO.MemPtr+1
|
||||
adc PS.MemPtr+1
|
||||
sta .4+2
|
||||
.4 stz $ffff Self Modified
|
||||
|
||||
@ -858,7 +842,7 @@ K.LoadFile clc
|
||||
|
||||
.7 ldy #$ff SELFMODIFIED
|
||||
.8 lda #$ff SELFMODIFIED
|
||||
ldx FIO.hMem
|
||||
ldx PS.hMem
|
||||
clc
|
||||
rts
|
||||
|
||||
@ -866,7 +850,7 @@ K.LoadFile clc
|
||||
|
||||
jsr .98 FClose
|
||||
|
||||
lda FIO.hMem
|
||||
lda PS.hMem
|
||||
jsr K.FreeMem
|
||||
pla
|
||||
sec
|
||||
|
@ -66,7 +66,7 @@ NEW
|
||||
* + %011s : 'ABCDEFGH000'
|
||||
* + %2f : '3.14'
|
||||
*\--------------------------------------
|
||||
.DUMMY
|
||||
.DUMMY ZPTMP+5,5 Used by : STDIO2
|
||||
.OR ZPTMP+5 5 Bytes
|
||||
PrintF.Cnt .BS 2
|
||||
PrintF.hFILE .BS 1
|
||||
@ -258,19 +258,39 @@ PrintF.U clc unsigned long (DWORD)
|
||||
|
||||
ldy #4
|
||||
|
||||
PrintF.NUM ror ACC32.Sign
|
||||
PrintF.NUM sty .2+1
|
||||
|
||||
ror ACC32.Sign save signed/unsigned flag
|
||||
jsr MATH32.ACC32ZERO
|
||||
|
||||
.1 jsr STDIO.GetStackByte
|
||||
bcs PrintF.B.RTS
|
||||
|
||||
sta ACC32-1,y
|
||||
sta ACC32-1,y PULL 4,2 or 1
|
||||
dey
|
||||
bne .1
|
||||
|
||||
bit ACC32.Sign
|
||||
bpl .4
|
||||
|
||||
.2 ldy #$ff SELF MODIFIED
|
||||
|
||||
ldx K.PrintF.PadL
|
||||
lda ACC32-1,y Get highest Byte
|
||||
bpl .4 positive....
|
||||
|
||||
lda #$ff
|
||||
|
||||
.3 cpy #4
|
||||
beq .4
|
||||
|
||||
iny
|
||||
sta ACC32-1,y
|
||||
bra .3
|
||||
|
||||
.4 ldx K.PrintF.PadL
|
||||
ldy K.PrintF.PadC
|
||||
rol ACC32.Sign
|
||||
|
||||
rol ACC32.Sign get back signed/unsigned flag
|
||||
jsr MATH32.ACC322STR10
|
||||
bra PrintF.StrNum
|
||||
*--------------------------------------
|
||||
|
@ -317,14 +317,6 @@ K.RealPath.RemoveAtX
|
||||
* Y,A = PTR to Expanded String
|
||||
* X = hMem to Expanded String (C-String)
|
||||
*\--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPDRV
|
||||
ENV.BufPtr .BS 1
|
||||
ENV.VarEndChar .BS 1
|
||||
ENV.bNoExp .BS 1
|
||||
ENV.bExp .BS 1
|
||||
.ED
|
||||
*--------------------------------------
|
||||
K.Expand ldy #2
|
||||
lda (pStack),y
|
||||
pha
|
||||
|
@ -3,7 +3,7 @@ NEW
|
||||
*--------------------------------------
|
||||
CURSOR.BLINK.SPEED .EQ 2
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.DUMMY ZPDRV
|
||||
.OR ZPDRV
|
||||
ZPIOCTL .BS 2
|
||||
ZPBufPtr .BS 2
|
||||
|
@ -13,14 +13,6 @@ NEW
|
||||
* A = hFD
|
||||
* REG File created on ProDOS : T=TXT,X=$0000
|
||||
*\--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPTMP+20 7 Bytes
|
||||
IO.Open.FLAGS .BS 1
|
||||
IO.Open.TYPE .BS 1
|
||||
IO.Open.AUXTYPE .BS 2
|
||||
IO.hFD .BS 1
|
||||
.ED
|
||||
*--------------------------------------
|
||||
K.Open jsr PFT.YAToMLIPATH
|
||||
>PULLB IO.Open.FLAGS
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user