A2osX/SYS/KERNEL.S.DRV.txt

587 lines
11 KiB
Plaintext
Raw Normal View History

2017-12-22 21:24:30 +00:00
NEW
PREFIX /A2OSX.BUILD
2017-12-22 21:24:30 +00:00
AUTO 4,1
*--------------------------------------
2018-06-20 15:02:09 +00:00
* DRV.DiskII
2018-06-19 05:55:12 +00:00
* X = IOCTL
2018-06-20 15:02:09 +00:00
* Y,A = PTR to S.IOCTL
*--------------------------------------
2018-06-20 15:02:09 +00:00
DRV.DiskII cld
2018-07-09 15:25:38 +00:00
cpx #IOCTL.FORMAT
bcs .9
2018-07-06 14:42:20 +00:00
>STYA pIOCTL
2018-06-20 15:02:09 +00:00
jmp (.1,x)
2018-07-06 14:42:20 +00:00
.1 .DA DRV.DiskII.STATUS
.DA DRV.BLK READ
.DA DRV.BLK WRITE
2018-07-09 15:25:38 +00:00
.9 jmp A2osX.BadCall
*--------------------------------------
2018-07-06 14:42:20 +00:00
DRV.DiskII.STATUS
2018-07-19 15:33:55 +00:00
>LDYAI DRV.DiskII.DIB
2018-07-06 14:42:20 +00:00
jmp DRV.STATUS.YA
*--------------------------------------
2018-07-19 15:33:55 +00:00
DRV.DiskII.DIB .DA #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
.DA 280
.DA #0
>PSTR "Disk II 5.25"
.BS 4
2018-07-19 15:33:55 +00:00
.DA #S.DIB.T.DISKII
.DA #0
2018-08-25 11:23:59 +00:00
.DA K.VER
*--------------------------------------
2018-06-20 15:02:09 +00:00
* DRV.RamDrive
2018-06-19 05:55:12 +00:00
* X = IOCTL
2018-06-20 15:02:09 +00:00
* Y,A = PTR to S.IOCTL
*--------------------------------------
2018-06-20 15:02:09 +00:00
DRV.RamDrive cld
2018-07-09 15:25:38 +00:00
cpx #IOCTL.CONTROL
bcs .9
2018-07-06 14:42:20 +00:00
>STYA pIOCTL
2018-06-20 15:02:09 +00:00
jmp (.1,x)
2018-07-06 14:42:20 +00:00
.1 .DA DRV.RamDrive.STATUS
.DA DRV.BLK READ
.DA DRV.BLK WRITE
.DA DRV.BLK FORMAT
2018-07-09 15:25:38 +00:00
.9 jmp A2osX.BadCall
*--------------------------------------
2018-07-06 14:42:20 +00:00
DRV.RamDrive.STATUS
jsr DRV.Blk
bcs .9
2018-07-19 15:33:55 +00:00
stx DRV.RamDrive.DIB+S.DIB.SIZE
sty DRV.RamDrive.DIB+S.DIB.SIZE+1
2018-07-19 15:33:55 +00:00
>LDYAI DRV.RamDrive.DIB
2018-07-06 14:42:20 +00:00
jmp DRV.STATUS.YA
.9 rts
*--------------------------------------
2018-07-19 15:33:55 +00:00
DRV.RamDrive.DIB
.DA #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
.BS 3
>PSTR "ProDOS /RAM Disk"
2018-07-19 15:33:55 +00:00
.DA #S.DIB.T.RAM
.DA #0
2018-08-25 11:23:59 +00:00
.DA K.VER
*--------------------------------------
2018-06-20 15:02:09 +00:00
* DRV.BlkDevice
2018-06-19 05:55:12 +00:00
* X = IOCTL
2018-06-20 15:02:09 +00:00
* Y,A = PTR to S.IOCTL
*--------------------------------------
2018-06-20 15:02:09 +00:00
DRV.BlkDevice cld
2018-07-09 15:25:38 +00:00
cpx #IOCTL.CONTROL
bcs .9
2018-07-06 14:42:20 +00:00
>STYA pIOCTL
2018-06-20 15:02:09 +00:00
jmp (.1,x)
2018-07-06 14:42:20 +00:00
.1 .DA DRV.BlkDevice.STATUS
.DA DRV.BLK READ
.DA DRV.BLK WRITE
.DA DRV.BLK FORMAT
2018-07-09 15:25:38 +00:00
.9 jmp A2osX.BadCall
*--------------------------------------
2018-07-06 14:42:20 +00:00
DRV.BlkDevice.STATUS
jsr DRV.Blk
bcs .9
2018-07-19 15:33:55 +00:00
stx DRV.BlkDevice.DIB+S.DIB.SIZE
sty DRV.BlkDevice.DIB+S.DIB.SIZE+1
2018-07-19 15:33:55 +00:00
>LDYAI DRV.BlkDevice.DIB
2018-07-06 14:42:20 +00:00
jmp DRV.STATUS.YA
.9 rts
*--------------------------------------
2018-07-19 15:33:55 +00:00
DRV.BlkDevice.DIB
.DA #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
2018-07-06 14:42:20 +00:00
.BS 3
>PSTR "ProDOS Block Dev"
2018-07-19 15:33:55 +00:00
.DA #S.DIB.T.PRODOS
2018-07-06 14:42:20 +00:00
.DA #0
2018-08-25 11:23:59 +00:00
.DA K.VER
*--------------------------------------
2018-07-06 14:42:20 +00:00
* IOCTL to BLK protocol converter
* in : pIOCTL (AUX)
*--------------------------------------
2018-07-06 14:42:20 +00:00
DRV.BLK txa
lsr
2018-07-06 14:42:20 +00:00
sta DRV.BLK.PARAMS CMD
2018-07-10 15:33:13 +00:00
ldy #S.FD.DEV.DEVID Drive 1, or 2
2018-07-11 15:13:29 +00:00
lda (pFD),y
dec O or 1
lsr in Carry
php
2018-07-10 15:33:13 +00:00
ldy #S.FD.DEV.BUSID
2018-07-11 15:13:29 +00:00
lda (pFD),y
asl
asl
asl
asl
asl
plp
ror DSSS0000
2018-07-06 14:42:20 +00:00
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
2018-07-10 15:33:13 +00:00
ldy #S.FD.DEV.BUSPTR
2018-07-06 14:42:20 +00:00
2018-07-10 15:33:13 +00:00
lda (pFD),y
2018-07-06 14:42:20 +00:00
sta .3+1
iny
2018-07-10 15:33:13 +00:00
lda (pFD),y
2018-07-06 14:42:20 +00:00
sta .3+2
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
rts
2018-07-06 14:42:20 +00:00
DRV.BLK.PARAMS .BS 6
*--------------------------------------
* Smartport Driver
*--------------------------------------
2018-06-20 15:02:09 +00:00
DRV.SmartPort cld
2018-07-06 14:42:20 +00:00
>STYA DRV.SmartPort.Go.IOCTL
txa
lsr
sta DRV.SmartPort.Go.Cmd
tax
lda DRV.SmartPort.Cnt,x
sta DRV.SmartPort.Go.Cmd
2018-07-10 15:33:13 +00:00
ldy #S.FD.DEV.BUSPTR
lda (pFD),y
sta .8+1
iny
2018-07-10 15:33:13 +00:00
lda (pFD),y
sta .8+2
.8 jsr $ffff
2018-06-20 15:02:09 +00:00
DRV.SmartPort.Go.Cmd
.BS 1
2018-07-06 14:42:20 +00:00
DRV.SmartPort.Go.IOCTL
.BS 2
rts
2018-07-06 14:42:20 +00:00
2018-06-20 15:02:09 +00:00
DRV.SmartPort.Cnt
.HS 03030301030101010404
*--------------------------------------
2018-07-05 15:39:36 +00:00
* NULL DEVICE
* - OPEN,WRITE,CLOSE always succeed.
* - READ returns EOF.
*--------------------------------------
2018-06-21 15:12:10 +00:00
DRV.NULL cld
2018-07-06 14:42:20 +00:00
>STYA pIOCTL
2018-06-20 15:02:09 +00:00
jmp (.1,x)
*--------------------------------------
2018-07-05 15:39:36 +00:00
.1 .DA DRV.NULL.STATUS
.DA A2osX.BADCALL READBLOCK
.DA A2osX.BADCALL WRITEBLOCK
.DA A2osX.BADCALL FORMAT
.DA A2osX.BADCALL CONTROL
.DA A2osX.BADCALL INIT
2018-07-05 15:39:36 +00:00
.DA DRV.NULL.OPEN
.DA DRV.NULL.CLOSE
.DA DRV.NULL.READ
.DA DRV.NULL.WRITE
.DA A2osX.BADCALL IRQ
*--------------------------------------
2018-07-19 15:33:55 +00:00
DRV.NULL.STATUS >LDYAI DRV.NULL.DIB
2018-07-06 14:42:20 +00:00
jmp DRV.STATUS.YA
2018-07-05 15:39:36 +00:00
2018-07-06 14:42:20 +00:00
DRV.NULL.READ ldx #C.EOF
2018-07-05 15:39:36 +00:00
jmp DRV.READ.X
DRV.NULL.OPEN
DRV.NULL.WRITE
DRV.NULL.CLOSE clc
rts
*--------------------------------------
2018-07-19 15:33:55 +00:00
DRV.NULL.DIB .DA #S.DIB.S.WRITE+S.DIB.S.READ+S.DIB.S.OPENED
.DA #0,#0,#0
2018-06-18 06:22:50 +00:00
>PSTR "NULL DEVICE"
.BS 5
2018-07-19 15:33:55 +00:00
.DA #S.DIB.T.CHAR
.DA #0
2018-08-25 11:23:59 +00:00
.DA K.VER
*--------------------------------------
* SYS DEVICE
*--------------------------------------
2018-06-21 15:12:10 +00:00
DRV.SYS cld
2018-07-06 14:42:20 +00:00
>STYA pIOCTL
2018-06-20 15:02:09 +00:00
jmp (.1,x)
2018-07-06 14:42:20 +00:00
.1 .DA DRV.SYS.STATUS
.DA A2osX.BADCALL READBLOCK
.DA A2osX.BADCALL WRITEBLOCK
.DA A2osX.BADCALL FORMAT
2018-06-20 15:02:09 +00:00
.DA DRV.SYS.Control
.DA A2osX.BADCALL INIT
2018-07-05 15:39:36 +00:00
.DA DRV.SYS.OPEN
.DA DRV.SYS.CLOSE
2018-06-20 15:02:09 +00:00
.DA DRV.SYS.Read
.DA DRV.SYS.Write
2018-07-05 15:39:36 +00:00
.DA A2osX.BADCALL IRQ
*--------------------------------------
2018-07-19 15:33:55 +00:00
DRV.SYS.STATUS >LDYAI DRV.SYS.DIB
2018-07-06 14:42:20 +00:00
jmp DRV.STATUS.YA
2017-01-12 17:43:45 +00:00
*--------------------------------------
2018-07-05 15:39:36 +00:00
DRV.SYS.Open lda #DEVID.SYS
2018-06-20 15:02:09 +00:00
sta A2osX.SCRNDEVS+1
2018-07-19 15:33:55 +00:00
jsr DRV.SYS.FF
*--------------------------------------
2018-06-20 15:02:09 +00:00
DRV.SYS.Control sta SETTEXT
sta SETALTCHAR
sta SET80DISP
sta CLR80STORE
2018-06-20 15:02:09 +00:00
sta SETPAGE2
lda #2
sta A2osX.ASCREEN
2018-07-05 15:39:36 +00:00
DRV.SYS.CLOSE
clc
rts
*--------------------------------------
2018-07-09 15:25:38 +00:00
DRV.SYS.Read lda A2osX.ASCREEN
2018-06-20 15:02:09 +00:00
cmp #2 is SYS active?
bne .9
lda OPENAPPLE
bmi .9 Open apple key, not for us...
lda KBD
bpl .9
sta KBDSTROBE
and #$7F
2018-07-05 15:39:36 +00:00
tax
jmp DRV.READ.X
.9 lda #0 Error = no event
sec
rts
*--------------------------------------
2018-07-09 15:25:38 +00:00
DRV.SYS.WRITE ldy #S.IOCTL.BUFPTR
2018-07-05 15:39:36 +00:00
lda (pIOCTL),y
sta ZPDRV+4
iny
lda (pIOCTL),y
sta ZPDRV+5
ldy #S.IOCTL.BYTECNT
lda (pIOCTL),y
eor #$ff
tax
iny
lda (pIOCTL),y
eor #$ff
tay
.2 inx
bne .3
iny
bne .3
clc
rts
2018-07-13 14:38:24 +00:00
.3 lda (ZPDRV+4)
2018-07-05 15:39:36 +00:00
inc ZPDRV+4
bne .4
inc ZPDRV+5
.4 jsr DRV.SYS.COUT
.5 bra .2
*--------------------------------------
DRV.SYS.COUT phx
phy
cmp #' '
2018-07-19 15:33:55 +00:00
bcs .1
2018-07-19 15:33:55 +00:00
jsr DRV.SYS.CTRL
bra .8
2018-07-19 15:33:55 +00:00
.1 ora #$80
2018-06-20 15:02:09 +00:00
ldy DRV.SYS.CH
ldx DRV.SYS.CV
jsr DRV.SYS.SetCharAtYX
2018-07-19 15:33:55 +00:00
jsr DRV.SYS.FS
.8 ply
plx
clc
rts
*--------------------------------------
2018-07-19 15:33:55 +00:00
DRV.SYS.CTRL ldx #DRV.SYS.CTRLCNT-1
.1 cmp DRV.SYS.CTRLS,x
beq .2
dex
bpl .1
clc
rts
.2 txa
asl
tax
jmp (.3,x)
.3 .DA DRV.SYS.ENQ 5
.DA DRV.SYS.BS 8
.DA DRV.SYS.LF 10
.DA DRV.SYS.FF 12
.DA DRV.SYS.CR 13
.DA DRV.SYS.FS 21
.DA DRV.SYS.ESC 27
*--------------------------------------
DRV.SYS.ENQ clc
rts
*--------------------------------------
DRV.SYS.BS ldx DRV.SYS.CH
beq .1
dec DRV.SYS.CH
bra .3
.1 ldy DRV.SYS.CV
cpy #1
bne .2
clc
rts
.2 lda #79
sta DRV.SYS.CH
dec DRV.SYS.CV
.3 clc
rts
*--------------------------------------
DRV.SYS.LF ldx DRV.SYS.CV
cpx #23
beq DRV.SYS.Scroll
inc DRV.SYS.CV
rts
*--------------------------------------
DRV.SYS.FF ldx #23
.1 jsr DRV.SYS.ClrLineAtX
dex
bne .1
2018-06-20 15:02:09 +00:00
stz DRV.SYS.CH
2018-07-19 15:33:55 +00:00
lda #1
sta DRV.SYS.CV
rts
*--------------------------------------
2018-06-20 15:02:09 +00:00
DRV.SYS.CR jsr DRV.SYS.ClrEOL
stz DRV.SYS.CH
rts
*--------------------------------------
2018-07-19 15:33:55 +00:00
DRV.SYS.FS lda DRV.SYS.CH
cmp #79
bne .1
stz DRV.SYS.CH
bra DRV.SYS.LF
.1 inc DRV.SYS.CH
rts
*--------------------------------------
DRV.SYS.ESC
clc
rts
*--------------------------------------
2018-06-20 15:02:09 +00:00
DRV.SYS.ClrEOL ldx DRV.SYS.CV
lda #$A0
2018-06-20 15:02:09 +00:00
ldy DRV.SYS.CH
.1 cpy #79
beq .2
2018-06-20 15:02:09 +00:00
jsr DRV.SYS.SetCharAtYX
iny
bne .1
.2 rts
*--------------------------------------
2018-06-20 15:02:09 +00:00
DRV.SYS.ScrollAux
2017-11-23 16:51:52 +00:00
sta SETREADAUX
.1 lda (ZPDRV+2),y
sta (ZPDRV),y
dey
bpl .1
sta CLRREADAUX
rts
*--------------------------------------
2018-07-16 05:52:52 +00:00
DRV.SYS.Scroll ldx #DRV.SYS.Scroll-DRV.SYS.ScrollAux-1
.1 lda DRV.SYS.ScrollAux,x
sta $102,x
dex
bpl .1
ldx #1
.2 jsr DRV.SYS.SetBaseX
inx
2018-06-20 15:02:09 +00:00
lda DRV.SYS.BASEL,x
sta ZPDRV+2
2018-06-20 15:02:09 +00:00
lda DRV.SYS.BASEH,x
sta ZPDRV+3
2017-11-23 16:51:52 +00:00
ldy #39
sta SETWRITEAUX
2017-11-23 16:51:52 +00:00
jsr $102
sta CLRWRITEAUX
ldy #39
.3 lda (ZPDRV+2),y
sta (ZPDRV),y
dey
bpl .3
cpx #23
2018-07-16 05:52:52 +00:00
bne .2 Fall in ClrLineAtX for last line
*--------------------------------------
2018-06-20 15:02:09 +00:00
DRV.SYS.ClrLineAtX
jsr DRV.SYS.SetBaseX
lda #$A0
ldy #39
.1 sta SETWRITEAUX
sta (ZPDRV),y
sta CLRWRITEAUX
sta (ZPDRV),y
dey
bpl .1
rts
*--------------------------------------
2018-06-20 15:02:09 +00:00
DRV.SYS.SetCharAtYX
cmp #$40
bcc .1
cmp #$5F
bcs .1
and #$3F
.1 phy
pha
2018-06-20 15:02:09 +00:00
jsr DRV.SYS.SetBaseX
tya
lsr
tay
pla
bcs .2
sta SETWRITEAUX
sta (ZPDRV),y
sta CLRWRITEAUX
2018-06-25 05:59:43 +00:00
ply
rts
.2 sta (ZPDRV),y
ply
rts
*--------------------------------------
2018-06-20 15:02:09 +00:00
DRV.SYS.SetBaseX
lda DRV.SYS.BASEL,x
sta ZPDRV
2018-06-20 15:02:09 +00:00
lda DRV.SYS.BASEH,x
sta ZPDRV+1
rts
*--------------------------------------
2018-07-19 15:33:55 +00:00
DRV.SYS.DIB .DA #S.DIB.S.WRITE+S.DIB.S.READ+S.DIB.S.OPENED
2018-07-06 14:42:20 +00:00
.DA #0,#0,#0
>PSTR "A2osX SYS Screen"
2018-07-19 15:33:55 +00:00
.DA #S.DIB.T.CHAR
2018-07-06 14:42:20 +00:00
.DA #0
2018-08-25 11:23:59 +00:00
.DA K.VER
2018-07-06 14:42:20 +00:00
*--------------------------------------
2018-06-20 15:02:09 +00:00
DRV.SYS.CH .BS 1
DRV.SYS.CV .BS 1
*--------------------------------------
2018-06-20 15:02:09 +00:00
DRV.SYS.BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0
DRV.SYS.BASEH .HS 08.08.09.09.0A.0A.0B.0B.08.08.09.09.0A.0A.0B.0B.08.08.09.09.0A.0A.0B.0B
2018-07-19 15:33:55 +00:00
DRV.SYS.CTRLCNT .EQ 7
DRV.SYS.CTRLS .HS 05080A0C0D151B
*--------------------------------------
2018-07-06 14:42:20 +00:00
DRV.STATUS.YA >STYA .2+1
ldy #S.IOCTL.STATCODE
lda (pIOCTL),y
beq .1
cmp #S.IOCTL.STATCODE.GETDIB
bne .9
2018-07-19 15:33:55 +00:00
ldx #S.DIB-1
2018-07-06 14:42:20 +00:00
.HS 2C bit abs
.1 ldx #3
ldy #S.IOCTL.BUFPTR
lda (pIOCTL),y
sta .3+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
.9 lda #MLI.E.BADCTL
sec
rts
*--------------------------------------
2018-07-05 15:39:36 +00:00
DRV.READ.X ldy #S.IOCTL.BYTECNT
lda #1
sta (pIOCTL),y
iny
dec
sta (pIOCTL),y
ldy #S.IOCTL.BUFPTR
lda (pIOCTL),y
sta .1+1
iny
lda (pIOCTL),y
sta .1+2
.1 stx $ffff SELF MODIFIED
clc
rts
*--------------------------------------
MAN
2018-06-18 15:48:00 +00:00
SAVE /A2OSX.SRC/SYS/KERNEL.S.DRV
LOAD /A2OSX.SRC/SYS/KERNEL.S
ASM