mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 07:54:37 +00:00
544 lines
11 KiB
Plaintext
544 lines
11 KiB
Plaintext
NEW
|
||
PREFIX /A2OSX.BUILD
|
||
AUTO 4,1
|
||
*--------------------------------------
|
||
* DRV.DiskII
|
||
* X = IOCTL
|
||
* Y,A = PTR to S.IOCTL
|
||
* pDev -> Dev Header AUX!!!
|
||
* $42 Command Number
|
||
* $43 Unit Number
|
||
* $44-$45 Buffer Pointer
|
||
* $46-$47 Block Number
|
||
*--------------------------------------
|
||
DRV.DiskII cld
|
||
jmp (.1,x)
|
||
.1 .DA DRV.DiskII.S status
|
||
.DA DRV.DiskII.RW Read
|
||
.DA DRV.DiskII.RW Write
|
||
.DA A2osX.BadCall Format
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
*--------------------------------------
|
||
DRV.DiskII.S >LDYAI DRV.DiskII.Stat
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DRV.DiskII.RW >STYA A2osX.RW.SrcDst+1
|
||
jsr DRV.BlkDevice.GetCmdAndDevAX
|
||
*--------------------------------------
|
||
ldy #$D0
|
||
.HS 2C bit abs
|
||
A2osX.RamDrv.RW1
|
||
ldy #$FF
|
||
|
||
sty A2osX.RW.Drv+2
|
||
|
||
jsr GO.ProDOS
|
||
stx $42
|
||
sta $43
|
||
|
||
ldy #3
|
||
|
||
A2osX.RW.SrcDst lda $ffff,y Self Modified
|
||
sta $44,y
|
||
dey
|
||
bpl A2osX.RW.SrcDst
|
||
|
||
A2osX.RW.Drv jsr $0000
|
||
cli
|
||
jsr GO.A2osX
|
||
rts
|
||
*--------------------------------------
|
||
DRV.DiskII.Stat .DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
|
||
.DA 280
|
||
.DA #0
|
||
>PSTR "Disk II 5.25"
|
||
.BS 4
|
||
.DA #S.DSTAT.T.DISKII
|
||
.DA #0
|
||
.DA KVER
|
||
*--------------------------------------
|
||
* DRV.RamDrive
|
||
* X = IOCTL
|
||
* Y,A = PTR to S.IOCTL
|
||
* pDev -> Dev Header AUX!!!
|
||
* $42 Command Number
|
||
* $43 Unit Number
|
||
* $44-$45 Buffer Pointer
|
||
* $46-$47 Block Number
|
||
*--------------------------------------
|
||
DRV.RamDrive cld
|
||
jmp (.1,x)
|
||
.1 .DA DRV.RamDrive.S status
|
||
.DA DRV.RamDrive.RW Read
|
||
.DA DRV.RamDrive.RW Write
|
||
.DA A2osX.BadCall Format
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
*--------------------------------------
|
||
DRV.RamDrive.S jsr DRV.BlkDevice.GetCmdAndDevAX
|
||
jsr GO.ProDOS
|
||
stx $42
|
||
sta $43
|
||
jsr $FF00
|
||
jsr GO.A2osX
|
||
bcs .9
|
||
stx DRV.RamDrive.Stat+S.DSTAT.SIZE
|
||
sty DRV.RamDrive.Stat+S.DSTAT.SIZE+1
|
||
|
||
>LDYAI DRV.RamDrive.Stat
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
DRV.RamDrive.RW >STYA A2osX.RW.SrcDst+1
|
||
jsr DRV.BlkDevice.GetCmdAndDevAX
|
||
bra A2osX.RamDrv.RW1
|
||
*--------------------------------------
|
||
DRV.RamDrive.Stat
|
||
.DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
|
||
.BS 3
|
||
>PSTR "ProDOS /RAM Disk"
|
||
.DA #S.DSTAT.T.RAM
|
||
.DA #0
|
||
.DA KVER
|
||
*--------------------------------------
|
||
* DRV.BlkDevice
|
||
* X = IOCTL
|
||
* Y,A = PTR to S.IOCTL
|
||
* pDev -> Dev Header
|
||
* $42 Command Number
|
||
* $43 Unit Number
|
||
* $44-$45 Buffer Pointer
|
||
* $46-$47 Block Number
|
||
*--------------------------------------
|
||
DRV.BlkDevice cld
|
||
jmp (.1,x)
|
||
.1 .DA DRV.BlkDevice.S status
|
||
.DA DRV.BlkDevice.RW
|
||
.DA DRV.BlkDevice.RW
|
||
.DA DRV.BlkDevice.F
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
.DA A2osX.BadCall
|
||
*--------------------------------------
|
||
DRV.BlkDevice.S jsr DRV.BlkDevice.GetCmdAndDev
|
||
|
||
jsr DRV.BlkDevice.Go
|
||
bcs .9
|
||
stx DRV.BlkDevice.Stat+S.DSTAT.SIZE
|
||
sty DRV.BlkDevice.Stat+S.DSTAT.SIZE+1
|
||
|
||
>LDYAI DRV.BlkDevice.Stat
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
DRV.BlkDevice.RW
|
||
>STYA DRV.BlkDevice.GetParam.1+1
|
||
|
||
jsrDRV.BlkDevice.GetCmdAndDev
|
||
|
||
jsr DRV.BlkDevice.GetParam
|
||
bra DRV.BlkDevice.Go
|
||
*--------------------------------------
|
||
DRV.BlkDevice.F jsr DRV.BlkDevice.GetCmdAndDev
|
||
|
||
DRV.BlkDevice.Go
|
||
ldy #S.NODE.DEV.ROMPTR
|
||
lda (pDev),y
|
||
sta .8+1
|
||
iny
|
||
lda (pDev),y
|
||
sta .8+2
|
||
.8 jmp $ffff
|
||
*--------------------------------------
|
||
DRV.BlkDevice.GetParam
|
||
ldy #3
|
||
DRV.BlkDevice.GetParam.1
|
||
lda $ffff,y Self Modified
|
||
sta $44,y
|
||
dey
|
||
bpl DRV.BlkDevice.GetParam.1
|
||
rts
|
||
*--------------------------------------
|
||
DRV.BlkDevice.GetCmdAndDev
|
||
jsr DRV.BlkDevice.GetCmdAndDevAX
|
||
stx $42
|
||
sta $43
|
||
rts
|
||
DRV.BlkDevice.GetCmdAndDevAX
|
||
txa
|
||
lsr
|
||
tax CMD
|
||
|
||
ldy #S.NODE.DEV.DEVID Drive 1, or 2
|
||
lda (pDev),y
|
||
dec O or 1
|
||
lsr in Carry
|
||
php
|
||
|
||
ldy #S.NODE.DEV.BUSID
|
||
lda (pDev),y
|
||
asl
|
||
asl
|
||
asl
|
||
asl
|
||
asl
|
||
plp
|
||
ror DSSS0000
|
||
|
||
rts
|
||
*--------------------------------------
|
||
DRV.BlkDevice.Stat
|
||
.DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
|
||
.BS 3
|
||
>PSTR "ProDOS Block Dev"
|
||
.DA #S.DSTAT.T.PRODOS
|
||
.DA #0
|
||
.DA KVER
|
||
*--------------------------------------
|
||
* Smartport Driver
|
||
*--------------------------------------
|
||
DRV.SmartPort cld
|
||
jmp (.1,x)
|
||
.1 .DA DRV.SmartPort.S STATUS
|
||
.DA DRV.SmartPort.P BR
|
||
.DA DRV.SmartPort.P BW
|
||
.DA DRV.SmartPort.NP FORMAT
|
||
.DA DRV.SmartPort.P CONTROL
|
||
.DA DRV.SmartPort.NP INIT
|
||
.DA DRV.SmartPort.NP OPEN
|
||
.DA DRV.SmartPort.NP CLOSE
|
||
.DA DRV.SmartPort.P R
|
||
.DA DRV.SmartPort.P W
|
||
*--------------------------------------
|
||
DRV.SmartPort.S jsr DRV.SmartPort.GetDev
|
||
>LDYAI K.S.DSTAT
|
||
>STYA K.S.IOCTL+S.IOCTL.BUFPTR
|
||
lda #S.IOCTL.STATCODE.GETDIB
|
||
sta K.S.IOCTL+S.IOCTL.CTRLCODE
|
||
jsr DRV.SmartPort.Go
|
||
bcs .9
|
||
>LDYAI K.S.DSTAT
|
||
.9 rts
|
||
*--------------------------------------
|
||
DRV.SmartPort.P jsr DRV.SmartPort.GetParam
|
||
bra DRV.SmartPort.Go
|
||
DRV.SmartPort.NP
|
||
jsr DRV.SmartPort.GetDev
|
||
*--------------------------------------
|
||
DRV.SmartPort.Go
|
||
ldy #S.NODE.DEV.ROMPTR
|
||
lda (pDev),y
|
||
sta .8+1
|
||
iny
|
||
lda (pDev),y
|
||
sta .8+2
|
||
|
||
.8 jsr $ffff
|
||
DRV.SmartPort.Go.Cmd
|
||
.BS 1
|
||
.DA K.S.IOCTL
|
||
rts
|
||
*--------------------------------------
|
||
DRV.SmartPort.GetParam
|
||
>STYA ZPDRV Get Ptr To ParamList
|
||
jsr DRV.BlkDevice.GetCmdAndDev
|
||
|
||
ldy #7
|
||
|
||
.1 lda (ZPDRV),y
|
||
sta K.S.IOCTL+2,y
|
||
dey
|
||
bpl .1
|
||
rts
|
||
*--------------------------------------
|
||
DRV.SmartPort.GetDev
|
||
txa
|
||
lsr
|
||
sta DRV.SmartPort.Go.Cmd
|
||
tax
|
||
lda DRV.SmartPort.Cnt,x
|
||
sta K.S.IOCTL+S.IOCTL.CNT
|
||
rts
|
||
DRV.SmartPort.Cnt
|
||
.HS 03030301030101010404
|
||
*--------------------------------------
|
||
* NULL DEVICE
|
||
*--------------------------------------
|
||
DRV.NULL cld
|
||
jmp (.1,x)
|
||
*--------------------------------------
|
||
.1 .DA .2 STATUS
|
||
.DA A2osX.BADCALL READBLOCK
|
||
.DA A2osX.BADCALL WRITEBLOCK
|
||
.DA A2osX.BADCALL FORMAT
|
||
.DA A2osX.BADCALL CONTROL
|
||
.DA A2osX.BADCALL INIT
|
||
.DA A2osX.BADCALL OPEN
|
||
.DA A2osX.BADCALL CLOSE
|
||
.DA A2osX.BADCALL READ
|
||
.DA .8 WRITE
|
||
*--------------------------------------
|
||
.2 >LDYAI .3
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
.3 .DA #S.DSTAT.S.WRITE+S.DSTAT.S.READ
|
||
.DA #0,#0,#0
|
||
>PSTR "NULL DEVICE"
|
||
.BS 5
|
||
.DA #S.DSTAT.T.CHAR
|
||
.DA #0
|
||
.DA KVER
|
||
*--------------------------------------
|
||
* SYS DEVICE
|
||
*--------------------------------------
|
||
DRV.SYS cld
|
||
jmp (.1,x)
|
||
.1 .DA .2 STATUS
|
||
.DA A2osX.BADCALL READBLOCK
|
||
.DA A2osX.BADCALL WRITEBLOCK
|
||
.DA A2osX.BADCALL FORMAT
|
||
.DA DRV.SYS.Control
|
||
.DA A2osX.BADCALL INIT
|
||
.DA DRV.SYS.Open
|
||
.DA A2osX.BADCALL CLOSE
|
||
.DA DRV.SYS.Read
|
||
.DA DRV.SYS.Write
|
||
*--------------------------------------
|
||
.2 >LDYAI .3
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
.3 .DA #S.DSTAT.S.WRITE+S.DSTAT.S.READ
|
||
.DA #0,#0,#0
|
||
>PSTR "A2osX SYS Screen"
|
||
.DA #S.DSTAT.T.CHAR
|
||
.DA #0
|
||
.DA KVER
|
||
*--------------------------------------
|
||
DRV.SYS.Open lda #1
|
||
sta A2osX.SCRNDEVS+1
|
||
jsr DRV.SYS.Home
|
||
*--------------------------------------
|
||
DRV.SYS.Control sta SETTEXT
|
||
sta SETALTCHAR
|
||
sta SET80DISP
|
||
sta CLR80STORE
|
||
sta SETPAGE2
|
||
lda #2
|
||
sta A2osX.ASCREEN
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DRV.SYS.Read lda A2osX.ASCREEN
|
||
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
|
||
|
||
clc
|
||
rts
|
||
|
||
.9 lda #0 Error = no event
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
DRV.SYS.Write phx
|
||
phy
|
||
cmp #' '
|
||
bcs .7
|
||
|
||
cmp #10
|
||
bne .1
|
||
jsr DRV.SYS.LF
|
||
bra .8
|
||
|
||
.1 cmp #13
|
||
bne .2
|
||
jsr DRV.SYS.CR
|
||
bra .8
|
||
|
||
.2 ora #$20
|
||
|
||
.HS 2C BIT ABS
|
||
|
||
.7 ora #$80
|
||
ldy DRV.SYS.CH
|
||
ldx DRV.SYS.CV
|
||
jsr DRV.SYS.SetCharAtYX
|
||
jsr DRV.SYS.FSOut
|
||
|
||
.8 ply
|
||
plx
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DRV.SYS.FSOut lda DRV.SYS.CH
|
||
cmp #79
|
||
bne .1
|
||
|
||
stz DRV.SYS.CH
|
||
bra DRV.SYS.LF
|
||
|
||
.1 inc DRV.SYS.CH
|
||
rts
|
||
*--------------------------------------
|
||
DRV.SYS.CR jsr DRV.SYS.ClrEOL
|
||
stz DRV.SYS.CH
|
||
rts
|
||
*--------------------------------------
|
||
DRV.SYS.LF ldx DRV.SYS.CV
|
||
cpx #23
|
||
beq DRV.SYS.Scroll
|
||
inc DRV.SYS.CV
|
||
rts
|
||
*--------------------------------------
|
||
DRV.SYS.ClrEOL ldx DRV.SYS.CV
|
||
lda #$A0
|
||
ldy DRV.SYS.CH
|
||
.1 cpy #79
|
||
beq .2
|
||
jsr DRV.SYS.SetCharAtYX
|
||
iny
|
||
bne .1
|
||
.2 rts
|
||
*--------------------------------------
|
||
DRV.SYS.ScrollAux
|
||
sta SETREADAUX
|
||
|
||
.1 lda (ZPDRV+2),y
|
||
sta (ZPDRV),y
|
||
dey
|
||
bpl .1
|
||
|
||
sta CLRREADAUX
|
||
rts
|
||
*--------------------------------------
|
||
DRV.SYS.Scroll ldx #1
|
||
.1 jsr DRV.SYS.SetBaseX
|
||
|
||
inx
|
||
lda DRV.SYS.BASEL,x
|
||
sta ZPDRV+2
|
||
lda DRV.SYS.BASEH,x
|
||
sta ZPDRV+3
|
||
|
||
ldx #DRV.SYS.Scroll-DRV.SYS.ScrollAux-1
|
||
|
||
.2 lda DRV.SYS.ScrollAux,x
|
||
sta $102,x
|
||
dex
|
||
bpl .2
|
||
|
||
ldy #39
|
||
|
||
sta SETWRITEAUX
|
||
jsr $102
|
||
sta CLRWRITEAUX
|
||
|
||
ldy #39
|
||
|
||
.3 lda (ZPDRV+2),y
|
||
sta (ZPDRV),y
|
||
dey
|
||
bpl .3
|
||
|
||
cpx #23
|
||
bne .1 Fall in ClrLineAtX for last line
|
||
*--------------------------------------
|
||
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
|
||
*--------------------------------------
|
||
DRV.SYS.Home ldx #23
|
||
|
||
.1 jsr DRV.SYS.ClrLineAtX
|
||
dex
|
||
bne .1
|
||
|
||
stz DRV.SYS.CH
|
||
lda #1
|
||
sta DRV.SYS.CV
|
||
|
||
rts
|
||
*--------------------------------------
|
||
DRV.SYS.SetCharAtYX
|
||
cmp #$40
|
||
bcc .1
|
||
cmp #$5F
|
||
bcs .1
|
||
and #$3F
|
||
|
||
.1 phy
|
||
pha
|
||
jsr DRV.SYS.SetBaseX
|
||
tya
|
||
lsr
|
||
tay
|
||
|
||
pla
|
||
|
||
bcs .2
|
||
|
||
sta SETWRITEAUX
|
||
sta (ZPDRV),y
|
||
sta CLRWRITEAUX
|
||
|
||
ply
|
||
rts
|
||
|
||
.2 sta (ZPDRV),y
|
||
ply
|
||
rts
|
||
*--------------------------------------
|
||
DRV.SYS.SetBaseX
|
||
lda DRV.SYS.BASEL,x
|
||
sta ZPDRV
|
||
lda DRV.SYS.BASEH,x
|
||
sta ZPDRV+1
|
||
rts
|
||
*--------------------------------------
|
||
DRV.SYS.CH .BS 1
|
||
DRV.SYS.CV .BS 1
|
||
*--------------------------------------
|
||
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
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/SYS/KERNEL.S.DRV
|
||
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
||
ASM
|