A2osX/SBIN/KCONFIG.S.txt

401 lines
7.9 KiB
Plaintext
Raw Normal View History

NEW
2018-11-17 17:17:13 +00:00
PREFIX
2018-08-08 15:13:37 +00:00
AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
2018-07-23 15:28:42 +00:00
.TF SBIN/KCONFIG
*--------------------------------------
2018-07-23 15:28:42 +00:00
.INB INC/MACROS.I
2018-10-08 05:55:28 +00:00
.INB INC/MLI.I
2018-07-23 15:28:42 +00:00
.INB INC/A2OSX.I
*--------------------------------------
ZPCfgPtr .EQ ZPBIN
ZPTmp1 .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 CS
.DA DS.END-DS.START DS
.DA #16 SS
.DA #4 ZP
.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.PMODE .DA MSG.PMODE
L.MSG.CHROOT .DA MSG.CHROOT
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.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
2018-12-01 19:39:44 +00:00
.DA MSG.SLOT.SP
.DA MSG.SLOT.COM
.DA MSG.SLOT.XY
2018-12-01 19:39:44 +00:00
.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 >LDYA L.FILENAME
2018-07-20 05:43:11 +00:00
>SYSCALL ExpandStr
txa
>STA.G hFileName
2019-01-04 13:17:31 +00:00
2018-08-22 15:23:27 +00:00
>PUSHBI 0
>LDYA L.MSG.TOPBAR
2018-06-21 15:12:10 +00:00
>SYSCALL printf
jsr CS.RUN.Load
bcs .1
2018-08-22 15:23:27 +00:00
>PUSHBI 0
>LDYA L.MSG.TOPBAR.OK
bra .2
2019-01-04 13:17:31 +00:00
2018-08-22 15:23:27 +00:00
.1 >PUSHBI 0
>LDYA L.MSG.TOPBAR.KO
2018-06-21 15:12:10 +00:00
.2 >SYSCALL printf
2018-08-22 15:23:27 +00:00
>PUSHBI 0
>LDYA L.MSG.KCONF
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2018-10-08 05:55:28 +00:00
>LDYAI A2osX.KCONFIG
jsr CS.RUN.DumpConfYA
2018-08-22 15:23:27 +00:00
>PUSHBI 0
>LDYA L.MSG.STATUSBAR
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2018-08-22 15:23:27 +00:00
CS.RUN.REPaint >PUSHBI 0
>LDYA L.MSG.FCONF
2018-06-21 15:12:10 +00:00
>SYSCALL printf
>LDYA ZPCfgPtr
jsr CS.RUN.DumpConfYA
CS.RUN.Loop >SLEEP
>SYSCALL GetChar
bcs CS.RUN.Loop
cmp #17 Ctrl-Q
beq .8
cmp #19 Ctrl-S
bne .1
jsr CS.RUN.Save
bcc .8
>PUSHA
2018-10-29 08:41:10 +00:00
>PUSHBI 1
>LDYA L.MSG.QUIT.ERR
2018-10-29 08:41:10 +00:00
bra .9
.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 #'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
2018-08-22 15:23:27 +00:00
jmp CS.RUN.REPaint
2018-08-22 15:23:27 +00:00
.8 >PUSHBI 0
>LDYA L.MSG.QUIT
2018-10-29 08:41:10 +00:00
.9 >SYSCALL printf
lda #0
sec
rts
*--------------------------------------
CS.RUN.Load >PUSHEA.G StatBuf
>LDA.G hFileName
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
2019-01-04 13:17:31 +00:00
>SYSCALL Stat
bcs .99
2019-01-04 13:17:31 +00:00
* >LDA.G StatBuf+S.STAT.SIZE
* eor #16
* bne .99
2019-01-04 13:17:31 +00:00
* iny
* lda (pData),y
* iny
* ora (pData),y
* iny
* ora (pData),y
* bne .99
>LDA.G StatBuf+S.STAT.P.TYPE
2018-10-08 05:55:28 +00:00
eor #S.FI.T.SYS
bne .99
2018-10-08 05:55:28 +00:00
>PUSHWI A2osX.KCONFIG
>PUSHBI S.FI.T.SYS
2018-10-02 15:52:30 +00:00
>PUSHBI O.RDONLY
2018-07-25 15:26:14 +00:00
>LDA.G hFileName
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
>SYSCALL LoadFile
bcs .99
txa
>STA.G hFileBuf
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
>STYA ZPCfgPtr
* clc
rts
.99 >LDYAI 16
2018-07-20 05:43:11 +00:00
>SYSCALL GetMem0
>STYA ZPCfgPtr
txa
>STA.G hFileBuf
2019-01-04 13:17:31 +00:00
lda #6 60 Hz
sta (ZPCfgPtr)
2019-01-04 13:17:31 +00:00
ldy #1
lda #4 4 TTYs
sta (ZPCfgPtr),y
sec
rts
*--------------------------------------
2018-10-08 05:55:28 +00:00
CS.RUN.Save >PUSHWI A2osX.KCONFIG
>PUSHBI S.FI.T.SYS
>PUSHBI O.WRONLY+O.CREATE+O.TRUNC
>LDA.G hFileName
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
>SYSCALL FOpen
bcs .9
pha save hFile
>PUSHWI 16 LEN
2018-07-25 15:26:14 +00:00
>PUSHW ZPCfgPtr
pla
pha
>SYSCALL FWrite
bcc .1
tax
pla
phx
2018-07-20 05:43:11 +00:00
>SYSCALL FClose
pla
sec
rts
.1 pla
2018-07-20 05:43:11 +00:00
>SYSCALL FClose
.9 rts
*--------------------------------------
CS.RUN.DumpConfYA
>STYA ZPTmp1
>PUSHB (ZPTmp1)
2018-08-22 15:23:27 +00:00
>PUSHBI 1
>LDYA L.MSG.HZ
2018-06-21 15:12:10 +00:00
>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
2018-08-22 15:23:27 +00:00
>PUSHBI 2
>LDYA L.MSG.CHROOT
2018-06-21 15:12:10 +00:00
>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
2018-08-22 15:23:27 +00:00
>PUSHBI 2
>LDYA L.MSG.PMODE
2018-06-21 15:12:10 +00:00
>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
2018-08-22 15:23:27 +00:00
>PUSHBI 3
>LDYA L.MSG.SLOT
2018-06-21 15:12:10 +00:00
>SYSCALL printf
ply
iny
cpy #16
bne .1
2018-08-22 15:23:27 +00:00
>PUSHBI 0
>LDYA L.MSG.PROMPT
2018-06-21 15:12:10 +00:00
>SYSCALL printf
clc
rts
*--------------------------------------
CS.DOEVENT sec do not discard TIMER event
rts
*--------------------------------------
2018-10-29 08:41:10 +00:00
CS.QUIT >LDA.G hFileBuf
beq .1
2018-07-18 15:30:42 +00:00
>SYSCALL FreeMem
2018-10-29 08:41:10 +00:00
.1 >LDA.G hFileName
beq .8
2018-07-18 15:30:42 +00:00
>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
2018-12-01 19:39:44 +00:00
.DA #A2osX.S.CLK
.DA #A2osX.S.DISABLE
SLOTS.MAX .EQ *-SLOTS
*--------------------------------------
2018-11-28 16:01:33 +00:00
FILENAME .AZ "${ROOT}A2osX.KCONFIG"
MSG.TOPBAR .AZ "\e[37;100m\ec\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"
2018-11-28 16:01:33 +00:00
MSG.STATUSBAR .AZ "\e[37;100m\e[7m\e[24;1HCtrl-Q:Quit,Ctrl-S:Save,Ctrl-T:Time,Ctrl-P:Preemptive,Ctrl-C:CHRoot,1-7:En/Dis \e[0m"
MSG.KCONF .AZ "\e[93;44m\e[2;1H------ Actual Kernel Configuration ------\r\n"
MSG.FCONF .AZ "\e[93;44m\e[13;1H------ KCONFIG File Configuration -------\r\n"
MSG.HZ .AZ " Machine Timing : %d0 Hz\r\n"
MSG.PMODE .AZ " Preemptive Mode : %s\r\n"
MSG.CHROOT .AZ " CHRoot to /RAMx : %s\r\n"
MSG.ENABLED .AZ "Enabled "
MSG.DISABLED .AZ "Disabled"
MSG.SLOT .AZ " Slot #%d : %s\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 II Controller"
MSG.SLOT.BLK .AZ "Generic Block/SCSI Controller"
2018-12-01 19:39:44 +00:00
MSG.SLOT.SP .AZ "SmartPort Controller"
MSG.SLOT.COM .AZ "Communication Card"
MSG.SLOT.XY .AZ "XY Pointing Device"
2018-12-01 19:39:44 +00:00
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.ERR .AZ "\ecError [$%h] While Writing KCONFIG File.\r\n\r\n"
*--------------------------------------
.DUMMY
.OR 0
DS.START
hFileName .BS 1
hFileBuf .BS 1
StatBuf .BS S.STAT
DS.END .ED
MAN
2018-11-17 17:17:13 +00:00
SAVE USR/SRC/SBIN/KCONFIG.S
ASM