Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-04-13 19:04:02 +02:00
parent 7465d8a2d4
commit 2cbb13cb00
17 changed files with 425 additions and 366 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -178,6 +178,7 @@ MLIREADK .DA #4
MLICLOSEK .DA #1 MLICLOSEK .DA #1
.BS 1 .BS 1
*-------------------------------------- *--------------------------------------
*SYSKERNEL >PSTR "sys/kernel.PAKED"
SYSKERNEL >PSTR "sys/kernel" SYSKERNEL >PSTR "sys/kernel"
*-------------------------------------- *--------------------------------------
MSG.INIT1 >PSTR "A2osX[Stage1]:Init" MSG.INIT1 >PSTR "A2osX[Stage1]:Init"

View File

@ -3,7 +3,7 @@ NEW
.LIST OFF .LIST OFF
.OP 65C02 .OP 65C02
.OR $2000 .OR $2000
.TF BIN/BMP2PIX .TF bin/bmp2pix
*-------------------------------------- *--------------------------------------
.INB INC/MACROS.I .INB INC/MACROS.I
.INB INC/A2OSX.I .INB INC/A2OSX.I
@ -94,28 +94,37 @@ CS.RUN
beq .3 beq .3
dex dex
bne .2 bne .2
.99 >PUSHBI 0
>LDYA L.MSG.USAGE .99 >PUSHW L.MSG.USAGE
>PUSHBI 0
>SYSCALL PrintF >SYSCALL PrintF
lda #E.SYN lda #E.SYN
sec sec
rts rts
.3 ldy OptionVars-1,x .3 ldy OptionVars-1,x
lda #$80 lda #$80
sta (pData),y sta (pData),y
bra .1 bra .1
.4 >LDA.G hInputFile .4 >LDA.G hInputFile
bne .5 bne .5
jsr CS.RUN.OpenInput jsr CS.RUN.OpenInput
bcc .1 scan for any other args bcc .1 scan for any other args
rts rts
.5 >LDA.G hOutputFile .5 >LDA.G hOutputFile
bne .99 bne .99
jsr CS.RUN.CreateOutput jsr CS.RUN.CreateOutput
bcc .1 scan for any other args bcc .1 scan for any other args
.9 rts .9 rts
.7 >LDA.G hOutputFile .7 >LDA.G hOutputFile
beq .99 beq .99
>LDA.G BMP.Header+S.BMP.BPP >LDA.G BMP.Header+S.BMP.BPP
cmp #1 cmp #1
beq CS.RUN.1 beq CS.RUN.1
@ -156,8 +165,7 @@ CS.RUN.1 lda #S.BM.F.BBP1
* adc #%00001000 * adc #%00001000
* bcc .2 * bcc .2
* inc ZPPIXRowBytes+1 * inc ZPPIXRowBytes+1
*.2 *.2 lsr ZPPIXRowBytes+1
lsr ZPPIXRowBytes+1
* ror * ror
* lsr ZPPIXRowBytes+1 * lsr ZPPIXRowBytes+1
* ror * ror
@ -235,11 +243,14 @@ CS.RUN.24 lda #S.BM.F.BBP4
bcc .1 bcc .1
inx inx
.1 sta ZPInputRowBytes .1 sta ZPInputRowBytes
stx ZPInputRowBytes+1 stx ZPInputRowBytes+1
>LDYA ZPInputRowBytes >LDYA ZPInputRowBytes
>SYSCALL GetMem >SYSCALL GetMem
bcs CS.RUN.RTS bcs CS.RUN.RTS
>STYA ZPInputBuf >STYA ZPInputBuf
txa txa
>STA.G hInputBuf >STA.G hInputBuf
@ -252,6 +263,7 @@ CS.RUN.24 lda #S.BM.F.BBP4
inc inc
bne .2 bne .2
inx inx
.2 sta ZPOutputRowBytes .2 sta ZPOutputRowBytes
stx ZPOutputRowBytes+1 stx ZPOutputRowBytes+1
>STA.G PIX.Header+S.BM.RowBytes >STA.G PIX.Header+S.BM.RowBytes
@ -399,12 +411,13 @@ CS.RUN.GetIndexInPalette.RTS
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.OpenInput CS.RUN.OpenInput
>PUSHWZ Aux type >PUSHW ZPPtr1
>PUSHBI 0 Type
>PUSHBI O.RDONLY >PUSHBI O.RDONLY
>LDYA ZPPtr1 >PUSHBI 0 Type
>PUSHWZ Aux type
>SYSCALL FOpen >SYSCALL FOpen
bcs CS.RUN.GetIndexInPalette.RTS bcs CS.RUN.GetIndexInPalette.RTS
>STA.G hInputFile >STA.G hInputFile
>PUSHWI S.BMP >PUSHWI S.BMP
@ -412,6 +425,7 @@ CS.RUN.OpenInput
>LDA.G hInputFile >LDA.G hInputFile
>SYSCALL FRead >SYSCALL FRead
bcs CS.RUN.GetIndexInPalette.RTS bcs CS.RUN.GetIndexInPalette.RTS
>LDA.G BMP.Header+S.BMP.SIG >LDA.G BMP.Header+S.BMP.SIG
cmp #'B' cmp #'B'
bne .99 bne .99
@ -427,19 +441,9 @@ CS.RUN.OpenInput
beq .1 beq .1
cmp #24 cmp #24
bne .99 bne .99
.1 >PUSHA
>LDA.G BMP.Header+S.BMP.H .1 >PUSHW L.MSG.HEADER.OK
>STA.G PIX.Header+S.BM.H
pha
eor #$ff
sta ZPLineCount
>LDA.G BMP.Header+S.BMP.H+1
>STA.G PIX.Header+S.BM.H+1
>PUSHA
eor #$ff
sta ZPLineCount+1
pla
>PUSHA
>LDA.G BMP.Header+S.BMP.W >LDA.G BMP.Header+S.BMP.W
>STA.G PIX.Header+S.BM.W >STA.G PIX.Header+S.BM.W
pha pha
@ -448,10 +452,27 @@ CS.RUN.OpenInput
>PUSHA >PUSHA
pla pla
>PUSHA >PUSHA
>LDA.G BMP.Header+S.BMP.H
>STA.G PIX.Header+S.BM.H
pha
eor #$ff
sta ZPLineCount
>LDA.G BMP.Header+S.BMP.H+1
>STA.G PIX.Header+S.BM.H+1
>PUSHA
eor #$ff
sta ZPLineCount+1
pla
>PUSHA
>PUSHB.G BMP.Header+S.BMP.BPP
>PUSHBI 5 >PUSHBI 5
>LDYA L.MSG.HEADER.OK
>SYSCALL PrintF >SYSCALL PrintF
.9 rts .9 rts
.99 >LDYA L.MSG.HEADER.KO .99 >LDYA L.MSG.HEADER.KO
>SYSCALL PutS >SYSCALL PutS
lda #E.IBIN lda #E.IBIN
@ -464,6 +485,7 @@ CS.RUN.ReadInput
>LDA.G hInputFile >LDA.G hInputFile
>SYSCALL FRead >SYSCALL FRead
bcs .9 bcs .9
>LDYA ZPInputBuf >LDYA ZPInputBuf
>STYA ZPInputBufPtr >STYA ZPInputBufPtr
>LDA.G BMP.Header+S.BMP.W >LDA.G BMP.Header+S.BMP.W
@ -475,10 +497,10 @@ CS.RUN.ReadInput
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CS.RUN.CreateOutput CS.RUN.CreateOutput
>PUSHWZ Aux type >PUSHW ZPPtr1
>PUSHBI $CB PIX Type
>PUSHBI O.WRONLY+O.CREATE >PUSHBI O.WRONLY+O.CREATE
>LDYA ZPPtr1 >PUSHBI $CB PIX Type
>PUSHWZ Aux type
>SYSCALL FOpen >SYSCALL FOpen
bcs .9 bcs .9
>STA.G hOutputFile >STA.G hOutputFile

