A2osX/SBIN/KCONFIG.S.txt
2017-10-19 17:27:38 +02:00

387 lines
7.8 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/SBIN/KCONFIG
*--------------------------------------
.INB /A2OSX.BUILD/INC/MACROS.I
.INB /A2OSX.BUILD/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
.DA MSG.SLOT.PRT
.DA MSG.SLOT.COM
.DA MSG.SLOT.XY
.DA MSG.SLOT.NET
.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
>SYSCALL ExpandStr.YA
txa
>STA.G hFileName
>LDYA L.MSG.TOPBAR
>SYSCALL PrintF.YA
jsr CS.RUN.Load
bcs .1
>LDYA L.MSG.TOPBAR.OK
bra .2
.1 >LDYA L.MSG.TOPBAR.KO
.2 >SYSCALL PrintF.YA
>LDYA L.MSG.KCONF
>SYSCALL PrintF.YA
>LDYAI A2osX.HZ
jsr CS.RUN.DumpConfYA
>LDYA L.MSG.STATUSBAR
>SYSCALL PrintF.YA
CS.RUN.REPaint >LDYA L.MSG.FCONF
>SYSCALL PrintF.YA
>LDYA ZPCfgPtr
jsr CS.RUN.DumpConfYA
CS.RUN.Loop >SYSCALL 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
>LDYA L.MSG.QUIT.ERR
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
bra CS.RUN.REPaint
.8 >LDYA L.MSG.QUIT
.9 >SYSCALL PrintF.YA
lda #0
sec
rts
*--------------------------------------
CS.RUN.Load >PUSHEA.G StatBuf
>LDA.G hFileName
>SYSCALL GetMemPtr.A
>PUSHYA
>SYSCALL Stat
bcs .99
* sec
* lda UsrBuf256+S.STAT.SIZE
* eor #16
* bne .99
* lda UsrBuf256+S.STAT.SIZE+1
* ora UsrBuf256+S.STAT.SIZE+2
* ora UsrBuf256+S.STAT.SIZE+3
* bne .99
>LDA.G StatBuf+S.STAT.P.TYPE
eor #6
bne .99
>PUSHWI 0 Aux type
>PUSHBI 6 S.FILEINFO.TYPE.BIN
>PUSHBI SYS.FOpen.R
>LDA.G hFileName
>SYSCALL GetMemPtr.A
>PUSHYA
>SYSCALL LoadFile
bcs .99
txa
>STA.G hFileBuf
>SYSCALL GetMemPtr.A
>STYA ZPCfgPtr
* clc
rts
.99 >LDYAI 16
>SYSCALL GetMem0.YA
>STYA ZPCfgPtr
txa
>STA.G hFileBuf
lda #6
sta (ZPCfgPtr)
sec
rts
*--------------------------------------
CS.RUN.Save >PUSHWI 0 AUXTYPE
>PUSHBI 6 S.FILEINFO.TYPE.BIN
>PUSHBI SYS.FOpen.W+SYS.FOpen.X
>LDA.G hFileName
>SYSCALL GetMemPtr.A
>PUSHYA
>SYSCALL FOpen
bcs .9
pha save hFile
>PUSHW ZPCfgPtr
>PUSHWI 16 LEN
pla
pha
>PUSHA
>SYSCALL FWrite
bcc .1
tax
pla
phx
>SYSCALL FClose.A
pla
sec
rts
.1 pla
>SYSCALL FClose.A
.9 rts
*--------------------------------------
CS.RUN.DumpConfYA
>STYA ZPTmp1
>PUSHB (ZPTmp1)
>LDYA L.MSG.HZ
>SYSCALL PrintF.YA
ldy #8
lda (ZPTmp1),y
and #A2osX.F.CHROOT
bne .10
>LDYA L.MSG.DISABLED
bra .12
.10 >LDYA L.MSG.ENABLED
.12 >PUSHYA
>LDYA L.MSG.CHROOT
>SYSCALL PrintF.YA
ldy #8
lda (ZPTmp1),y
and #A2osX.F.PMODE
bne .13
>LDYA L.MSG.DISABLED
bra .14
.13 >LDYA L.MSG.ENABLED
.14 >PUSHYA
>LDYA L.MSG.PMODE
>SYSCALL PrintF.YA
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
>LDYA L.MSG.SLOT
>SYSCALL PrintF.YA
ply
iny
cpy #16
bne .1
>LDYA L.MSG.PROMPT
>SYSCALL PrintF.YA
clc
rts
*--------------------------------------
CS.DOEVENT sec do not discard TIMER event
rts
*--------------------------------------
CS.QUIT ldy #hFileBuf
lda (pData),y
beq .1
>SYSCALL FreeMem.A
.1 ldy #hFileName
lda (pData),y
beq .8
>SYSCALL FreeMem.A
.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.DISABLE
SLOTS.MAX .EQ *-SLOTS
*--------------------------------------
FILENAME >CSTR "${A2OSX}A2osX.KCONFIG"
MSG.TOPBAR >CSTR "\ec\e[7m\e[1;1HA2osX Kernel Config Utility : "
MSG.TOPBAR.OK >CSTR "KCONFIG File Successfully Loaded. \e[0m"
MSG.TOPBAR.KO >CSTR "Invalid/missing KCONFIG File. \e[0m"
MSG.STATUSBAR >CSTR "\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 >CSTR "\e[2;1H------ Actual Kernel Configuration ------\r\n"
MSG.FCONF >CSTR "\e[13;1H------ KCONFIG File Configuration -------\r\n"
MSG.HZ >CSTR " Machine Timing : %d0 Hz\r\n"
MSG.PMODE >CSTR " Preemptive Mode : %s\r\n"
MSG.CHROOT >CSTR " CHRoot to /RAMx : %s\r\n"
MSG.ENABLED >CSTR "Enabled "
MSG.DISABLED >CSTR "Disabled"
MSG.SLOT >CSTR " Slot #%d : %s\r\n"
MSG.SLOT.NODEV >CSTR "<Enabled> "
MSG.SLOT.Z80 >CSTR "Z80 CPU Board"
MSG.SLOT.VSD >CSTR "SSC Shared Driver for VSDRIVE"
MSG.SLOT.ATK >CSTR "AppleTalk Board"
MSG.SLOT.DII >CSTR "Disk II Controller"
MSG.SLOT.BLK >CSTR "Generic Block/SCSI Controller"
MSG.SLOT.PRT >CSTR "SmartPort Controller"
MSG.SLOT.COM >CSTR "Communication Card"
MSG.SLOT.XY >CSTR "XY Pointing Device"
MSG.SLOT.NET >CSTR "Network Interface Card"
MSG.SLOT.DIS >CSTR "<Disabled>"
MSG.PROMPT >CSTR "\e[24;80H"
MSG.QUIT >CSTR "\ec"
MSG.QUIT.ERR >CSTR "\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
SAVE /A2OSX.SRC/SBIN/KCONFIG.S
ASM