mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 05:32:20 +00:00
412 lines
8.0 KiB
Plaintext
412 lines
8.0 KiB
Plaintext
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.VXD
|
||
.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 >PUSHW L.MSG.TOPBAR
|
||
>PUSHW A2osX.KVER
|
||
>PUSHBI 2
|
||
>SYSCALL PrintF
|
||
jsr CS.RUN.Load
|
||
bcs .1
|
||
|
||
>LDYA L.MSG.TOPBAR.OK
|
||
bra .2
|
||
|
||
.1 >LDYA L.MSG.TOPBAR.KO
|
||
|
||
.2 >PUSHYA
|
||
>PUSHBI 0
|
||
>SYSCALL PrintF
|
||
|
||
>PUSHW L.MSG.KCONF
|
||
>PUSHBI 0
|
||
>SYSCALL PrintF
|
||
|
||
>LDYAI A2osX.KCONFIG
|
||
jsr CS.RUN.DumpConfYA
|
||
|
||
>PUSHW L.MSG.STATUSBAR
|
||
>PUSHBI 0
|
||
>SYSCALL PrintF
|
||
|
||
CS.RUN.REPaint >PUSHW L.MSG.FCONF
|
||
>PUSHBI 0
|
||
>SYSCALL PrintF
|
||
|
||
>LDYA ZPCfgPtr
|
||
jsr CS.RUN.DumpConfYA
|
||
|
||
CS.RUN.Loop >SYSCALL GetChar
|
||
bcs .99
|
||
|
||
cmp #17 Ctrl-Q
|
||
bne .11
|
||
jmp .8
|
||
|
||
.11 cmp #19 Ctrl-S
|
||
bne .1
|
||
jsr CS.RUN.Save
|
||
bcc .10
|
||
tax
|
||
>PUSHW L.MSG.QUIT.ERR
|
||
txa
|
||
>PUSHA
|
||
>PUSHBI 1
|
||
bra .9
|
||
|
||
.10 >PUSHW L.MSG.QUIT.SAVED
|
||
bra .80
|
||
.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
|
||
|
||
lda #A2osX.F.CHROOT
|
||
bra .31
|
||
|
||
.3 cmp #16 Ctrl-P
|
||
bne .4
|
||
|
||
lda #A2osX.F.PMODE
|
||
.31 jsr CS.RUN.ToggleA
|
||
jmp CS.RUN.REPaint
|
||
|
||
.4 cmp #25 Ctrl-Y
|
||
bne .5
|
||
|
||
ldy #1
|
||
lda (ZPCfgPtr),y
|
||
and #7
|
||
inc
|
||
sta (ZPCfgPtr),y
|
||
jmp CS.RUN.REPaint
|
||
|
||
.5 cmp #'1'
|
||
bcc CS.RUN.Loop
|
||
cmp #'8'
|
||
bcs CS.RUN.Loop
|
||
|
||
and #$0f
|
||
ora #8
|
||
tay
|
||
|
||
lda #$FF
|
||
jsr CS.RUN.ToggleAatY
|
||
jmp CS.RUN.REPaint
|
||
|
||
.8 >PUSHW L.MSG.QUIT
|
||
.80 >PUSHBI 0
|
||
|
||
.9 >SYSCALL PrintF
|
||
lda #0
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN.ToggleA ldy #8
|
||
CS.RUN.ToggleAatY
|
||
eor (ZPCfgPtr),y
|
||
sta (ZPCfgPtr),y
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN.Load >PUSHW L.FILENAME
|
||
>PUSHEA.G StatBuf
|
||
>SYSCALL Stat
|
||
bcs .99
|
||
|
||
>LDA.G StatBuf+S.STAT.P.TYPE
|
||
eor #S.FI.T.SYS
|
||
bne .99
|
||
|
||
>PUSHW L.FILENAME
|
||
>PUSHBI O.RDONLY
|
||
>PUSHBI S.FI.T.SYS
|
||
>PUSHWI A2osX.KCONFIG
|
||
|
||
>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 >PUSHW L.FILENAME
|
||
>PUSHBI O.WRONLY+O.CREATE+O.TRUNC
|
||
>PUSHBI S.FI.T.SYS
|
||
>PUSHWI A2osX.KCONFIG
|
||
>SYSCALL FOpen
|
||
bcs .9
|
||
pha save hFile
|
||
|
||
>PUSHA
|
||
>PUSHW ZPCfgPtr
|
||
>PUSHWI 16 LEN
|
||
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
|
||
|
||
>PUSHW L.MSG.HZ
|
||
>PUSHB (ZPTmp1)
|
||
>PUSHBI 1
|
||
>SYSCALL PrintF
|
||
|
||
>PUSHW L.MSG.CHROOT
|
||
|
||
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
|
||
>SYSCALL PrintF
|
||
|
||
>PUSHW L.MSG.PMODE
|
||
|
||
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
|
||
|
||
>SYSCALL PrintF
|
||
|
||
>PUSHW L.MSG.TTYS
|
||
|
||
ldy #1
|
||
lda (ZPTmp1),y
|
||
>PUSHA
|
||
>PUSHBI 1
|
||
>SYSCALL PrintF
|
||
|
||
ldy #9 Slot 1
|
||
|
||
.1 >PUSHW L.MSG.SLOT
|
||
|
||
lda (ZPTmp1),y
|
||
ldx #SLOTS.MAX-1
|
||
|
||
.2 cmp SLOTS,x
|
||
beq .3
|
||
dex
|
||
bne .2
|
||
|
||
.3 phy
|
||
tya
|
||
sec
|
||
sbc #8
|
||
>PUSHA Slot
|
||
|
||
txa
|
||
asl
|
||
tax
|
||
>PUSHW T.MSG.SLOT.DESC,x
|
||
|
||
>PUSHBI 3
|
||
>SYSCALL PrintF
|
||
|
||
ply
|
||
iny
|
||
cpy #16
|
||
bne .1
|
||
|
||
>PUSHW L.MSG.PROMPT
|
||
>PUSHBI 0
|
||
>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.VXD
|
||
.DA #A2osX.S.ATK
|
||
.DA #A2osX.S.D2
|
||
.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 .CZ "\e[40;37m\e[7m\e[1;1HA2osX %d.%d Kernel Config Utility : "
|
||
MSG.TOPBAR.OK .CZ "KCONFIG File Successfully Loaded. \e[0m"
|
||
MSG.TOPBAR.KO .CZ "Invalid/missing KCONFIG File. \e[0m"
|
||
MSG.STATUSBAR .CZ "\e[40;37m\e[7m\e[24;1H(1-7):En/Dis Slot, Ctrl:(Q)uit,(S)ave,(T)iming,(C)HRoot,(P)reemptive,TT(Y)s \e[0m"
|
||
MSG.KCONF .CZ "\e[93;44m\e[2;1H------ Actual Kernel Configuration ------\e[K\r\n"
|
||
MSG.FCONF .CZ "\e[93;44m\e[13;1H------ KCONFIG File Configuration -------\e[K\r\n"
|
||
MSG.HZ .CZ " Machine Timing : %d0 Hz\e[K\r\n"
|
||
MSG.CHROOT .CZ " CHRoot to /RAMx : %10s"
|
||
MSG.PMODE .CZ " Preemptive Mode : %s\e[K\r\n"
|
||
MSG.TTYS .CZ " #TTYs : %d\e[K\r\n"
|
||
MSG.ENABLED .CZ "Enabled "
|
||
MSG.DISABLED .CZ "Disabled"
|
||
MSG.SLOT .CZ " Slot #%d : %s\e[K\r\n"
|
||
MSG.SLOT.NODEV .CZ "<Enabled>"
|
||
MSG.SLOT.Z80 .CZ "Z80 CPU Board"
|
||
MSG.SLOT.VXD .CZ "VxDrive"
|
||
MSG.SLOT.ATK .CZ "AppleTalk Board"
|
||
MSG.SLOT.DII .CZ "Disk ][ Controller"
|
||
MSG.SLOT.BLK .CZ "Generic Block/SCSI Controller"
|
||
MSG.SLOT.SP .CZ "SmartPort Controller"
|
||
MSG.SLOT.COM .CZ "Communication Card"
|
||
MSG.SLOT.XY .CZ "XY Pointing Device"
|
||
MSG.SLOT.NIC .CZ "Network Interface Card"
|
||
MSG.SLOT.CLK .CZ "Clock Card"
|
||
MSG.SLOT.DIS .CZ "<Disabled>"
|
||
MSG.PROMPT .CZ "\e[24;80H"
|
||
MSG.QUIT .CZ "\ec"
|
||
MSG.QUIT.SAVED .CZ "\ecA2osX.kconfig file saved.\r\n\r\n"
|
||
MSG.QUIT.ERR .CZ "\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
|