View File

@ -62,8 +62,10 @@ CS.INIT clc
*-------------------------------------- *--------------------------------------
CS.RUN jsr DumpDev CS.RUN jsr DumpDev
bcs .9 bcs .9
jsr DumpNod jsr DumpNod
bcs .9 bcs .9
.8 lda #0 tell TSKMGR that all done ok, but .8 lda #0 tell TSKMGR that all done ok, but
sec we do not want to stay in memory sec we do not want to stay in memory
.9 rts .9 rts
@ -73,16 +75,19 @@ DumpDev >LDYA L.MSG0
ldx #1 ldx #1
stx Index stx Index
.1 lda Dev.Table-1,x .1 lda Dev.Table-1,x
sta ZPFDPtr sta ZPFDPtr
lda Dev.Table,x lda Dev.Table,x
sta ZPFDPtr+1 sta ZPFDPtr+1
beq .8 beq .7
jsr DumpDevFD jsr DumpDevFD
bcs .9 bcs .9
ldy #DEV.DIB+S.DIB-1 ldy #DEV.DIB+S.DIB-1
ldx #S.DIB-1 ldx #S.DIB-1
.2 lda BLANK.DIB,x .2 lda BLANK.DIB,x
sta (pData),y sta (pData),y
dey dey
@ -103,7 +108,9 @@ DumpDev >LDYA L.MSG0
bcs .9 bcs .9
bra .7 bra .7
.6 jsr DumpDevDIB .6 jsr DumpDevDIB
bcs .9
.7 inc Index .7 inc Index
inc index inc index

View File

@ -201,18 +201,13 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
jsr ExcludeMatch jsr ExcludeMatch
bcc .8 match, skip bcc .8 match, skip
ldy #S.STAT.P.DRIVE ldy #S.STAT.MODE+1
lda (ZPFileStat),y ProDOS Device ?
beq .5
jsr CS.RUN.DEV
bcc CS.RUN.LOOP
rts
.5 ldy #S.STAT.P.TYPE
lda (ZPFileStat),y lda (ZPFileStat),y
cmp #$0F Directory ? and #$70
bne .6 beq .6
cmp /S.STAT.MODE.DIR
bne .8
jsr CS.RUN.DIR jsr CS.RUN.DIR
bcs .99 bcs .99
@ -240,12 +235,23 @@ CS.RUN.DEV lda #E.BADPATH
*-------------------------------------- *--------------------------------------
CS.RUN.DIR lda bRecurse CS.RUN.DIR lda bRecurse
bpl .8 bpl .8
lda (ZPFileName) lda (ZPFileName)
cmp #'.' cmp #'.'
bne .1
ldy #1
lda (ZPFileName),y
beq .8 beq .8
jsr CS.RUN.BuildFilePath cmp #'.'
bne .1
iny
lda (ZPFileName),y
beq .8
.1 jsr CS.RUN.BuildFilePath
>PUSHW L.MSG.DIR >PUSHW L.MSG.DIR
>PUSHW ZPRelPath >PUSHW ZPRelPath
@ -494,7 +500,7 @@ CS.RUN.WriteArcHdrFile
CS.RUN.WriteArcHdr CS.RUN.WriteArcHdr
ldy #$ff ldy #$ff
.1 iny .1 iny
lda (ZPRelPath),y lda (ZPRelPath),y
bne .1 bne .1

View File

@ -122,12 +122,13 @@ Dev.ParseArgs >LDYA ARGS
.1 >PUSHW ZPArgPtr .1 >PUSHW ZPArgPtr
>PUSHW L.SSCANF.MAC >PUSHW L.SSCANF.MAC
ldx #10 ldx #0
.2 >PUSHW L.MAC0,x .2 >PUSHW L.MAC0,x
dex inx
dex inx
bpl .2 cpx #12
bne .2
>PUSHBI 12 6 x byte PTRs >PUSHBI 12 6 x byte PTRs
>SYSCALL sscanf >SYSCALL sscanf

View File

@ -146,12 +146,13 @@ Dev.ParseArgs >LDYA ARGS
.1 >PUSHW ZPArgPtr .1 >PUSHW ZPArgPtr
>PUSHW L.SSCANF.MAC >PUSHW L.SSCANF.MAC
ldx #10 ldx #0
.2 >PUSHW L.MAC0,x .2 >PUSHW L.MAC0,x
dex inx
dex inx
bpl .2 cpx #12
bne .2
>PUSHBI 12 6 x byte PTRs >PUSHBI 12 6 x byte PTRs

View File

@ -206,9 +206,9 @@ SYS.FEOF .EQ $3E
SYS.Remove .EQ $40 SYS.Remove .EQ $40
SYS.Rename .EQ $42 SYS.Rename .EQ $42
* STDIO2
* .EQ $44 * .EQ $44
* .EQ $46 * .EQ $46
* STDIO2
SYS.PrintF .EQ $48 SYS.PrintF .EQ $48
SYS.FPrintF .EQ $4A SYS.FPrintF .EQ $4A
SYS.SPrintF .EQ $4C SYS.SPrintF .EQ $4C

View File

