mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-23 07:35:19 +00:00
8702d8c4e1
Bug Fix in SHELL, $?,$$....sysvars not printed at all Generalized use of new MemMgr API Call in all DRV,BIN,SBIN & LIB
379 lines
7.8 KiB
Plaintext
379 lines
7.8 KiB
Plaintext
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
|
||
*--------------------------------------
|
||
ZPTmp1 .EQ ZPBIN
|
||
ZPTmp2 .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
|
||
.DA DS.END-DS.START Data Segment to Allocate
|
||
.DA 0
|
||
.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.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 ExpandPStrYA
|
||
txa
|
||
ldy #hFileName
|
||
sta (pData),y
|
||
|
||
>LDYA L.MSG.TOPBAR
|
||
>SYSCALL PPrintFYA
|
||
|
||
jsr CS.RUN.Load
|
||
bcs .1
|
||
>LDYA L.MSG.TOPBAR.OK
|
||
bra .2
|
||
.1 >LDYA L.MSG.TOPBAR.KO
|
||
|
||
.2 >SYSCALL PPrintFYA
|
||
|
||
>LDYA L.MSG.KCONF
|
||
>SYSCALL PPrintFYA
|
||
|
||
>LDYAI A2osX.HZ
|
||
jsr CS.RUN.DumpConfYA
|
||
|
||
>LDYA L.MSG.STATUSBAR
|
||
>SYSCALL PPrintFYA
|
||
|
||
CS.RUN.REPaint >LDYA L.MSG.FCONF
|
||
>SYSCALL PPrintFYA
|
||
|
||
ldy #hFileBuf
|
||
lda (pData),y
|
||
>SYSCALL GetMemPtrA
|
||
jsr CS.RUN.DumpConfYA
|
||
|
||
CS.RUN.Loop >SYSCALL Sleep
|
||
>SYSCALL GetC
|
||
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
|
||
|
||
jsr CS.RUN.ToggleHZ
|
||
bra CS.RUN.REPaint
|
||
|
||
.2 cmp #3 Ctrl-C
|
||
bne .3
|
||
|
||
jsr CS.RUN.ToggleCHRoot
|
||
bra CS.RUN.REPaint
|
||
|
||
.3 cmp #'1'
|
||
bcc CS.RUN.Loop
|
||
cmp #'8'
|
||
bcs CS.RUN.Loop
|
||
and #$0f
|
||
jsr CS.RUN.ToggleSlotA
|
||
bra CS.RUN.REPaint
|
||
|
||
.8 >LDYA L.MSG.QUIT
|
||
.9 >SYSCALL PPrintFYA
|
||
lda #0
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN.ToggleHZ ldy #hFileBuf
|
||
lda (pData),y
|
||
>SYSCALL GetMemPtrA
|
||
>STYA ZPTmp1
|
||
|
||
lda (ZPTmp1)
|
||
eor #3
|
||
sta (ZPTmp1)
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN.ToggleCHRoot
|
||
ldy #hFileBuf
|
||
lda (pData),y
|
||
>SYSCALL GetMemPtrA
|
||
>STYA ZPTmp1
|
||
|
||
ldy #8
|
||
lda (ZPTmp1),y
|
||
eor #$FF
|
||
sta (ZPTmp1),y
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN.ToggleSlotA
|
||
pha
|
||
|
||
ldy #hFileBuf
|
||
lda (pData),y
|
||
>SYSCALL GetMemPtrA
|
||
>STYA ZPTmp1
|
||
|
||
pla
|
||
clc
|
||
adc #8
|
||
tay
|
||
lda (ZPTmp1),y
|
||
eor #$FF
|
||
sta (ZPTmp1),y
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN.Load >PUSHWI UsrBuf256
|
||
ldy #hFileName
|
||
lda (pData),y
|
||
>SYSCALL GetMemPtrA
|
||
>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 UsrBuf256+S.STAT.P.TYPE
|
||
eor #6
|
||
bne .99
|
||
|
||
>PUSHWI 0 Aux type
|
||
>PUSHBI 6 S.FILEINFO.TYPE.BIN
|
||
>PUSHBI SYS.FOpen.R
|
||
ldy #hFileName
|
||
lda (pData),y
|
||
|
||
>SYSCALL GetMemPtrA
|
||
|
||
>PUSHYA
|
||
>SYSCALL LoadFile
|
||
bcs .99
|
||
txa
|
||
|
||
ldy #hFileBuf
|
||
sta (pData),y
|
||
rts
|
||
|
||
.99 >LDYAI 16
|
||
>SYSCALL GetMem0YA
|
||
|
||
>STYA ZPTmp1
|
||
|
||
txa
|
||
ldy #hFileBuf
|
||
sta (pData),y
|
||
|
||
lda #6
|
||
sta (ZPTmp1)
|
||
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN.Save ldy #hFileBuf
|
||
lda (pData),y
|
||
>SYSCALL GetMemPtrA
|
||
>PUSHYA ptr
|
||
|
||
>PUSHWI 16 LEN
|
||
|
||
>PUSHWI 0 AUXTYPE
|
||
>PUSHBI 6 S.FILEINFO.TYPE.BIN
|
||
>PUSHBI SYS.FOpen.W+SYS.FOpen.X
|
||
|
||
ldy #hFileName
|
||
lda (pData),y
|
||
|
||
>SYSCALL GetMemPtrA
|
||
|
||
>PUSHYA
|
||
|
||
>SYSCALL SaveFile
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN.DumpConfYA
|
||
>STYA ZPTmp1
|
||
|
||
>PUSHB (ZPTmp1)
|
||
|
||
>LDYA L.MSG.HZ
|
||
>SYSCALL PPrintFYA
|
||
|
||
ldy #8
|
||
lda (ZPTmp1),y
|
||
bne .10
|
||
>PUSHW L.MSG.DISABLED
|
||
bra .12
|
||
.10 >PUSHW L.MSG.ENABLED
|
||
|
||
.12 >LDYA L.MSG.CHROOT
|
||
>SYSCALL PPrintFYA
|
||
|
||
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 PPrintFYA
|
||
|
||
ply
|
||
iny
|
||
cpy #16
|
||
bne .1
|
||
|
||
>LDYA L.MSG.PROMPT
|
||
>SYSCALL PPrintFYA
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.DOEVENT sec do not discard TIMER event
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT ldy #hFileBuf
|
||
lda (pData),y
|
||
beq .1
|
||
>SYSCALL FreeMemA
|
||
|
||
.1 ldy #hFileName
|
||
lda (pData),y
|
||
beq .8
|
||
>SYSCALL FreeMemA
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
SLOTS .DA #0
|
||
.DA #A2osX.SLOTS.Z80
|
||
.DA #A2osX.SLOTS.VSDRIVE
|
||
.DA #A2osX.SLOTS.ATCARD
|
||
.DA #A2osX.SLOTS.DII
|
||
.DA #A2osX.SLOTS.BLK
|
||
.DA #A2osX.SLOTS.SP
|
||
.DA #A2osX.SLOTS.COM
|
||
.DA #A2osX.SLOTS.XY
|
||
.DA #A2osX.SLOTS.NET
|
||
.DA #A2osX.SLOTS.DISABLE
|
||
SLOTS.MAX .EQ *-SLOTS
|
||
*--------------------------------------
|
||
FILENAME >PSTR "${A2OSX}A2osX.KCONFIG"
|
||
MSG.TOPBAR >PSTR "\ec\e[7m\e[1;1HA2osX Kernel Config Utility : "
|
||
MSG.TOPBAR.OK >PSTR "KCONFIG File Successfully Loaded. \e[0m"
|
||
MSG.TOPBAR.KO >PSTR "Invalid/missing KCONFIG File. \e[0m"
|
||
MSG.STATUSBAR >PSTR "\e[7m\e[24;1HCtrl-Q:Quit,Ctrl-S:Save,Ctrl-T:Toggle Time,Ctrl-C:Toggle CHRoot,1-7:En/Dis Slot \e[0m"
|
||
MSG.KCONF >PSTR "\e[2;1H------ Actual Kernel Configuration ------\r\n"
|
||
MSG.FCONF >PSTR "\e[13;1H------ KCONFIG File Configuration ------\r\n"
|
||
MSG.HZ >PSTR " Machine Timing : %d0 Hz\r\n"
|
||
MSG.CHROOT >PSTR " CHRoot to /RAMx : %S\r\n"
|
||
MSG.ENABLED >PSTR "Enabled "
|
||
MSG.DISABLED >PSTR "Disabled"
|
||
MSG.SLOT >PSTR " Slot #%d : %S\r\n"
|
||
MSG.SLOT.NODEV >PSTR "<ENABLED> "
|
||
MSG.SLOT.Z80 >PSTR "Z80 CPU Board"
|
||
MSG.SLOT.VSD >PSTR "SSC Shared Driver for VSDRIVE"
|
||
MSG.SLOT.ATK >PSTR "AppleTalk Board"
|
||
MSG.SLOT.DII >PSTR "Disk II Controller"
|
||
MSG.SLOT.BLK >PSTR "Generic Block/SCSI Controller"
|
||
MSG.SLOT.PRT >PSTR "SmartPort Controller"
|
||
MSG.SLOT.COM >PSTR "Communication Card"
|
||
MSG.SLOT.XY >PSTR "XY Pointing Device"
|
||
MSG.SLOT.NET >PSTR "Network Interface Card"
|
||
MSG.SLOT.DIS >PSTR "<DISABLED>"
|
||
MSG.PROMPT >PSTR "\e[24;80H"
|
||
MSG.QUIT >PSTR "\ec"
|
||
MSG.QUIT.ERR >PSTR "\ecError [$%h] While Writing KCONFIG File.\r\n\r\n"
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR 0
|
||
DS.START
|
||
hFileName .BS 1
|
||
hFileBuf .BS 1
|
||
DS.END .ED
|
||
MAN
|
||
SAVE /A2OSX.SRC/SBIN/KCONFIG.S
|
||
ASM
|