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
.BS 1
*--------------------------------------
*SYSKERNEL >PSTR "sys/kernel.PAKED"
SYSKERNEL >PSTR "sys/kernel"
*--------------------------------------
MSG.INIT1 >PSTR "A2osX[Stage1]:Init"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -529,7 +529,9 @@ LDR.BlkDevScan stz idxl
lda #7
sta LDR.SlotIdx
.1 lda LDR.SlotIdx
.1 ldx LDR.SlotIdx
stz LDR.SlotDevType-1,x
jsr LDR.CheckDiskID
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
lda #RWTS
sta driveradr
sta LDR.driveradr
lda /RWTS
sta driveradr+1
sta LDR.driveradr+1
sec 2 devices
jsr LDR.AddBlkDevs
bra .7
@ -577,15 +579,15 @@ LDR.BlkDevScan stz idxl
iny $CnFF
lda (idxl),y
sta driveradr
sta LDR.driveradr
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
jsr LDR.AddBlkDevs install 1 or 2 devices from this slot.
.7 ldx LDR.SlotIdx
lda sltbit,x
lda sltbit-1,x
tsb rommap mark bit to flag rom present
.8 dec idxl+1 next lower slot.
@ -610,8 +612,10 @@ LDR.AddExtraDevs
jsr LDR.AddExtraSPDevs
.8 dec LDR.SlotIdx
.8 dec idxl+1
dec LDR.SlotIdx
bne .1
LDR.AddExtraDevs.RTS
rts
*--------------------------------------
@ -620,15 +624,15 @@ LDR.AddSPDevs jsr LDR.SetDevID setup the devid byte from attributes
iny #$ff
lda (idxl),y
sta driveradr
sta LDR.driveradr
sta .1+1 modify operand
clc
adc #$03
sta spvect+1
sta LDR.SPVect+1
lda idxl+1
sta driveradr+1
sta spvect+2
sta LDR.driveradr+1
sta LDR.SPVect+2
sta .1+2 modify operand
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
* ldy #$FB
* lda (idxl),y check device id
* and #$02 SCSI?
* beq .2 no, no need to init Cocoon
ldy #$FB
lda (idxl),y check device id
and #$02 SCSI ?
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
* .HS 00
* .DA LDR.SPStatus.P ignore any errors.
.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
.2 lda #0 set unit# = 0
jsr LDR.SPStatusCall
lda LDR.SPStatusBuf Device count
beq LDR.AddExtraDevs.RTS no devices, so done.
* sta LDR.DevCnt
@ -672,12 +671,10 @@ LDR.AddSPDevs jsr LDR.SetDevID setup the devid byte from attributes
*.3 inc LDR.SPStatus.U
* jsr spvect call to get the device status
* .HS 00 this is a status call
* .DA LDR.SPStatus.P
* jsr LDR.SPStatusCall.U call to get the device status
* bcs .7
* lda LDR.SPStatus.Buf
* lda LDR.SPStatusBuf
* bpl .7 not a block device
* ldx LDR.SlotIdx
@ -718,12 +715,12 @@ LDR.AddBlkDevs php how many drives (carry).
.1 stx DEVCNT save updated device count.
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.
bcc .2 branch if single drive.
sta DEVPTRS+16,y device driver table 2.
.2 lda driveradr+1
.2 lda LDR.driveradr+1
sta DEVPTRS+1,y
bcc .3
sta DEVPTRS+17,y
@ -737,18 +734,16 @@ LDR.AddExtraSPDevs
lda (idxl),y
clc
adc #$03 add 3 for smartport call
sta spvect+1
sta LDR.SPVect+1
lda idxl+1
sta spvect+2
sta LDR.SPVect+2
jsr LDR.SetDevID set up device attributes
stz LDR.SPStatus.U
jsr spvect do a status call on smartport itself
.HS 00
.DA LDR.SPStatus.P
lda #0
jsr LDR.SPStatusCall do a status call on smartport itself
lda LDR.SPStatus.Buf # of devices on smartport
lda LDR.SPStatusBuf # of devices on smartport
cmp #$03
bcc .8 only 2 devices,skip to next one.
@ -759,17 +754,17 @@ LDR.AddExtraSPDevs
lda #3
sta LDR.SPStatus.U
.1 jsr LDR.SPStatusCall.U do status call
.1 jsr spvect do status call
.HS 00
.DA LDR.SPStatus.P
lda LDR.SPStatus.Buf is this a block device?
lda LDR.SPStatusBuf is this a block device?
bpl .2
jsr LDR.MountSPDevs
bcs .8
.2 inc LDR.SPStatus.U
dec LDR.DevCnt
bne .1
@ -799,13 +794,13 @@ LDR.MountSPDevs ldx #LDR.DEVPTRS.CNT-1
tax
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.
sta spvectlo-1,x
lda LDR.SPVect+1 and entry address.
sta XDOS.SPVectLo-1,x
lda spvect+2
sta spvecthi-1,x
lda LDR.SPVect+2
sta XDOS.SPVectHi-1,x
lda RROMBNK2 write protect lc ram.
@ -827,9 +822,13 @@ LDR.MountSPDevs ldx #LDR.DEVPTRS.CNT-1
clc
rts
*--------------------------------------
* self modifying jmp = smartport entry address
*--------------------------------------
spvect jmp $0000 self modifying
LDR.SPStatusCall
sta LDR.SPStatus.U device = 2 for SCSI
LDR.SPStatusCall.U
LDR.SPVect jsr $0000 self modifying
.HS 00
.DA LDR.SPStatus.P
rts
*--------------------------------------
LDR.CheckDiskID lda CLRC8ROM switch out $C8 ROMs
@ -887,59 +886,6 @@ LDR.PrintX ldy LDR.Print.CX
sty LDR.Print.CX
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
*--------------------------------------
LDR.3F0 .DA breakv
@ -1003,9 +949,9 @@ patch101 php
xce back to emulation mode
plp
rts
*--------------------------------------
* copy of the code that goes in the handle
*--------------------------------------
L2C4D lda 1,s
sta 7,s
lda 2,s
@ -1017,6 +963,59 @@ L2C4D lda 1,s
sec
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
SAVE USR/SRC/PRODOS.FX/PRODOS.S.LDR
LOAD USR/SRC/PRODOS.FX/PRODOS.S