@ -529,7 +529,9 @@ LDR.BlkDevScan stz idxl
lda #7 lda #7
sta LDR.SlotIdx sta LDR.SlotIdx
.1 lda LDR.SlotIdx .1 ldx LDR.SlotIdx
stz LDR.SlotDevType-1,x
jsr LDR.CheckDiskID jsr LDR.CheckDiskID
bcs .8 if no ProDOS device in this slot. bcs .8 if no ProDOS device in this slot.
@ -539,9 +541,9 @@ LDR.BlkDevScan stz idxl
sta devid =0 since disk ii's have null attributes sta devid =0 since disk ii's have null attributes
lda #RWTS lda #RWTS
sta driveradr sta LDR.driveradr
lda /RWTS lda /RWTS
sta driveradr+1 sta LDR.driveradr+1
sec 2 devices sec 2 devices
jsr LDR.AddBlkDevs jsr LDR.AddBlkDevs
bra .7 bra .7
@ -577,15 +579,15 @@ LDR.BlkDevScan stz idxl
iny $CnFF iny $CnFF
lda (idxl),y lda (idxl),y
sta driveradr sta LDR.driveradr
lda idxl+1 store hi entry addr (low already done) lda idxl+1 store hi entry addr (low already done)
sta driveradr+1 sta LDR.driveradr+1
cpx #2 CS if 2 devs or more cpx #2 CS if 2 devs or more
jsr LDR.AddBlkDevs install 1 or 2 devices from this slot. jsr LDR.AddBlkDevs install 1 or 2 devices from this slot.
.7 ldx LDR.SlotIdx .7 ldx LDR.SlotIdx
lda sltbit,x lda sltbit-1,x
tsb rommap mark bit to flag rom present tsb rommap mark bit to flag rom present
.8 dec idxl+1 next lower slot. .8 dec idxl+1 next lower slot.
@ -610,8 +612,10 @@ LDR.AddExtraDevs
jsr LDR.AddExtraSPDevs jsr LDR.AddExtraSPDevs
.8 dec LDR.SlotIdx .8 dec idxl+1
dec LDR.SlotIdx
bne .1 bne .1
LDR.AddExtraDevs.RTS LDR.AddExtraDevs.RTS
rts rts
*-------------------------------------- *--------------------------------------
@ -620,15 +624,15 @@ LDR.AddSPDevs jsr LDR.SetDevID setup the devid byte from attributes
iny #$ff iny #$ff
lda (idxl),y lda (idxl),y
sta driveradr sta LDR.driveradr
sta .1+1 modify operand sta .1+1 modify operand
clc clc
adc #$03 adc #$03
sta spvect+1 sta LDR.SPVect+1
lda idxl+1 lda idxl+1
sta driveradr+1 sta LDR.driveradr+1
sta spvect+2 sta LDR.SPVect+2
sta .1+2 modify operand sta .1+2 modify operand
asl convert $Cn to $n0 asl convert $Cn to $n0
@ -648,22 +652,17 @@ LDR.AddSPDevs jsr LDR.SetDevID setup the devid byte from attributes
.1 jsr $0000 SELF MODIFIED .1 jsr $0000 SELF MODIFIED
* ldy #$FB ldy #$FB
* lda (idxl),y check device id lda (idxl),y check device id
* and #$02 SCSI? and #$02 SCSI ?
* beq .2 no, no need to init Cocoon beq .2 no, no need to init Cocoon
* sta LDR.SPStatus.U device = 2 for SCSI jsr LDR.SPStatusCall status of Cocoon : A = device = 2 for SCSI
* jsr spvect status of Cocoon .2 lda #0 set unit# = 0
* .HS 00 jsr LDR.SPStatusCall
* .DA LDR.SPStatus.P ignore any errors.
lda LDR.SPStatusBuf Device count
.2 stz LDR.SPStatus.U set unit# = 0
jsr spvect call to get the device count.
.HS 00 this is a status call
.DA LDR.SPStatus.P
lda LDR.SPStatus.Buf
beq LDR.AddExtraDevs.RTS no devices, so done. beq LDR.AddExtraDevs.RTS no devices, so done.
* sta LDR.DevCnt * sta LDR.DevCnt
@ -672,12 +671,10 @@ LDR.AddSPDevs jsr LDR.SetDevID setup the devid byte from attributes
*.3 inc LDR.SPStatus.U *.3 inc LDR.SPStatus.U
* jsr spvect call to get the device status * jsr LDR.SPStatusCall.U call to get the device status
* .HS 00 this is a status call
* .DA LDR.SPStatus.P
* bcs .7 * bcs .7
* lda LDR.SPStatus.Buf * lda LDR.SPStatusBuf
* bpl .7 not a block device * bpl .7 not a block device
* ldx LDR.SlotIdx * ldx LDR.SlotIdx
@ -718,12 +715,12 @@ LDR.AddBlkDevs php how many drives (carry).
.1 stx DEVCNT save updated device count. .1 stx DEVCNT save updated device count.
asl shift # of drives back into carry. asl shift # of drives back into carry.
lda driveradr get high address of device driver. lda LDR.driveradr get high address of device driver.
sta DEVPTRS,y device driver table 1. sta DEVPTRS,y device driver table 1.
bcc .2 branch if single drive. bcc .2 branch if single drive.
sta DEVPTRS+16,y device driver table 2. sta DEVPTRS+16,y device driver table 2.
.2 lda driveradr+1 .2 lda LDR.driveradr+1
sta DEVPTRS+1,y sta DEVPTRS+1,y
bcc .3 bcc .3
sta DEVPTRS+17,y sta DEVPTRS+17,y
@ -737,18 +734,16 @@ LDR.AddExtraSPDevs
lda (idxl),y lda (idxl),y
clc clc
adc #$03 add 3 for smartport call adc #$03 add 3 for smartport call
sta spvect+1 sta LDR.SPVect+1
lda idxl+1 lda idxl+1
sta spvect+2 sta LDR.SPVect+2
jsr LDR.SetDevID set up device attributes jsr LDR.SetDevID set up device attributes
stz LDR.SPStatus.U
jsr spvect do a status call on smartport itself lda #0
.HS 00 jsr LDR.SPStatusCall do a status call on smartport itself
.DA LDR.SPStatus.P
lda LDR.SPStatus.Buf # of devices on smartport lda LDR.SPStatusBuf # of devices on smartport
cmp #$03 cmp #$03
bcc .8 only 2 devices,skip to next one. bcc .8 only 2 devices,skip to next one.
@ -759,17 +754,17 @@ LDR.AddExtraSPDevs
lda #3 lda #3
sta LDR.SPStatus.U sta LDR.SPStatus.U
.1 jsr LDR.SPStatusCall.U do status call
.1 jsr spvect do status call lda LDR.SPStatusBuf is this a block device?
.HS 00
.DA LDR.SPStatus.P
lda LDR.SPStatus.Buf is this a block device?
bpl .2 bpl .2
jsr LDR.MountSPDevs jsr LDR.MountSPDevs
bcs .8 bcs .8
.2 inc LDR.SPStatus.U .2 inc LDR.SPStatus.U
dec LDR.DevCnt dec LDR.DevCnt
bne .1 bne .1
@ -799,13 +794,13 @@ LDR.MountSPDevs ldx #LDR.DEVPTRS.CNT-1
tax tax
lda LDR.SPStatus.U lda LDR.SPStatus.U
sta spunit-1,x store the smartport unit # sta XDOS.SPUnit-1,x store the smartport unit #
lda spvect+1 and entry address. lda LDR.SPVect+1 and entry address.
sta spvectlo-1,x sta XDOS.SPVectLo-1,x
lda spvect+2 lda LDR.SPVect+2
sta spvecthi-1,x sta XDOS.SPVectHi-1,x
lda RROMBNK2 write protect lc ram. lda RROMBNK2 write protect lc ram.
@ -827,9 +822,13 @@ LDR.MountSPDevs ldx #LDR.DEVPTRS.CNT-1
clc clc
rts rts
*-------------------------------------- *--------------------------------------
* self modifying jmp = smartport entry address LDR.SPStatusCall
*-------------------------------------- sta LDR.SPStatus.U device = 2 for SCSI
spvect jmp $0000 self modifying LDR.SPStatusCall.U
LDR.SPVect jsr $0000 self modifying
.HS 00
.DA LDR.SPStatus.P
rts
*-------------------------------------- *--------------------------------------
LDR.CheckDiskID lda CLRC8ROM switch out $C8 ROMs LDR.CheckDiskID lda CLRC8ROM switch out $C8 ROMs
@ -887,59 +886,6 @@ LDR.PrintX ldy LDR.Print.CX
sty LDR.Print.CX sty LDR.Print.CX
rts rts
*-------------------------------------- *--------------------------------------
DS1216E.SIG .HS 5CA33AC55CA33AC5 Reverted 7->0
*--------------------------------------
* id bytes: evens for clock, odds for disk
dskid .HS 082028005803703C
sltbit .HS 0002040810204080
*--------------------------------------
LDR.MLIOL.P .DA #2
.DA #$60
.DA pbuf+1
LDR.MLISETP.P .DA #1
.DA pbuf
.DO READCAT=1
LDR.MLIRB.P .DA #3
.DA #0 unit number
.DA 0 2 byte data buffer
.DA 0 2 byte block number
.FIN
LDR.SPStatus.P .DA #$03 # of parms
LDR.SPStatus.U .DA #$00 unit number (code for smartport stat)
.DA LDR.SPStatus.Buf
.DA #00 status code (0 = general status)
LDR.DEVPTRS.CNT .EQ 14
LDR.DEVPTRS.IDX .DA #$16 S3D2
.DA #$06 S3D1
.DA #$1E S7D2
.DA #$0E S7D1
.DA #$1C S6D2
.DA #$0C S6D1
.DA #$1A S5D2
.DA #$0A S5D1
.DA #$14 S2D2
.DA #$04 S2D1
.DA #$12 S1D2
.DA #$02 S1D1
.DA #$18 S4D2
.DA #$08 S4D1
*--------------------------------------
LDR.Print.CX .BS 1
*--------------------------------------
LDR.SPStatus.Buf .BS 8 8 bytes for smartport call
driveradr .BS 2
LDR.SlotIdx .BS 1
LDR.DevCnt .BS 1
LDR.SlotDevCnt .BS 7
LDR.SlotDevType .BS 7
LDR.cortland .DA #0 cortland loader flag (1 = Cortland)
LDR.BootFlag .DA #0 0 = normal boot, <>0 = return
*--------------------------------------
* 16 bytes moved to $03F0 vectors * 16 bytes moved to $03F0 vectors
*-------------------------------------- *--------------------------------------
LDR.3F0 .DA breakv LDR.3F0 .DA breakv
@ -1003,9 +949,9 @@ patch101 php
xce back to emulation mode xce back to emulation mode
plp plp
rts rts
*--------------------------------------
* copy of the code that goes in the handle * copy of the code that goes in the handle
*--------------------------------------
L2C4D lda 1,s L2C4D lda 1,s
sta 7,s sta 7,s
lda 2,s lda 2,s
@ -1017,6 +963,59 @@ L2C4D lda 1,s
sec sec
rtl rtl
*-------------------------------------- *--------------------------------------
DS1216E.SIG .HS 5CA33AC55CA33AC5 Reverted 7->0
*--------------------------------------
* id bytes: evens for clock, odds for disk
dskid .HS 082028005803703C
sltbit .HS 02040810204080
*--------------------------------------
LDR.MLIOL.P .DA #2
.DA #$60
.DA pbuf+1
LDR.MLISETP.P .DA #1
.DA pbuf
.DO READCAT=1
LDR.MLIRB.P .DA #3
.DA #0 unit number
.DA 0 2 byte data buffer
.DA 0 2 byte block number
.FIN
LDR.SPStatus.P .DA #$03 # of parms
LDR.SPStatus.U .DA #$00 unit number (code for smartport stat)
.DA LDR.SPStatusBuf
.DA #00 status code (0 = general status)
LDR.DEVPTRS.CNT .EQ 14
LDR.DEVPTRS.IDX .DA #$16 S3D2
.DA #$06 S3D1
.DA #$1E S7D2
.DA #$0E S7D1
.DA #$1C S6D2
.DA #$0C S6D1
.DA #$1A S5D2
.DA #$0A S5D1
.DA #$14 S2D2
.DA #$04 S2D1
.DA #$12 S1D2
.DA #$02 S1D1
.DA #$18 S4D2
.DA #$08 S4D1
*--------------------------------------
LDR.Print.CX .DA #0
LDR.cortland .DA #0 cortland loader flag (1 = Cortland)
LDR.BootFlag .DA #0 0 = normal boot, <>0 = return
*--------------------------------------
LDR.SPStatusBuf .BS 8 8 bytes for smartport call
LDR.driveradr .BS 2
LDR.SlotIdx .BS 1
LDR.DevCnt .BS 1
LDR.SlotDevType .BS 7
LDR.SlotDevCnt .BS 7
*--------------------------------------
MAN MAN
SAVE USR/SRC/PRODOS.FX/PRODOS.S.LDR SAVE USR/SRC/PRODOS.FX/PRODOS.S.LDR
LOAD USR/SRC/PRODOS.FX/PRODOS.S LOAD USR/SRC/PRODOS.FX/PRODOS.S

