A2osX/BIN/KCONFIG.S.txt
2019-12-09 16:53:14 +01:00

396 lines
8.1 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.

NEW
PREFIX
AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF bin/kconfig
*--------------------------------------
.INB INC/MACROS.I
.INB INC/MLI.I
.INB INC/A2OSX.I
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPCfgPtr .BS 2
ZPTmp1 .BS 2
hFileBuf .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA #S.PS.F.EVENT
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data Segment Size
.DA #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.FILENAME .DA FILENAME
L.MSG.TOPBAR .DA MSG.TOPBAR
L.MSG.TOPBAR.OK .DA MSG.TOPBAR.OK
L.MSG.TOPBAR.KO .DA MSG.TOPBAR.KO
L.MSG.STATUSBAR .DA MSG.STATUSBAR
L.MSG.KCONF .DA MSG.KCONF
L.MSG.FCONF .DA MSG.FCONF
L.MSG.HZ .DA MSG.HZ
L.MSG.CHROOT .DA MSG.CHROOT
L.MSG.PMODE .DA MSG.PMODE
L.MSG.TTYS .DA MSG.TTYS
L.MSG.DISABLED .DA MSG.DISABLED
L.MSG.ENABLED .DA MSG.ENABLED
L.MSG.SLOT .DA MSG.SLOT
L.MSG.QUIT .DA MSG.QUIT
L.MSG.QUIT.SAVED
.DA MSG.QUIT.SAVED
L.MSG.QUIT.ERR .DA MSG.QUIT.ERR
T.MSG.SLOT.DESC .DA MSG.SLOT.NODEV
.DA MSG.SLOT.Z80
.DA MSG.SLOT.VSD
.DA MSG.SLOT.ATK
.DA MSG.SLOT.DII
.DA MSG.SLOT.BLK
.DA MSG.SLOT.SP
.DA MSG.SLOT.COM
.DA MSG.SLOT.XY
.DA MSG.SLOT.NIC
.DA MSG.SLOT.CLK
.DA MSG.SLOT.DIS
L.MSG.PROMPT .DA MSG.PROMPT
.DA 0 End Of Reloc Table
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
CS.RUN >PUSHBI 0
>LDYA L.MSG.TOPBAR
>SYSCALL printf
jsr CS.RUN.Load
bcs .1
>PUSHBI 0
>LDYA L.MSG.TOPBAR.OK
bra .2
.1 >PUSHBI 0
>LDYA L.MSG.TOPBAR.KO
.2 >SYSCALL printf
>PUSHBI 0
>LDYA L.MSG.KCONF
>SYSCALL printf
>LDYAI A2osX.KCONFIG
jsr CS.RUN.DumpConfYA
>PUSHBI 0
>LDYA L.MSG.STATUSBAR
>SYSCALL printf
CS.RUN.REPaint >PUSHBI 0
>LDYA L.MSG.FCONF
>SYSCALL printf
>LDYA ZPCfgPtr
jsr CS.RUN.DumpConfYA
CS.RUN.Loop >SYSCALL GetChar
bcs .99
cmp #17 Ctrl-Q
beq .8
cmp #19 Ctrl-S
bne .1
jsr CS.RUN.Save
bcc .10
>PUSHA
>PUSHBI 1
>LDYA L.MSG.QUIT.ERR
bra .9
.10 >PUSHBI 1
>LDYA L.MSG.QUIT.SAVED
bra .9
.99 rts
.1 cmp #20 Ctrl-T
bne .2
lda (ZPCfgPtr)
eor #3
sta (ZPCfgPtr)
bra CS.RUN.REPaint
.2 cmp #3 Ctrl-C
bne .3
ldy #8
lda (ZPCfgPtr),y
eor #A2osX.F.CHROOT
sta (ZPCfgPtr),y
bra CS.RUN.REPaint
.3 cmp #16 Ctrl-P
bne .4
ldy #8
lda (ZPCfgPtr),y
eor #A2osX.F.PMODE
sta (ZPCfgPtr),y
bra CS.RUN.REPaint
.4 cmp #25 Ctrl-Y
bne .5
ldy #1
lda (ZPCfgPtr),y
and #3
inc
sta (ZPCfgPtr),y
jmp CS.RUN.REPaint
.5 cmp #'1'
bcc CS.RUN.Loop
cmp #'8'
bcs CS.RUN.Loop
and #$0f
clc
adc #8
tay
lda (ZPCfgPtr),y
eor #$FF
sta (ZPCfgPtr),y
jmp CS.RUN.REPaint
.8 >PUSHBI 0
>LDYA L.MSG.QUIT
.9 >SYSCALL printf
lda #0
sec
rts
*--------------------------------------
CS.RUN.Load >PUSHEA.G StatBuf
>LDYA L.FILENAME
>SYSCALL Stat
bcs .99
* >LDA.G StatBuf+S.STAT.SIZE
* eor #16
* bne .99
* iny
* lda (pData),y
* iny
* ora (pData),y
* iny
* ora (pData),y
* bne .99
>LDA.G StatBuf+S.STAT.P.TYPE
eor #S.FI.T.SYS
bne .99
>PUSHWI A2osX.KCONFIG
>PUSHBI S.FI.T.SYS
>PUSHBI O.RDONLY
>LDYA L.FILENAME
>SYSCALL LoadFile
bcs .99
stx hFileBuf
txa
>SYSCALL GetMemPtr
>STYA ZPCfgPtr
* clc
rts
.99 >LDYAI 16
>SYSCALL GetMem
>STYA ZPCfgPtr
stx hFileBuf
ldy #0
.1 lda A2osX.KCONFIG,y
sta (ZPCfgPtr),y
iny
cpy #9
bne .1
lda #0
.2 sta (ZPCfgPtr),y
iny
cpy #16
bne .2
sec
rts
*--------------------------------------
CS.RUN.Save >PUSHWI A2osX.KCONFIG
>PUSHBI S.FI.T.SYS
>PUSHBI O.WRONLY+O.CREATE+O.TRUNC
>LDYA L.FILENAME
>SYSCALL FOpen
bcs .9
pha save hFile
>PUSHWI 16 LEN
>PUSHW ZPCfgPtr
pla
pha
>SYSCALL FWrite
bcc .1
tax
pla
phx
>SYSCALL FClose
pla
sec
rts
.1 pla
>SYSCALL FClose
.9 rts
*--------------------------------------
CS.RUN.DumpConfYA
>STYA ZPTmp1
>PUSHB (ZPTmp1)
>PUSHBI 1
>LDYA L.MSG.HZ
>SYSCALL printf
ldy #8
lda (ZPTmp1),y
and #A2osX.F.CHROOT
bne .10
>LDYA L.MSG.DISABLED
bra .12
.10 >LDYA L.MSG.ENABLED
.12 >PUSHYA
>PUSHBI 2
>LDYA L.MSG.CHROOT
>SYSCALL printf
ldy #8
lda (ZPTmp1),y
and #A2osX.F.PMODE
bne .13
>LDYA L.MSG.DISABLED
bra .14
.13 >LDYA L.MSG.ENABLED
.14 >PUSHYA
>PUSHBI 2
>LDYA L.MSG.PMODE
>SYSCALL printf
ldy #1
lda (ZPTmp1),y
>PUSHA
>PUSHBI 1
>LDYA L.MSG.TTYS
>SYSCALL printf
ldy #9 Slot 1
.1 lda (ZPTmp1),y
ldx #SLOTS.MAX-1
.2 cmp SLOTS,x
beq .3
dex
bne .2
.3 phy
txa
asl
tax
>PUSHB T.MSG.SLOT.DESC+1,x
>PUSHB T.MSG.SLOT.DESC,x
pla
pha
sec
sbc #8
>PUSHA Slot
>PUSHBI 3
>LDYA L.MSG.SLOT
>SYSCALL printf
ply
iny
cpy #16
bne .1
>PUSHBI 0
>LDYA L.MSG.PROMPT
>SYSCALL printf
clc
rts
*--------------------------------------
CS.DOEVENT sec do not discard TIMER event
rts
*--------------------------------------
CS.QUIT lda hFileBuf
beq .8
>SYSCALL FreeMem
.8 clc
rts
*--------------------------------------
CS.END
SLOTS .DA #0
.DA #A2osX.S.Z80
.DA #A2osX.S.VSDRIVE
.DA #A2osX.S.ATCARD
.DA #A2osX.S.DII
.DA #A2osX.S.BLK
.DA #A2osX.S.SP
.DA #A2osX.S.COM
.DA #A2osX.S.XY
.DA #A2osX.S.NIC
.DA #A2osX.S.CLK
.DA #A2osX.S.DISABLE
SLOTS.MAX .EQ *-SLOTS
*--------------------------------------
FILENAME .AZ "${ROOT}A2osX.kconfig"
MSG.TOPBAR .AZ "\e[40;37m\e[7m\e[1;1HA2osX Kernel Config Utility : "
MSG.TOPBAR.OK .AZ "KCONFIG File Successfully Loaded. \e[0m"
MSG.TOPBAR.KO .AZ "Invalid/missing KCONFIG File. \e[0m"
MSG.STATUSBAR .AZ "\e[40;37m\e[7m\e[24;1HSlot 1-7:En/Dis Ctrl:(Q)uit,(S)ave,(T)iming,(C)HRoot,(P)reemptive,TT(Y)s \e[0m"
MSG.KCONF .AZ "\e[93;44m\e[2;1H------ Actual Kernel Configuration ------\e[K\r\n"
MSG.FCONF .AZ "\e[93;44m\e[13;1H------ KCONFIG File Configuration -------\e[K\r\n"
MSG.HZ .AZ " Machine Timing : %d0 Hz\e[K\r\n"
MSG.CHROOT .AZ " CHRoot to /RAMx : %10s"
MSG.PMODE .AZ " Preemptive Mode : %s\e[K\r\n"
MSG.TTYS .AZ " #TTYs : %d\e[K\r\n"
MSG.ENABLED .AZ "Enabled "
MSG.DISABLED .AZ "Disabled"
MSG.SLOT .AZ " Slot #%d : %s\e[K\r\n"
MSG.SLOT.NODEV .AZ "<Enabled>"
MSG.SLOT.Z80 .AZ "Z80 CPU Board"
MSG.SLOT.VSD .AZ "SSC Shared Driver for VSDRIVE"
MSG.SLOT.ATK .AZ "AppleTalk Board"
MSG.SLOT.DII .AZ "Disk ][ Controller"
MSG.SLOT.BLK .AZ "Generic Block/SCSI Controller"
MSG.SLOT.SP .AZ "SmartPort Controller"
MSG.SLOT.COM .AZ "Communication Card"
MSG.SLOT.XY .AZ "XY Pointing Device"
MSG.SLOT.NIC .AZ "Network Interface Card"
MSG.SLOT.CLK .AZ "Clock Card"
MSG.SLOT.DIS .AZ "<Disabled>"
MSG.PROMPT .AZ "\e[24;80H"
MSG.QUIT .AZ "\ec"
MSG.QUIT.SAVED .AZ "\ecA2osX.kconfig file saved.\r\n\r\n"
MSG.QUIT.ERR .AZ "\ecError [$%h] while writing A2osX.kconfig file.\r\n\r\n"
*--------------------------------------
.DUMMY
.OR 0
DS.START
StatBuf .BS S.STAT
DS.END .ED
MAN
SAVE USR/SRC/BIN/KCONFIG.S
ASM