View File

@ -668,9 +668,9 @@ XDOS.SPREMAP ldx #$03 assume 3 parameters.
sta cmdnum
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
ldy /spstatlist
ldy /XDOS.SPStatus
sty buf+1
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.
.2 stx statparms set # of parms.
.2 stx XDOS.SPParams set # of parms.
lda unitnum DSSS0000
lsr turn unit number into an index
@ -688,31 +688,31 @@ XDOS.SPREMAP ldx #$03 assume 3 parameters.
lsr
tax range = 1-15
lda spunit-1,x get the smartport unit number and
sta sp_unitnum store into smartport parm list.
lda spvectlo-1,x
lda XDOS.SPUnit-1,x get the smartport unit number and
sta XDOS.SPParams.U store into smartport parm list.
lda XDOS.SPVectLo-1,x
sta sp_vector+1 copy smartport entry address
lda spvecthi-1,x
lda XDOS.SPVectHi-1,x
sta sp_vector+2
ldx #$04 copy buffer pointer and block #
.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
bne .3
sp_vector jsr $0000 smartport call (entry address gets modified)
cmdnum .HS 00 command #
.DA statparms
.DA XDOS.SPParams
bcs .9
ldx cmdnum status call ?
bne .9 no...
ldx spstatlist+1 else get the block count
ldy spstatlist+2
lda spstatlist get the returned status.
ldx XDOS.SPStatus+1 else get the block count
ldy XDOS.SPStatus+2
lda XDOS.SPStatus get the returned status.
bit #$10 is there a disk present ?
beq .8
@ -727,9 +727,9 @@ cmdnum .HS 00 command #
sec
.9 rts
*--------------------------------------
statparms .HS 03 # of parms (always 3 except format)
sp_unitnum .HS 00 unit number
sp_bufptr .HS 0000 data buffer
XDOS.SPParams .HS 03 # of parms (always 3 except format)
XDOS.SPParams.U .HS 00 unit number
XDOS.SPParams.B .HS 0000 data buffer
.HS 000000 block number (3 bytes)
*--------------------------------------
* data tables
@ -927,17 +927,17 @@ XDOS.DATA.LEN0 .EQ *-XDOS.DATA
* 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 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 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 00000000000000

View File