View File

@ -668,9 +668,9 @@ XDOS.SPREMAP ldx #$03 assume 3 parameters.
sta cmdnum sta cmdnum
bne .1 taken if not status call bne .1 taken if not status call
ldy #spstatlist set up memory for the status list buffer ldy #XDOS.SPStatus set up memory for the status list buffer
sty buf fake up the prodos parameters sty buf fake up the prodos parameters
ldy /spstatlist ldy /XDOS.SPStatus
sty buf+1 sty buf+1
stz bloknml set statcode = 0 for simple status call stz bloknml set statcode = 0 for simple status call
@ -679,7 +679,7 @@ XDOS.SPREMAP ldx #$03 assume 3 parameters.
ldx #$01 format has only 1 parameter. ldx #$01 format has only 1 parameter.
.2 stx statparms set # of parms. .2 stx XDOS.SPParams set # of parms.
lda unitnum DSSS0000 lda unitnum DSSS0000
lsr turn unit number into an index lsr turn unit number into an index
@ -688,31 +688,31 @@ XDOS.SPREMAP ldx #$03 assume 3 parameters.
lsr lsr
tax range = 1-15 tax range = 1-15
lda spunit-1,x get the smartport unit number and lda XDOS.SPUnit-1,x get the smartport unit number and
sta sp_unitnum store into smartport parm list. sta XDOS.SPParams.U store into smartport parm list.
lda spvectlo-1,x lda XDOS.SPVectLo-1,x
sta sp_vector+1 copy smartport entry address sta sp_vector+1 copy smartport entry address
lda spvecthi-1,x lda XDOS.SPVectHi-1,x
sta sp_vector+2 sta sp_vector+2
ldx #$04 copy buffer pointer and block # ldx #$04 copy buffer pointer and block #
.3 lda buf-1,x from prodos parameters .3 lda buf-1,x from prodos parameters
sta sp_bufptr-1,x to smartport parameter block sta XDOS.SPParams.B-1,x to smartport parameter block
dex dex
bne .3 bne .3
sp_vector jsr $0000 smartport call (entry address gets modified) sp_vector jsr $0000 smartport call (entry address gets modified)
cmdnum .HS 00 command # cmdnum .HS 00 command #
.DA statparms .DA XDOS.SPParams
bcs .9 bcs .9
ldx cmdnum status call ? ldx cmdnum status call ?
bne .9 no... bne .9 no...
ldx spstatlist+1 else get the block count ldx XDOS.SPStatus+1 else get the block count
ldy spstatlist+2 ldy XDOS.SPStatus+2
lda spstatlist get the returned status. lda XDOS.SPStatus get the returned status.
bit #$10 is there a disk present ? bit #$10 is there a disk present ?
beq .8 beq .8
@ -727,9 +727,9 @@ cmdnum .HS 00 command #
sec sec
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
statparms .HS 03 # of parms (always 3 except format) XDOS.SPParams .HS 03 # of parms (always 3 except format)
sp_unitnum .HS 00 unit number XDOS.SPParams.U .HS 00 unit number
sp_bufptr .HS 0000 data buffer XDOS.SPParams.B .HS 0000 data buffer
.HS 000000 block number (3 bytes) .HS 000000 block number (3 bytes)
*-------------------------------------- *--------------------------------------
* data tables * data tables
@ -927,17 +927,17 @@ XDOS.DATA.LEN0 .EQ *-XDOS.DATA
* variables used by mli for smartport interface * variables used by mli for smartport interface
spstatlist .HS 00000000 XDOS.SPStatus .HS 00000000
spunit .HS 00000000000000 14+1 for S0D2 XDOS.SPUnit .HS 00000000000000 14+1 for S0D2
.HS 00 .HS 00
.HS 00000000000000 .HS 00000000000000
spvectlo .HS 00000000000000 storage for low byte of smartport entry. XDOS.SPVectLo .HS 00000000000000 storage for low byte of smartport entry.
.HS 00 .HS 00
.HS 00000000000000 .HS 00000000000000
spvecthi .HS 00000000000000 storage for high byte of smartport entry. XDOS.SPVectHi .HS 00000000000000 storage for high byte of smartport entry.
.HS 00 .HS 00
.HS 00000000000000 .HS 00000000000000

