mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-20 03:31:42 +00:00
140 lines
2.7 KiB
Plaintext
140 lines
2.7 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.BUILD
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF BIN/LSDEV
|
||
*--------------------------------------
|
||
.INB INC/MACROS.I
|
||
.INB INC/A2OSX.I
|
||
.INB INC/KERNEL.I
|
||
.INB INC/LIBSTR.I
|
||
*--------------------------------------
|
||
ZPPTR1 .EQ ZPBIN
|
||
ZPPTR2 .EQ ZPBIN+2
|
||
ZPPTR3 .EQ ZPBIN+4
|
||
*--------------------------------------
|
||
* Main entry point
|
||
*--------------------------------------
|
||
* Code signature and INIT table
|
||
*--------------------------------------
|
||
* CLD $D8
|
||
* JMP (*,x) $7C
|
||
* #JMPTABLE
|
||
* /JMPTABLE
|
||
*--------------------------------------
|
||
CS.START cld
|
||
jmp (.1,x)
|
||
.1 .DA CS.INIT
|
||
.DA CS.RUN
|
||
.DA CS.EVENT
|
||
.DA CS.QUIT
|
||
L.LIBSTR .DA LIBSTR
|
||
L.MSG0 .DA MSG0
|
||
L.MSG1 .DA MSG1
|
||
L.MSG2 .DA MSG2
|
||
.DA 0
|
||
.DA CS.END-CS.START Code Length To Relocate
|
||
.DA 0 Data Segment to Allocate
|
||
*--------------------------------------
|
||
CS.INIT >LIBLOADP L.LIBSTR
|
||
* bcs .9
|
||
sta hLIBSTR
|
||
|
||
>SYSCALL SYS.GetDevTable
|
||
>STYA ZPPTR1
|
||
stz DEV.COUNT
|
||
|
||
L0 >PUSHW L.MSG0
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
lda #22
|
||
sta LINE.COUNT
|
||
L1 lda (ZPPTR1)
|
||
bmi .1
|
||
jmp L41
|
||
|
||
.1 ldy #S.DEV.hARGS
|
||
lda (ZPPTR1),y
|
||
beq L10
|
||
>SYSCALL SYS.GetMemPtrA
|
||
>PUSHYA
|
||
bra L11
|
||
|
||
L10 >PUSHW L.MSG2
|
||
|
||
L11 ldy #S.DEV.hCMD
|
||
lda (ZPPTR1),y
|
||
beq L12
|
||
>SYSCALL SYS.GetMemPtrA
|
||
>PUSHYA
|
||
bra L13
|
||
|
||
L12 >PUSHW L.MSG2
|
||
|
||
L13 lda ZPPTR1
|
||
clc
|
||
adc #S.DEV.NAME
|
||
sta ZPPTR2
|
||
lda ZPPTR1+1
|
||
adc #0
|
||
sta ZPPTR2+1
|
||
>PUSHW ZPPTR2
|
||
|
||
ldy #S.DEV.hOWNERPS
|
||
lda (ZPPTR1),y
|
||
>PUSHA Owner PSID
|
||
lda (ZPPTR1) push flags
|
||
>PUSHA
|
||
ldy #S.DEV.ID
|
||
lda (ZPPTR1),y
|
||
>PUSHA DevID
|
||
>PUSHW L.MSG1
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
L4 dec LINE.COUNT
|
||
L41 lda ZPPTR1
|
||
clc
|
||
adc #S.DEV.SIZE
|
||
sta ZPPTR1
|
||
bcc L5
|
||
inc ZPPTR1+1
|
||
L5 inc DEV.COUNT
|
||
lda DEV.COUNT
|
||
cmp #K.DEV.MAX
|
||
beq L8
|
||
lda LINE.COUNT
|
||
beq L6
|
||
jmp L1
|
||
L6 >DEBUG
|
||
jmp L0
|
||
|
||
L8 lda #0 tell TSKMGR that all done ok, but
|
||
sec we do not want to stay in memory
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN
|
||
CS.EVENT clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT lda hLIBSTR
|
||
|
||
bra *
|
||
|
||
>SYSCALL SYS.UnloadLibA
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
hLIBSTR .BS 1
|
||
DEV.COUNT .BS 1
|
||
LINE.COUNT .BS 1
|
||
LIBSTR >PSTRING "libstr.o"
|
||
MSG0 >CSTRING "hDev Flags PID NAME CMD ARGS\n"
|
||
MSG1 >CSTRING " %03d %b $%h %4S %16S %32S\n"
|
||
MSG2 >PSTRING "(none)"
|
||
MAN
|
||
SAVE BIN/LSDEV.S
|
||
ASM
|