@ -2,33 +2,43 @@ NEW
AUTO 3,1
*--------------------------------------
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
nop
nop
jsr docheck
bcs L5334 branch if block # is out of range
bcs .9 branch if block # is out of range
ldy #$05
L5310 asl
.1 asl
rol ibtrk
dey
bne L5310
bne .1
asl
bcc L531C
bcc .2
ora #$10 adjust for upper 4 bits of track
L531C lsr
.2 lsr
lsr
lsr
lsr
pha save sector # across call
jsr regrwts
pla
bcs L5330 if error
bcs .3 if error
inc buf+1
adc #$02
@ -36,13 +46,13 @@ L531C lsr
dec buf+1
L5330 lda ibstat
.3 lda ibstat
rts
L5334 lda #MLI.E.IO
.9 lda #MLI.E.IO
sec
rts
*--------------------------------------
* read/write a track/sector
regrwts ldy #$01 retry count
@ -59,6 +69,7 @@ regrwts ldy #$01 retry count
* now check if the motor is on, then start it
jsr chkdrv
php save test results
lda #$E8
sta montimeh
@ -74,14 +85,20 @@ regrwts ldy #$01 retry count
L5362 lda drv0en,x
plp was it the same drive ?
beq L5372 yes.
plp indicate drive off by setting z-flag.
ldy #$07 150ms delay before stepping.
L536B jsr mswait
dey
bne L536B
php now zero flag set.
L5372 lda A4L make sure this command needs seeking.
beq L537C branch if status check.
lda ibtrk get destination track
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 #
beq L53FD if 0 then status command
lsr set carry = 1 for read, 0 for write.
bcs L5398 must prenibblize for write
jsr prenib16
L5398 ldy #$40 64 retries
sty retrycnt
L539D ldx A2L get slot #.
@ -141,8 +161,11 @@ L53BE ldy track check track
lda curtrk preserve destination track
pha
tya
asl
L53CC jsr settrk
asl
L53CC jsr drvindx get index to drive #
sta iobpdn,x set the slot dependent track location
pla
jsr myseek
bcc L539D always taken, go recalibrate
@ -155,8 +178,10 @@ L53D5 lda sect is this the right sector ?
lda A4L read or write ?
lsr the carry will tell.
bcc L53F4 branch if write
jsr read16
bcs L53A4 if bad read
L53E7 lda #$00
.HS D0 bne branch never taken (skip 1 byte)
hndlerr sec
@ -164,6 +189,7 @@ hndlerr sec
ldx A2L slot offset
lda motoroff,x turn off
rts
*--------------------------------------
L53F4 jsr write16 write nibbles
statdne bcc L53E7 if no errors.
lda #$2B disk write protected.
@ -174,11 +200,13 @@ L53FD ldx A2L
rol write protect-->carry-->bit 0=1
lda q6l,x keep in read mode
jmp statdne
*--------------------------------------
myseek asl assume two phase stepper
sta track save destination track * 2
jsr alloff turn all phases off to be sure.
jsr drvindx get index to previous track
lda iobpdn,x for current drive.
sta curtrk current position.
lda track where to go next.
@ -187,10 +215,12 @@ myseek asl assume two phase stepper
jsr seek move head there
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
bpl L5427
bpl .1
lsr curtrk divide back down
clc
rts
@ -210,7 +240,7 @@ L5427 tya (send phase in acc)
* montimel,h are incremented by the # of 100us quantums required by
* 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
seek sta trkn save target track.
@ -251,7 +281,7 @@ L5468 jsr setphase
lda prior
clc for phaseoff
jsr clrphase turn off prior phase
jsr XRW.NewSeek.TrOnOff turn off prior phase
lda offtable,y then wait 'offtime'
jsr mswait (100us intervals)
@ -264,57 +294,58 @@ L5483 jsr mswait settle 25 msec
clc set for phase off
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
ora A2L Slot $n0
tax
lda phaseoff,x turn on/off one phase
ldx A2L restore x reg
* ldx A2L restore x reg
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)
*
@ -620,12 +651,6 @@ L57CD pla place last byte into user buffer
sta (buf),y
rts
* set the slot dependent track location
settrk jsr drvindx get index to drive #
sta iobpdn,x
rts
* determine if motor is stopped
*
* if stopped, controller's shift register will not be changing.
@ -930,19 +955,7 @@ L59A6 lda iobpdn
lda montimeh
bne L59A6
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 #.
cmp #$04 is the command allowed ?
bcs .9 if not.

View File

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

View File

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

View File

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

View File

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