View File

@ -2,33 +2,43 @@ NEW
AUTO 3,1 AUTO 3,1
*-------------------------------------- *--------------------------------------
XRW.START cld $D8 to flag language card bank 1 (main) XRW.START cld $D8 to flag language card bank 1 (main)
jsr rsetphse
lda unitnum get unit number.
and #$7F mask off high bit.
tax
lda phaseoff+0,x make sure all motor phases are off.
lda phaseoff+2,x
lda phaseoff+4,x
lda phaseoff+6,x
lda q7l,x turn off write enable lda q7l,x turn off write enable
nop nop
nop nop
jsr docheck jsr docheck
bcs L5334 branch if block # is out of range bcs .9 branch if block # is out of range
ldy #$05 ldy #$05
L5310 asl .1 asl
rol ibtrk rol ibtrk
dey dey
bne L5310 bne .1
asl asl
bcc L531C bcc .2
ora #$10 adjust for upper 4 bits of track ora #$10 adjust for upper 4 bits of track
L531C lsr .2 lsr
lsr lsr
lsr lsr
lsr lsr
pha save sector # across call pha save sector # across call
jsr regrwts jsr regrwts
pla pla
bcs L5330 if error bcs .3 if error
inc buf+1 inc buf+1
adc #$02 adc #$02
@ -36,13 +46,13 @@ L531C lsr
dec buf+1 dec buf+1
L5330 lda ibstat .3 lda ibstat
rts rts
L5334 lda #MLI.E.IO .9 lda #MLI.E.IO
sec sec
rts rts
*--------------------------------------
* read/write a track/sector * read/write a track/sector
regrwts ldy #$01 retry count regrwts ldy #$01 retry count
@ -59,6 +69,7 @@ regrwts ldy #$01 retry count
* now check if the motor is on, then start it * now check if the motor is on, then start it
jsr chkdrv jsr chkdrv
php save test results php save test results
lda #$E8 lda #$E8
sta montimeh sta montimeh
@ -74,14 +85,20 @@ regrwts ldy #$01 retry count
L5362 lda drv0en,x L5362 lda drv0en,x
plp was it the same drive ? plp was it the same drive ?
beq L5372 yes. beq L5372 yes.
plp indicate drive off by setting z-flag. plp indicate drive off by setting z-flag.
ldy #$07 150ms delay before stepping. ldy #$07 150ms delay before stepping.
L536B jsr mswait L536B jsr mswait
dey dey
bne L536B bne L536B
php now zero flag set. php now zero flag set.
L5372 lda A4L make sure this command needs seeking. L5372 lda A4L make sure this command needs seeking.
beq L537C branch if status check. beq L537C branch if status check.
lda ibtrk get destination track lda ibtrk get destination track
jsr myseek and go to it. jsr myseek and go to it.
@ -108,9 +125,12 @@ L537F lda #$01 wait 100us for each count in montime
L538E lda A4L get command # L538E lda A4L get command #
beq L53FD if 0 then status command beq L53FD if 0 then status command
lsr set carry = 1 for read, 0 for write. lsr set carry = 1 for read, 0 for write.
bcs L5398 must prenibblize for write bcs L5398 must prenibblize for write
jsr prenib16 jsr prenib16
L5398 ldy #$40 64 retries L5398 ldy #$40 64 retries
sty retrycnt sty retrycnt
L539D ldx A2L get slot #. L539D ldx A2L get slot #.
@ -141,8 +161,11 @@ L53BE ldy track check track
lda curtrk preserve destination track lda curtrk preserve destination track
pha pha
tya tya
asl asl
L53CC jsr settrk
L53CC jsr drvindx get index to drive #
sta iobpdn,x set the slot dependent track location
pla pla
jsr myseek jsr myseek
bcc L539D always taken, go recalibrate bcc L539D always taken, go recalibrate
@ -155,8 +178,10 @@ L53D5 lda sect is this the right sector ?
lda A4L read or write ? lda A4L read or write ?
lsr the carry will tell. lsr the carry will tell.
bcc L53F4 branch if write bcc L53F4 branch if write
jsr read16 jsr read16
bcs L53A4 if bad read bcs L53A4 if bad read
L53E7 lda #$00 L53E7 lda #$00
.HS D0 bne branch never taken (skip 1 byte) .HS D0 bne branch never taken (skip 1 byte)
hndlerr sec hndlerr sec
@ -164,6 +189,7 @@ hndlerr sec
ldx A2L slot offset ldx A2L slot offset
lda motoroff,x turn off lda motoroff,x turn off
rts rts
*--------------------------------------
L53F4 jsr write16 write nibbles L53F4 jsr write16 write nibbles
statdne bcc L53E7 if no errors. statdne bcc L53E7 if no errors.
lda #$2B disk write protected. lda #$2B disk write protected.
@ -174,11 +200,13 @@ L53FD ldx A2L
rol write protect-->carry-->bit 0=1 rol write protect-->carry-->bit 0=1
lda q6l,x keep in read mode lda q6l,x keep in read mode
jmp statdne jmp statdne
*--------------------------------------
myseek asl assume two phase stepper myseek asl assume two phase stepper
sta track save destination track * 2 sta track save destination track * 2
jsr alloff turn all phases off to be sure. jsr alloff turn all phases off to be sure.
jsr drvindx get index to previous track jsr drvindx get index to previous track
lda iobpdn,x for current drive. lda iobpdn,x for current drive.
sta curtrk current position. sta curtrk current position.
lda track where to go next. lda track where to go next.
@ -187,10 +215,12 @@ myseek asl assume two phase stepper
jsr seek move head there jsr seek move head there
alloff ldy #$03 turn off all phases before returning. alloff ldy #$03 turn off all phases before returning.
L5427 tya (send phase in acc)
jsr clrphase carry clear, phases should be turned off .1 tya (send phase in acc)
jsr XRW.NewSeek.TrOnOff carry clear, phases should be turned off
dey dey
bpl L5427 bpl .1
lsr curtrk divide back down lsr curtrk divide back down
clc clc
rts rts
@ -210,7 +240,7 @@ L5427 tya (send phase in acc)
* montimel,h are incremented by the # of 100us quantums required by * montimel,h are incremented by the # of 100us quantums required by
* seek for motor on time overlap. * seek for motor on time overlap.
* *
* variables used: curtrk, trkn, countn, prior, A2L, montimel, montimeh * variables used: curtrk, trkn, trkcnt, prior, A2L, montimel, montimeh
*-------------------------------------- *--------------------------------------
.DO FASTSEEK=0 .DO FASTSEEK=0
seek sta trkn save target track. seek sta trkn save target track.
@ -251,7 +281,7 @@ L5468 jsr setphase
lda prior lda prior
clc for phaseoff clc for phaseoff
jsr clrphase turn off prior phase jsr XRW.NewSeek.TrOnOff turn off prior phase
lda offtable,y then wait 'offtime' lda offtable,y then wait 'offtime'
jsr mswait (100us intervals) jsr mswait (100us intervals)
@ -264,57 +294,58 @@ L5483 jsr mswait settle 25 msec
clc set for phase off clc set for phase off
setphase lda curtrk get current track setphase lda curtrk get current track
.FIN
*--------------------------------------
.DO FASTSEEK=1
seek sta trkn
clrphase and #$03 mask for 1 of 4 phases XRW.NewSeek.1 lda curtrk
sta prior
cmp trkn
beq XRW.NewSeek.TrOff
bcs .2 curtrk > trkn : must move out
inc curtrk
bra .3
.2 dec curtrk
.3 lda prior
clc OFF
jsr XRW.NewSeek.TrOnOff
lda curtrk
sec ON
jsr XRW.NewSeek.TrOnOff
lda #40
* jsr mswait
sec
.4 pha
.5 sbc #1
bne .5
pla
sbc #1
bne .4
bra XRW.NewSeek.1
XRW.NewSeek.TrOff
clc
.FIN
XRW.NewSeek.TrOnOff
and #$03 mask for 1 of 4 phases
rol double for phase on(CS)/off(CC) index rol double for phase on(CS)/off(CC) index
ora A2L Slot $n0 ora A2L Slot $n0
tax tax
lda phaseoff,x turn on/off one phase lda phaseoff,x turn on/off one phase
ldx A2L restore x reg * ldx A2L restore x reg
rts and return rts and return
.FIN
*--------------------------------------
.DO FASTSEEK=1
XRW.NewSeek STA $26
.1 LDA $FF
STA $27
SEC
SBC $26
BEQ XRW.NewSeek.rts
BCS .2
INC $FF
BCC .3
.2 DEC $FF
.3 JSR XRW.NewSeek.TrOff
JSR XRW.NewSeek.Wait
XRW.NewSeek.TrOn
LDA $27
AND #$03
ASL
TAY
LDA $C0E0,Y
JSR XRW.NewSeek.Wait
BEQ .1
XRW.NewSeek.TrOff
LDA $FF
AND #$03
ASL
TAY
LDA $C0E1,Y
XRW.NewSeek.rts
rts
XRW.NewSeek.Wait
LDA #$25
JMP $FCA8 F8ROM:WAIT
.FIN
*-------------------------------------- *--------------------------------------
* 7-bit to 6-bit 'deniblize' table (16-sector format) * 7-bit to 6-bit 'deniblize' table (16-sector format)
* *
@ -620,12 +651,6 @@ L57CD pla place last byte into user buffer
sta (buf),y sta (buf),y
rts rts
* set the slot dependent track location
settrk jsr drvindx get index to drive #
sta iobpdn,x
rts
* determine if motor is stopped * determine if motor is stopped
* *
* if stopped, controller's shift register will not be changing. * if stopped, controller's shift register will not be changing.
@ -930,19 +955,7 @@ L59A6 lda iobpdn
lda montimeh lda montimeh
bne L59A6 bne L59A6
L59BD rts L59BD rts
*--------------------------------------
rsetphse lda unitnum get unit number.
and #$7F mask off high bit.
tax
* clear all the phases and force read mode
lda phaseoff+0,x make sure all motor phases are off.
lda phaseoff+2,x
lda phaseoff+4,x
lda phaseoff+6,x
rts
docheck lda A4L command #. docheck lda A4L command #.
cmp #$04 is the command allowed ? cmp #$04 is the command allowed ?
bcs .9 if not. bcs .9 if not.

