A2osX/BIN/LSDEV.S.txt
2017-03-29 17:48:15 +02:00

179 lines
3.3 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

PR#3
PREFIX /A2OSX.BUILD
NEW
INC 1
AUTO 6
.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
*--------------------------------------
ZPPTR1 .EQ ZPBIN
ZPPTR2 .EQ ZPBIN+2
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
.DA CS.END-CS.START Code Length To Relocate
.DA 0 Data Segment to Allocate
.DA 0
.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
L.DEV.SIZE .DA DEV.SIZE
.DA 0
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
CS.RUN >LDYA L.MSG0
>SYSCALL CPrintFYA
stz DEV.ID
lda DEV.ID
.1 >SYSCALL GetDevByIDA
bcs .7
>STYA ZPPTR1
jsr DumpHeader
bcs .9
lda DEV.ID
>SYSCALL GetDevByIDA
>STYA pDev
ldx #DEVMGR.STATUS
jsr pDevJmp
bcs .6
>STYA ZPPTR2
jsr DumpStatus
bcs .9
.6 lda #13
>SYSCALL PutCA
lda #10
>SYSCALL PutCA
.7 inc DEV.ID
lda DEV.ID
cmp #K.DEV.MAX
bne .1
.8 lda #0 tell TSKMGR that all done ok, but
.9 sec we do not want to stay in memory
rts
*--------------------------------------
DumpHeader ldy #S.DEV.DRV.JMP+1
>PUSHB (ZPPTR1),y
dey
>PUSHB (ZPPTR1),y
lda #S.DEV.NAME
clc
adc ZPPTR1
tay
lda /S.DEV.NAME
adc ZPPTR1+1
>PUSHYA
ldy #S.DEV.F
>PUSHB (ZPPTR1),y
ldy #S.DEV.S
>PUSHB (ZPPTR1),y
sta DEV.S
>PUSHB DEV.ID
>LDYA L.MSG1
>SYSCALL CPrintFYA
rts
*--------------------------------------
DumpStatus bit DEV.S
bpl .1
ldy #S.DEVSTAT.SIZE
lda (ZPPTR2),y
sta DEV.SIZE
iny
lda (ZPPTR2),y
sta DEV.SIZE+1
iny
lda (ZPPTR2),y
sta DEV.SIZE+2
>PUSHW L.DEV.SIZE
.1 ldy #S.DEVSTAT.VERSION+1
>PUSHB (ZPPTR2),y
dey
>PUSHB (ZPPTR2),y
lda ZPPTR2
clc
adc #S.DEVSTAT.IDSTRING
tay
lda ZPPTR2+1
adc #0
>PUSHYA
ldy #S.DEVSTAT.SUBTYPE
>PUSHB (ZPPTR2),y
dey
>PUSHB (ZPPTR2),y
bit DEV.S
bpl .2
>LDYA L.MSG2.B
bra .3
.2 >LDYA L.MSG2.C
.3 >SYSCALL CPrintFYA
rts
*--------------------------------------
CS.EVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
MSG0 >CSTR "ID Status Flags Name Addr. Typ/Sub IDString Version Size (BLK)\r\n"
MSG1 >CSTR "%03d %b %b %4S $%H "
MSG2.B >CSTR "$%h/$%h %16S %03d.%03d %10u"
MSG2.C >CSTR "$%h/$%h %16S %03d.%03d n/a"
*--------------------------------------
DEV.ID .BS 1
DEV.S .BS 1
DEV.SIZE .BS 4
MAN
SAVE /A2OSX.SRC/BIN/LSDEV.S
ASM