Kernel 0.9.1 : KERNEL API reorg, LoadFile/SaveFile

This commit is contained in:
Rémy GIBERT 2017-10-19 08:19:54 +02:00
parent f29ad437fa
commit cbe2cfcd46
13 changed files with 126 additions and 68 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
PR#3
PREFIX /A2OSX.BUILD
LOMEM $900
LOMEM $A00
INC 1
AUTO 6
.LIST OFF
@ -161,10 +161,10 @@ SYS.UnloadLib.A .EQ $9A
SYS.LoadDrv.YA .EQ $9C
SYS.FileSearch .EQ $9E
SYS.ExecProcessNewEnvYA .EQ $A0
SYS.ExecProcessYA .EQ $A2
SYS.CreateProcessNewEnvYA .EQ $A4
SYS.CreateProcessYA .EQ $A6
SYS.ExecPSNewEnv.YA .EQ $A0
SYS.ExecPS.YA .EQ $A2
SYS.CreatePSNewEnv.YA .EQ $A4
SYS.CreatePS.YA .EQ $A6
* .EQ $A8
* .EQ $AA
SYS.GetPSStatus.A .EQ $AC

View File

@ -70,7 +70,7 @@ K.S.STAT .EQ $0300 S.STAT for internal kernel operations
K.S.DEVSTAT .EQ $0340 S.DEVSTAT=25 or higher depends on dev type
K.SP.PARAMS .EQ $0380 Max 9 bytes
K.MLI.PARAMS .EQ $0390 Main, 18 bytes min for GetFileInfo (ATLK needs MORE!!!...32 max for now)
K.MLI.PATH .EQ $03B0 64+1 -> $03D0
K.MLI.PATH .EQ $03B0 64+1 -> $03F0
*--------------------------------------
*** $3F0-$3FF IRQ Handler.... ***
*--------------------------------------

View File

@ -135,7 +135,7 @@ CS.RUN.LOOP
ldy #hBinName
lda (pData),y
>SYSCALL GetMemPtr.A
>SYSCALL ExecProcessNewEnvYA
>SYSCALL ExecPS.YA
.9 rts
.8 clc

View File

@ -40,6 +40,7 @@ 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
@ -230,26 +231,42 @@ CS.RUN.Load >PUSHEA.G StatBuf
sec
rts
*--------------------------------------
CS.RUN.Save ldy #hFileBuf
lda (pData),y
>SYSCALL GetMemPtr.A
>PUSHYA ptr
>PUSHWI 16 LEN
>PUSHWI 0 AUXTYPE
CS.RUN.Save >PUSHWI 0 AUXTYPE
>PUSHBI 6 S.FILEINFO.TYPE.BIN
>PUSHBI SYS.FOpen.W+SYS.FOpen.X
ldy #hFileName
lda (pData),y
>LDA.G hFileName
>SYSCALL GetMemPtr.A
>PUSHYA
>SYSCALL SaveFile
>SYSCALL FOpen
bcs .9
pha save hFile
>LDA.G hFileBuf
>SYSCALL GetMemPtr.A
>PUSHYA ptr
>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
@ -343,15 +360,16 @@ 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:Toggle Time,Ctrl-C:Toggle CHRoot,1-7:En/Dis Slot \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.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"
@ -361,7 +379,7 @@ 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.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"

View File

@ -90,7 +90,7 @@ CS.RUN lda #0
bcs .9
stx .3+1
>SYSCALL ExecProcessNewEnvYA
>SYSCALL ExecPS.YA
php
pha

View File

@ -229,10 +229,10 @@ Cmd.Exec.EXT.BIN
>LDYA ZPCMDBuf
bcs .2 startproc
>SYSCALL ExecProcessNewEnvYA
>SYSCALL ExecPSNewEnv.YA
jmp Cmd.Exec.Done
.2 >SYSCALL CreateProcessNewEnvYA
.2 >SYSCALL CreatePSNewEnv.YA
jmp Cmd.Exec.Done
*--------------------------------------
Cmd.Exec.EXT.Search

View File