View File

@ -9,7 +9,7 @@ READCAT .EQ 0 Boot Block read Catalog at $C00
ENHFILENAME .EQ 1 ENHFILENAME .EQ 1
LOWERCASE .EQ 1 LOWERCASE .EQ 1
ACL .EQ 1 ACL .EQ 1
FASTSEEK .EQ 0 FASTSEEK .EQ 1
FASTWRITE .EQ 0 FASTWRITE .EQ 0
*-------------------------------------- *--------------------------------------
.INB INC/ZP.I .INB INC/ZP.I

View File

@ -23,24 +23,53 @@ Kernel.Init2 sei
>LDYA PAKME.MAIN >LDYA PAKME.MAIN
>STYA ZPInBufPtr >STYA ZPInBufPtr
>LDYAI CORE.Run >LDYAI CORE.Run
>STYA ZPOutBufPtr jsr A2osX.Unpak
jsr X.Unpak
sta SETWRITEAUX
>LDYA PAKME.AUX >LDYA PAKME.AUX
>STYA ZPInBufPtr >STYA ZPInBufPtr
>LDYAI Mem.XHiMem >LDYAI $9F00
>STYA ZPOutBufPtr jsr A2osX.Unpak
jsr X.Unpak
sta CLRWRITEAUX >LDYAI $9F00
>STYA ZPPtr1
>LDYAI Mem.XHiMem
>STYA ZPPtr2
lda #A2osX.AUX.S
eor #$ff
tax
lda /A2osX.AUX.S
eor #$ff
pha
ldy #0
sta SETWRITEAUX
.2 inx
bne .3
pla
inc
beq .4
pha
.3 lda (ZPPtr1),y
sta (ZPPtr2),y
iny
bne .2
inc ZPPtr1+1
inc ZPPtr2+1
bra .2
.4 sta CLRWRITEAUX
>LDYA PAKME.GP >LDYA PAKME.GP
>STYA ZPInBufPtr >STYA ZPInBufPtr
>LDYAI A2osX.SYSCALL >LDYAI A2osX.SYSCALL
>STYA ZPOutBufPtr jsr A2osX.Unpak
jsr X.Unpak
sta SETALTZP sta SETALTZP
bit RRAMWRAMBNK2 bit RRAMWRAMBNK2
@ -49,8 +78,7 @@ Kernel.Init2 sei
>LDYA PAKME.D2 >LDYA PAKME.D2
>STYA ZPInBufPtr >STYA ZPInBufPtr
>LDYAI $D000 >LDYAI $D000
>STYA ZPOutBufPtr jsr A2osX.Unpak
jsr X.Unpak
bit RRAMWRAMBNK1 bit RRAMWRAMBNK1
bit RRAMWRAMBNK1 bit RRAMWRAMBNK1
@ -58,14 +86,12 @@ Kernel.Init2 sei
>LDYA PAKME.D1 >LDYA PAKME.D1
>STYA ZPInBufPtr >STYA ZPInBufPtr
>LDYAI $D000 >LDYAI $D000
>STYA ZPOutBufPtr jsr A2osX.Unpak
jsr X.Unpak
>LDYA PAKME.E0 >LDYA PAKME.E0
>STYA ZPInBufPtr >STYA ZPInBufPtr
>LDYAI $E000 >LDYAI $E000
>STYA ZPOutBufPtr jsr A2osX.Unpak
jsr X.Unpak
bit RROMBNK1 bit RROMBNK1
sta CLRALTZP sta CLRALTZP
@ -317,13 +343,7 @@ SysScrInit >LDYAI Mem.XHiMem
dex dex
bne .1 bne .1
>LDYA FD.TTY+S.FD.DEV.BUFPTR * clc
sta SETWRITEAUX
>STYA Mem.HiMem
>STYA Mem.Free
sta CLRWRITEAUX
clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
SysScrInit.TTYPtrs SysScrInit.TTYPtrs
@ -350,10 +370,17 @@ SysScrInit.TTYPtrs
sec sec
sbc #TTY.BUF.SIZE sbc #TTY.BUF.SIZE
sta FD.TTY+S.FD.DEV.BUFPTR sta FD.TTY+S.FD.DEV.BUFPTR
tay
lda FD.TTY+S.FD.DEV.BUFPTR+1 lda FD.TTY+S.FD.DEV.BUFPTR+1
sbc /TTY.BUF.SIZE sbc /TTY.BUF.SIZE
sta FD.TTY+S.FD.DEV.BUFPTR+1 sta FD.TTY+S.FD.DEV.BUFPTR+1
sta SETWRITEAUX
>STYA Mem.HiMem
>STYA Mem.Free
sta CLRWRITEAUX
rts rts
*-------------------------------------- *--------------------------------------
* http://www.1000bit.it/support/manuali/apple/technotes/misc/tn.misc.02.html * http://www.1000bit.it/support/manuali/apple/technotes/misc/tn.misc.02.html
@ -842,14 +869,19 @@ IrqMgrInit.TClock
stz ZPPtr1 Try finding a TClock Card... stz ZPPtr1 Try finding a TClock Card...
lda #$C1 lda #$C1
sta ZPPtr1+1 sta ZPPtr1+1
.1 ldy #TClock.SIG.Cnt-1
.1 ldx #TClock.SIG-TClock.OFS-1
.2 lda (ZPPtr1),y .2 ldy TClock.OFS,x
cmp TClock.SIG,y lda (ZPPtr1),y
cmp TClock.SIG,x
bne .3 bne .3
dey dey
bpl .2 bpl .2
bra .4 bra .4
.3 inc ZPPtr1+1 no match, try next slot.... .3 inc ZPPtr1+1 no match, try next slot....
lda ZPPtr1+1 lda ZPPtr1+1
cmp #$C8 cmp #$C8
@ -892,6 +924,7 @@ IrqMgrInit.Mouse
stz ZPPtr1 Try finding a Mouse Card... stz ZPPtr1 Try finding a Mouse Card...
lda #$C1 lda #$C1
sta ZPPtr1+1 sta ZPPtr1+1
.1 ldx #Mouse.SIG-Mouse.OFS-1 .1 ldx #Mouse.SIG-Mouse.OFS-1
.2 ldy Mouse.OFS,x .2 ldy Mouse.OFS,x
@ -977,11 +1010,8 @@ IrqMgrInit.HZ2Tick
*-------------------------------------- *--------------------------------------
EvtMgrInit >LDYAI MSG.EVT EvtMgrInit >LDYAI MSG.EVT
>SYSCALL2 puts >SYSCALL2 puts
stz CORE.EvtCount stz CORE.EvtCount
lda #$A5
sta A2osX.RANDOM16
lda #$9B
sta A2osX.RANDOM16+1
lda /Evt.Table lda /Evt.Table
sta pEvent+1 sta pEvent+1
@ -1077,7 +1107,7 @@ PwdMgrInit >LDYAI MSG.PWD
PwdMgrInit.Load >PUSHYA PwdMgrInit.Load >PUSHYA
>PUSHBI O.RDONLY >PUSHBI O.RDONLY
>PUSHBI S.FI.T.TXT >PUSHBI S.FI.T.TXT
>PUSHWZ Aux type >PUSHWZ Aux type
>SYSCALL2 LoadStkObj >SYSCALL2 LoadStkObj
rts rts
*-------------------------------------- *--------------------------------------
@ -1110,9 +1140,8 @@ Z80Code.Size .EQ *-Z80Code.Start
Mouse.OFS .HS 05070B0CFB Mouse.OFS .HS 05070B0CFB
Mouse.SIG .HS 38180120D6 Mouse.SIG .HS 38180120D6
*-------------------------------------- *--------------------------------------
TClock.SIG .HS 0878282c58ff700538b00118b8087848 TClock.OFS .HS 01030507
.HS 8a489848adffcf201ac86868ba8df807 TClock.SIG .HS 08285870
TClock.SIG.Cnt .EQ *-TClock.SIG
*-------------------------------------- *--------------------------------------
MSG.Init2 .AZ "A2osX[Stage2]:Init\nRelocating Kernel...\n" MSG.Init2 .AZ "A2osX[Stage2]:Init\nRelocating Kernel...\n"
MSG.HZ .AZ "Kernel SYS Timer Set For %d0 hz Machine.\n" MSG.HZ .AZ "Kernel SYS Timer Set For %d0 hz Machine.\n"
@ -1154,7 +1183,6 @@ MSG.EVT .AZ "Event Manager..."
MSG.TSK .AZ "Task Manager..." MSG.TSK .AZ "Task Manager..."
MSG.PWD .AZ "Password Manager..." MSG.PWD .AZ "Password Manager..."
MSG.CTRLR .AZ "Ctrl-R Pressed, entering ROOT mode..." MSG.CTRLR .AZ "Ctrl-R Pressed, entering ROOT mode..."
MSG.PWDINIT .AZ "Loading ETC/PASSWD file..."
MSG.EXEC .AZ "Executing %s..." MSG.EXEC .AZ "Executing %s..."
MSG.StartupErr .AZ "Failed : [$%h]\r\n" MSG.StartupErr .AZ "Failed : [$%h]\r\n"
MSG.Init3.OK .AZ "OK\r\nA2osX[Stage3]:Complete.\r\n" MSG.Init3.OK .AZ "OK\r\nA2osX[Stage3]:Complete.\r\n"

