A2osX/BIN/LSDEV.S.txt

203 lines
3.7 KiB
Plaintext
Raw Normal View History

NEW
2017-12-22 21:24:30 +00:00
PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BUILD/BIN/LSDEV
*--------------------------------------
.INB /A2OSX.BUILD/INC/MACROS.I
.INB /A2OSX.BUILD/INC/PRODOS.I
.INB /A2OSX.BUILD/INC/A2OSX.I
.INB /A2OSX.BUILD/INC/KERNEL.I
*--------------------------------------
ZPPTR1 .EQ ZPBIN
ZPPTR2 .EQ ZPBIN+2
*--------------------------------------
2015-06-03 18:30:57 +00:00
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
2015-06-03 18:30:57 +00:00
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
.DA CS.END-CS.START CS
.DA DS.END-DS.START DS
.DA #16 SS
.DA #4 ZP
2015-06-03 18:30:57 +00:00
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.EVENT
.DA CS.QUIT
L.MSG0 .DA MSG0
L.MSG1 .DA MSG1
L.MSG2.C .DA MSG2.C
L.MSG2.B .DA MSG2.B
.DA 0
*--------------------------------------
2017-01-12 17:43:45 +00:00
CS.INIT clc
rts
*--------------------------------------
2017-01-12 17:43:45 +00:00
CS.RUN >LDYA L.MSG0
>SYSCALL PrintF.YA
>LDA.G DEV.ID
2017-01-12 17:43:45 +00:00
.1 >SYSCALL GetDevByID.A
bcs .7
>STYA ZPPTR1
jsr DumpHeader
bcs .9
>LDA.G DEV.ID
2018-01-15 06:50:44 +00:00
>SYSCALL GetDevStatus.A
bcs .6
2018-01-15 06:50:44 +00:00
>STYA ZPPTR2
jsr DumpStatus
bcs .9
.6 lda #13
>SYSCALL PutChar.A
lda #10
>SYSCALL PutChar.A
.7 >LDA.G DEV.ID
inc
sta (pData),y
cmp #K.DEV.MAX
bne .1
.8 lda #0 tell TSKMGR that all done ok, but
2018-01-15 06:50:44 +00:00
sec we do not want to stay in memory
.9 rts
*--------------------------------------
DumpHeader ldy #S.DEV.DRV.JMP+1
>PUSHB (ZPPTR1),y
2016-06-07 06:10:18 +00:00
dey
>PUSHB (ZPPTR1),y
2016-06-07 06:10:18 +00:00
lda #S.DEV.NAME
clc
adc ZPPTR1
tay
2017-01-12 17:43:45 +00:00
lda /S.DEV.NAME
adc ZPPTR1+1
2017-01-12 17:43:45 +00:00
>PUSHYA
2015-06-03 18:30:57 +00:00
ldy #S.DEV.F
>PUSHB (ZPPTR1),y
2017-01-12 17:43:45 +00:00
ldy #S.DEV.S
lda (ZPPTR1),y
>STA.G DEV.S
2017-01-12 17:43:45 +00:00
ldy #DEV.SFLAGS+7
ldx #7
.1 lsr
pha
lda #'-'
bcc .2
lda MSG.SFLAGS,x
.2 sta (pData),y
pla
dey
dex
bpl .1
>PUSHEA.G DEV.SFLAGS
>LDA.G DEV.ID
>PUSHA
2017-01-12 17:43:45 +00:00
>LDYA L.MSG1
>SYSCALL PrintF.YA
rts
*--------------------------------------
DumpStatus >LDA.G DEV.S
bpl .1
ldy #S.DSTAT.SIZE
lda (ZPPTR2),y
>STA.G DEV.SIZE
ldy #S.DSTAT.SIZE+1
lda (ZPPTR2),y
>STA.G DEV.SIZE+1
ldy #S.DSTAT.SIZE+2
lda (ZPPTR2),y
>STA.G DEV.SIZE+2
>PUSHEA.G DEV.SIZE
.1 ldy #S.DSTAT.VERSION+1
>PUSHB (ZPPTR2),y
dey
>PUSHB (ZPPTR2),y
lda ZPPTR2
clc
adc #S.DSTAT.IDS
tay
lda ZPPTR2+1
adc #0
>PUSHYA
ldy #S.DSTAT.ST
>PUSHB (ZPPTR2),y
dey
>PUSHB (ZPPTR2),y
>LDA.G DEV.S
bpl .2
>LDYA L.MSG2.B
bra .3
.2 >LDYA L.MSG2.C
.3 >SYSCALL PrintF.YA
rts
*--------------------------------------
CS.EVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
MSG0 .AZ "ID Status Flags Name Addr. Typ/Sub IDString Version Size (BLK)\r\n"
MSG1 .AZ "%03d %s %b %4s $%H "
MSG2.B .AZ "$%h/$%h %16S %03d.%03d %10u"
MSG2.C .AZ "$%h/$%h %16S %03d.%03d n/a"
MSG.SFLAGS .AS "BWRLNEIO"
*--------------------------------------
.DUMMY
.OR 0
DS.START
2015-06-03 18:30:57 +00:00
DEV.ID .BS 1
DEV.S .BS 1
DEV.SIZE .BS 4
DEV.SFLAGS .BS 9
DS.END
.ED
*--------------------------------------
MAN
SAVE /A2OSX.SRC/BIN/LSDEV.S
ASM