@ -4,7 +4,26 @@ LOMEM $A00
INC 1
AUTO 6
*/--------------------------------------
* # LoadTxtFile.YA
* Load TXT a file in memory (with ending 0)
* ## In:
* Y,A = File Path
* ## Out:
* Y,A = File Length (without ending 0)
* X = hMem of Loaded File
*\--------------------------------------
K.LoadTxtFile.YA
pha
>PUSHWI 0 Aux type
>PUSHBI 4 S.FILEINFO.TYPE.TXT
>PUSHBI SYS.FOpen.R
pla
>PUSHYA
sec
.HS 90 BCC
*/--------------------------------------
* # LoadFile
* Load a file in memory
* ## In:
* PUSHW = AUXTYPE (Handled by....
* PUSHB = TYPE ...
@ -14,15 +33,28 @@ AUTO 6
* Y,A = File Length
* X = hMem of Loaded File
*\--------------------------------------
K.LoadFile jsr K.FOpen
K.LoadFile clc
ror K.LoadFile.bTXT
jsr K.FOpen
bcs .9
sta K.LoadFile.hFile
jsr K.LoadFile.GetLen
jsr K.LoadFile.GetSize
bcs .99
>LDYA K.LoadFile.FSize
jsr K.GetMem.YA
bit K.LoadFile.bTXT Add 1 to buffer size for ending 0
bpl .1
iny
bne .1
inc
bne .1
lda #SYSMGR.ERRFTB
bra .99
.1 jsr K.GetMem.YA
bcs .99
>STYA K.LoadFile.Mem
stx .8+1
@ -31,20 +63,33 @@ K.LoadFile jsr K.FOpen
>PUSHW K.LoadFile.FSize
>PUSHB K.LoadFile.hFile
jsr K.FRead
bcs .97
bcs .98
phy
pha Save Bytes read
sty .6+1
sta .7+1 Save Bytes read
jsr .99
jsr .99 close file
pla
ply
bit K.LoadFile.bTXT
bpl .6
clc set ending 0
lda .6+1
adc K.LoadFile.Mem
sta .5+1
lda .7+1
adc K.LoadFile.Mem+1
sta .5+2
.5 stz $ffff Self Modified
.6 ldy #$ff Self Modified
.7 lda #$ff Self Modified
.8 ldx #$ff Self Modified
clc
.9 rts
.97 pha
.98 pha
lda .8+1
jsr K.FreeMem.A
pla
@ -56,7 +101,7 @@ K.LoadFile jsr K.FOpen
sec
rts
*--------------------------------------
K.LoadFile.GetLen
K.LoadFile.GetSize
stz K.LoadFile.FPos
stz K.LoadFile.FPos+1
stz K.LoadFile.FPos+2
@ -91,6 +136,7 @@ K.LoadFile.GetLen
.98 lda #SYSMGR.ERRFTB
.99 rts
*--------------------------------------
K.LoadFile.bTXT .BS 1
K.LoadFile.hFile .BS 1
K.LoadFile.FPos .BS 4
K.LoadFile.Mem .BS 2

View File

@ -237,9 +237,6 @@ IrqHandler cld
*--------------------------------------
*BrkHandler bra *
*--------------------------------------
.LIST ON
A2osX.GP.S .EQ *-A2osX.SYSCALL
.LIST OFF
.BS $BEE0-*
*--------------------------------------
.DA #6 60hz

View File

@ -149,7 +149,7 @@ Kernel.Init3 sta SETALTZP
>SYSCALL ExpandStr.YA
phx Save Expanded CMDLINE for discard
>SYSCALL CreateProcessYA
>SYSCALL CreatePS.YA
bcs .9
pla
@ -479,10 +479,6 @@ DevMgr.SYS cld
* Setup AuxLC $FFFE->Kernel IRQ Handler
* if irq not handled, jmp (S.IrqMgrOldFFFE)
*--------------------------------------
SETMOUSE .EQ $12 Sets mouse mode
SERVEMOUSE .EQ $13 Services mouse interrupt
READMOUSE .EQ $14 Reads mouse position
*--------------------------------------
IrqMgrInit >LDYAI MSG.IRQ
>SYSCALL PrintF.YA
php
@ -597,15 +593,16 @@ IrqMgrInit.Mouse
sta K.IrqMgrVBL.n0
ldy #SERVEMOUSE
ldy #$13 SERVEMOUSE
lda (ZPPtr1),y
sta K.IrqMgrVBL.MSM+1
ldy #READMOUSE
ldy #$14 READMOUSE
lda (ZPPtr1),y
sta K.IrqMgrVBL.MRM+1
ldy #SETMOUSE
ldy #$12 SETMOUSE
lda (ZPPtr1),y
sta .7+1

View File

@ -100,10 +100,10 @@ K.SYSCALL.JMP .DA 0 $00
.DA K.LoadDrv.YA
.DA K.FileSearch
.DA K.ExecProcessNewEnv.YA $A0
.DA K.ExecProcess.YA
.DA K.CreateProcessNewEnv.YA
.DA K.CreateProcess.YA
.DA K.ExecPSNewEnv.YA $A0
.DA K.ExecPS.YA
.DA K.CreatePSNewEnv.YA
.DA K.CreatePS.YA
.DA 0
.DA 0
.DA K.GetPSStatus.A

View File

@ -4,35 +4,35 @@ LOMEM $A00
INC 1
AUTO 6
*/--------------------------------------
* # ExecProcessNewEnv.YA
* # ExecProcess.YA (Blocking Parent PID)
* # CreateProcessNewEnv.YA
* # CreateProcess.YA (Non Blocking)
* # ExecPSNewEnv.YA
* # ExecPS.YA (Blocking Parent PID)
* # CreatePSNewEnv.YA
* # CreatePS.YA (Non Blocking)
* ## In:
* Y,A = PTR To Cmd Line
* ## Out:
* A = Child PSID
*\--------------------------------------
K.ExecProcessNewEnv.YA
K.ExecPSNewEnv.YA
ldx #S.PS.F.DUPENV+S.PS.F.HOLD
.HS 2C bit abs
K.ExecProcess.YA
K.ExecPS.YA
ldx #S.PS.F.HOLD
.HS 2C bit abs
K.CreateProcessNewEnv.YA
K.CreatePSNewEnv.YA
ldx #S.PS.F.DUPENV
.HS 2C bit abs
K.CreateProcess.YA
K.CreatePS.YA
ldx #0
stx K.CreateProcess.Flags
>STYA K.CreateProcess.CmdLine
stx K.CreatePS.Flags
>STYA K.CreatePS.CmdLine
jsr PS.CreateChild Child S.PS at ZPPtr3
bcs .9
sta .8+1
>LDYA K.CreateProcess.CmdLine
>LDYA K.CreatePS.CmdLine
jsr PS.CmdLine2Args Y,A = Args[0]
bcs .9
@ -49,8 +49,8 @@ K.CreateProcess.YA
.8 lda #$ff self modified
.9 rts
*--------------------------------------
K.CreateProcess.Flags .BS 1
K.CreateProcess.CmdLine .BS 2
K.CreatePS.Flags .BS 1
K.CreatePS.CmdLine .BS 2
*--------------------------------------
* PS.CreateChild
* in :
@ -110,7 +110,7 @@ PS.CreateChild ldx #0
sta (ZPPtr3),y
lda #S.PS.F.DUPENV
bit K.CreateProcess.Flags need to create ENV & Prefix ?
bit K.CreatePS.Flags need to create ENV & Prefix ?
beq .6 no...
sta (ZPPtr3) Mark this PS with DUPENV flag
@ -159,11 +159,11 @@ PS.CreateChild ldx #0
sta (ZPPtr3),y
lda #S.PS.F.HOLD
bit K.CreateProcess.Flags
bit K.CreatePS.Flags
beq .82
ora (pPs)
sta (pPs) HOLD parent PS if ExecProcess
sta (pPs) HOLD parent PS if ExecPS
.82 lda #S.PS.F.INIT
ora (ZPPtr3)