View File

@ -67,9 +67,11 @@ NEW
* + %2f : '3.14' * + %2f : '3.14'
*\-------------------------------------- *\--------------------------------------
.DUMMY .DUMMY
.OR ZPTMP+5 3 Bytes .OR ZPTMP+5 5 Bytes
PrintF.Cnt .BS 2 PrintF.Cnt .BS 2
PrintF.hFILE .BS 1 PrintF.hFILE .BS 1
STDIO.StackBytePtr .BS 1
STDIO.ExitPopCnt .BS 1
.ED .ED
*-------------------------------------- *--------------------------------------
K.PrintF.PadL .EQ FAC+5 K.PrintF.PadL .EQ FAC+5
@ -87,8 +89,13 @@ K.FPrintf ldx #2
*-------------------------------------- *--------------------------------------
K.SPrintf ldx #3 K.SPrintf ldx #3
*-------------------------------------- *--------------------------------------
K.PrintF.1 jsr PrintF.GetParams K.PrintF.1 sec format string->ptr2
sty STDIO.Exit.Cnt+1 Total bytes to POP jsr STDIO.GetParams
stx pIOBuf
sta pIOBuf+1 Output buffer->pIOBuf
sty STDIO.ExitPopCnt Total bytes to POP
.1 jsr SHARED.GetCharPtr2 .1 jsr SHARED.GetCharPtr2
bne .22 bne .22
@ -392,57 +399,6 @@ PrintF.PutC phy
.9 lda #E.BUF .9 lda #E.BUF
sec sec
PrintF.PutC.RTS rts PrintF.PutC.RTS rts
*--------------------------------------
* Y = Bytecount
* X = 3 : get format & buffer
* X = 2 : get format & hFile
* X = 1 : get format only
*--------------------------------------
PrintF.GetParams
stz PrintF.Cnt
stz PrintF.Cnt+1
lda (pStack) Bytecount
tay
sty STDIO.GetStackByte.ptr+1
iny
lda (pStack),y format LO
sta ZPPtr2
iny
lda (pStack),y format HI
sta ZPPtr2+1
dex
beq .1
dex
beq .2
.3 stz PrintF.hFILE
iny
lda (pStack),y str LO
sta pIOBuf
iny
lda (pStack),y str HI
sta pIOBuf+1
rts
.2 iny
lda (pStack),y hFILE
sta PrintF.hFILE
.1 lda #K.IOBuf
sta pIOBuf
lda /K.IOBuf
sta pIOBuf+1
rts
*/-------------------------------------- */--------------------------------------
* # ScanF (BLOCKING) * # ScanF (BLOCKING)
* # FScanF (BLOCKING) * # FScanF (BLOCKING)
@ -500,8 +456,13 @@ K.FScanF ldx #2
*-------------------------------------- *--------------------------------------
K.SScanF ldx #3 K.SScanF ldx #3
*-------------------------------------- *--------------------------------------
K.SScanF.1 jsr ScanF.GetParams Ptr1=format, ptr2=buffer K.SScanF.1 clc format string->ptr1
sty STDIO.Exit.Cnt+1 Total bytes to POP jsr STDIO.GetParams
stx ZPPtr2
sta ZPPtr2+1 Output buffer->ZPPtr2
sty STDIO.ExitPopCnt Total bytes to POP
ldx PrintF.hFILE ldx PrintF.hFILE
beq .1 beq .1
@ -637,28 +598,44 @@ K.SScanF.S ldy #$ff
K.SScanF.Fwd jmp SHARED.AddYToPtr2 Y=char count parsed K.SScanF.Fwd jmp SHARED.AddYToPtr2 Y=char count parsed
*-------------------------------------- *--------------------------------------
* Y = Bytecount * IN:
* CC : format in ZPPtr1
* CS : format in ZPPtr2
* X = 3 : get format & buffer * X = 3 : get format & buffer
* X = 2 : get format & hFile * X = 2 : get format & hFile
* X = 1 : get format only * X = 1 : get format only
* OUT:
* X = Buf LO
* A = Buf HI
* format on stack
* Y = BytePtr
*-------------------------------------- *--------------------------------------
ScanF.GetParams stz PrintF.Cnt STDIO.GetParams stz PrintF.Cnt
stz PrintF.Cnt+1 stz PrintF.Cnt+1
lda (pStack) Bytecount lda (pStack) Bytecount
tay tay
sty STDIO.GetStackByte.ptr+1 sty STDIO.StackBytePtr
iny iny
lda (pStack),y format LO lda (pStack),y format LO
sta ZPPtr1 pha
iny iny
lda (pStack),y format HI lda (pStack),y format HI
bcs .10
sta ZPPtr1+1 sta ZPPtr1+1
pla
sta ZPPtr1
bra .11
dex .10 sta ZPPtr2+1
pla
sta ZPPtr2
.11 dex
beq .1 beq .1
dex dex
@ -668,34 +645,36 @@ ScanF.GetParams stz PrintF.Cnt
iny iny
lda (pStack),y str LO lda (pStack),y str LO
sta ZPPtr2 tax
iny iny
lda (pStack),y str HI lda (pStack),y str HI
sta ZPPtr2+1
rts rts
.2 iny .2 iny
lda (pStack),y hFILE lda (pStack),y hFILE
sta PrintF.hFILE sta PrintF.hFILE
.1 lda #K.IOBuf .1 ldx #K.IOBuf
sta ZPPtr2
lda /K.IOBuf lda /K.IOBuf
sta ZPPtr2+1
STDIO.GetParams.RTS
rts rts
*-------------------------------------- *--------------------------------------
STDIO.GetStackByte STDIO.GetStackPtr
jsr STDIO.GetStackByte
bcs STDIO.GetParams.RTS
tax
*--------------------------------------
STDIO.GetStackByte
phy phy
STDIO.GetStackByte.ptr
ldy #$ff SELF MODIFIED ldy STDIO.StackBytePtr
beq .9 beq .9
lda (pStack),y lda (pStack),y
dey dec STDIO.StackBytePtr
sty STDIO.GetStackByte.ptr+1
ply ply
clc clc
@ -712,7 +691,7 @@ STDIO.Exit php
lda pStack lda pStack
sec sec
STDIO.Exit.Cnt adc #$ff SELF MODIFIED adc STDIO.ExitPopCnt
sta pStack sta pStack
pla pla

View File

@ -20,6 +20,8 @@ NEW
.INB USR/SRC/SYS/KERNEL.S.DEF .INB USR/SRC/SYS/KERNEL.S.DEF
.INB USR/SRC/SYS/KERNEL.S.INIT .INB USR/SRC/SYS/KERNEL.S.INIT
.INB USR/SRC/SHARED/X.PRINTF.S .INB USR/SRC/SHARED/X.PRINTF.S
A2osX.Unpak >STYA ZPOutBufPtr
.INB USR/SRC/SHARED/X.UNPAK.S .INB USR/SRC/SHARED/X.UNPAK.S
PAKME.Table PAKME.Table