Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-06-18 17:48:00 +02:00
parent dc592f1bd3
commit c179b37d98
11 changed files with 221 additions and 150 deletions

View File

@ -163,18 +163,22 @@ Load a file in memory
# FAdd,FSub,FMult,FDiv,FPwr
Return X+Y, X-Y, X*Y, X/Y, X^Y
##ASM
## ASM
**In:**
`>PUSHF X (float)`
`>PUSHF Y (float)`
`>SYSCALL fadd
`>SYSCALL fadd`
`>SYSCALL fsub`
`>SYSCALL fmult`
`>SYSCALL fdiv`
`>SYSCALL fpwr`
**Out:**
On stack (float)
# Log,Sqr,Exp,Cos,Sin,Tan,ATan
Return Log(x), Sqr(x), E^X, Cos(x), Sin(X), Tan(x), ATan(x)
##C
## C
`float log ( float x);`
`float sqr ( float x);`
`float exp ( float x);`
@ -183,24 +187,35 @@ Return Log(x), Sqr(x), E^X, Cos(x), Sin(X), Tan(x), ATan(x)
`float tan ( float x);`
`float atan ( float x);`
##ASM
## ASM
**In:**
`>PUSHF x (Float)`
`>SYSCALL log`
**Out:**
On stack (Float)
# Float
# float
Return 'floated' long
**In:**
PUSHL = X (long)
**Out:**
On stack (Float)
# LRIntF
Return Float rounded into a long
## C
`float f = (float)12345678;
## ASM
**In:**
PUSHF = X (Float)
`>PUSHL X` (long)
**Out:**
On stack (float)
# lrintf
Return float rounded into a long
## C
`long int lrintf (float x);`
## ASM
**In:**
`>PUSHF x`
`>SYSCALL lrintf`
**Out:**
On stack (long)
@ -637,7 +652,7 @@ Rename a file
PUSHW = Old Name
**Out:**
# StrToF
# strtof
Convert String to 40 bits Float
##C
@ -660,6 +675,7 @@ Convert String to 40 bits Float
## ASM
**In:**
`>LDYA str`
`>SYSCALL atof`
**Out:**
On stack (float)
@ -674,12 +690,13 @@ Convert String to 32 bits (unsigned) int
**In:**
`>PUSHB Base`
`>PUSHWI EndPtr`
`>LDYA str`
`>LDYAI str`
`>SYSCALL strtol`
**Out:**
On stack (long)
# AToL
Convert String to 32 bits int
# atol
Convert String to 32 bits long
## C
`long atol ( const char * str );`
@ -687,29 +704,38 @@ Convert String to 32 bits int
## ASM
**In:**
`>LDYA str`
`>SYSCALL atol`
**Out:**
On stack (long)
# AToI.YA
# atoi
Convert String to 16 bits int
## C
`int atoi ( const char * str );`
## ASM
**In:**
`>LDYA str`
`>LDYAI str`
`>SYSCALL atoi`
**Out:**
Y,A = Int
Y,A = int
# RealPath.YA
# realpath
Return the canonicalized absolute pathname
## C
`unsigned short int realpath (const char* str);`
## ASM
**In:**
Y,A = Ptr to Relative Filename (C-String)
`>LDYA str`
`>SYSCALL realpath`
**Out:**
CC : success
Y,A = Ptr to Full Path (C-String)
X = hMem of Full Path
CS : A = Error Code
CC : success
Y,A = Ptr to Full Path (C-String)
X = hMem of Full Path
CS : A = Error Code
# StrLen
Returns Length of C-String

View File

@ -1,12 +1,17 @@
*** Auto generated by docgen.cmd ***
# Pak
**In:**
##ASM
PUSHW = Src PTR
PUSHW = Src Length
PUSHW = Dst PTR Output Buffer
PUSHW = Dst PTR S.PAKSTAT
#UnPak
##ASM
**In:**
PUSHW = Src PTR
PUSHW = Src Length
PUSHW = Dst PTR Output Buffer
PUSHW = Dst PTR S.PAKSTAT
UnPak
In :
PUSHW = Src PTR Compressed Buffer
PUSHW = Dst PTR
PUSHW = Src PTR Compressed Buffer
PUSHW = Dst PTR

View File

@ -1,5 +1,5 @@
@echo off
title Kernel DOC generator
title A2osX DOC generator
COLOR 2A
prompt ]
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
@ -9,7 +9,7 @@ for /f %%a in ('copy /Z "%~f0" nul') do set "CR=%%a"
mode con:cols=80 lines=24
cls
echo Apple //e
echo Apple //e
set /a c=0
@ -20,11 +20,6 @@ set SRCDIR=%~dp0..\SYS
set FILTER=KERNEL.S*.txt
Call :SCAN
set DOCFILE=%~dp0..\.Docs\LIBTCPIP.md
set SRCDIR=%~dp0..\LIB
set FILTER=LIBTCPIP.S*.txt
Call :SCAN
set DOCFILE=%~dp0..\.Docs\LIBBLKDEV.md
set SRCDIR=%~dp0..\LIB
set FILTER=LIBBLKDEV.S*.txt
@ -35,6 +30,21 @@ set SRCDIR=%~dp0..\LIB
set FILTER=LIBCRYPT.S*.txt
Call :SCAN
set DOCFILE=%~dp0..\.Docs\LIBGUI.md
set SRCDIR=%~dp0..\LIB
set FILTER=LIBGUI.S*.txt
Call :SCAN
set DOCFILE=%~dp0..\.Docs\LIBPAK.md
set SRCDIR=%~dp0..\LIB
set FILTER=LIBPAK.S*.txt
Call :SCAN
set DOCFILE=%~dp0..\.Docs\LIBTCPIP.md
set SRCDIR=%~dp0..\LIB
set FILTER=LIBTCPIP.S*.txt
Call :SCAN
echo.
echo All done : !c! Files scanned.
echo.
@ -49,7 +59,6 @@ exit 0
echo.
echo Scanning %FILTER% Files...
echo.
for /f %%F in ('dir /b /ogn "%SRCDIR%\%FILTER%"') do (
set FN=%%F

View File

@ -279,54 +279,54 @@ S.MSTAT .EQ 24
*--------------------------------------
* S.NODE
*--------------------------------------
S.NODE.HANDLER .EQ 0 0=KRNL,!0=hLIB (LIBNFS,LIBTCPIP.....)
S.NODE.T .EQ 1
S.NODE.T.REG .EQ 0
S.NODE.T.DIR .EQ 1
S.NODE.T.CDEV .EQ 2
S.NODE.T.BDEV .EQ 3
S.NODE.T.LNK .EQ 4
S.NODE.T.DSOCK .EQ 5
S.NODE.T.SSOCK .EQ 6
S.NODE.T.FIFO .EQ 7
S.NODE.HANDLER .EQ 0 0=KRNL,!0=hLIB (LIBNFS,LIBTCPIP.....)
S.NODE.T .EQ 1
S.NODE.T.REG .EQ 0
S.NODE.T.DIR .EQ 1
S.NODE.T.CDEV .EQ 2
S.NODE.T.BDEV .EQ 3
S.NODE.T.LNK .EQ 4
S.NODE.T.DSOCK .EQ 5
S.NODE.T.SSOCK .EQ 6
S.NODE.T.FIFO .EQ 7
*--------------------------------------
S.NODE.REG.REF .EQ 2
S.NODE.REG.IOBUF .EQ 3
S.NODE.REG.REF .EQ 2
S.NODE.REG.IOBUF .EQ 3
*
S.NODE.REG .EQ 4
S.NODE.REG .EQ 4
*--------------------------------------
S.NODE.DIR.REF .EQ 2
S.NODE.DIR.IOBUF .EQ 3
S.NODE.DIR.EL .EQ 4
S.NODE.DIR.EPB .EQ 5
S.NODE.DIR.FC .EQ 6 word
S.NODE.DIR.REF .EQ 2
S.NODE.DIR.IOBUF .EQ 3
S.NODE.DIR.EL .EQ 4
S.NODE.DIR.EPB .EQ 5
S.NODE.DIR.FC .EQ 6 word
*
S.NODE.DIR .EQ 8
S.NODE.DIR .EQ 8
*--------------------------------------
S.NODE.DEV.ID .EQ 2
S.NODE.DEV.JMP .EQ 3 word
*
S.NODE.DEV .EQ 5
S.NODE.DEV .EQ 5
*--------------------------------------
* S.NODE.LNK
*--------------------------------------
S.NODE.SSOCK.HSKT .EQ 2
S.NODE.SSOCK.OPEN .EQ 3
S.NODE.SSOCK.CLOSE .EQ 4
S.NODE.SSOCK.READ .EQ 5
S.NODE.SSOCK.WRITE .EQ 6
S.NODE.SSOCK.STATUS .EQ 7
S.NODE.SSOCK.HSKT .EQ 2
S.NODE.SSOCK.OPEN .EQ 3
S.NODE.SSOCK.CLOSE .EQ 4
S.NODE.SSOCK.READ .EQ 5
S.NODE.SSOCK.WRITE .EQ 6
S.NODE.SSOCK.STATUS .EQ 7
*
S.NODE.SSOCK .EQ 8
S.NODE.SSOCK .EQ 8
*--------------------------------------
S.NODE.FIFO.S .EQ 2
S.NODE.FIFO.S.Opened .EQ 1
S.NODE.FIFO.S.Closed .EQ 2
S.NODE.FIFO.hMem .EQ 3
S.NODE.FIFO.Tail .EQ 4
S.NODE.FIFO.Head .EQ 5
S.NODE.FIFO.S .EQ 2
S.NODE.FIFO.S.Opened .EQ 1
S.NODE.FIFO.S.Closed .EQ 2
S.NODE.FIFO.hMem .EQ 3
S.NODE.FIFO.Tail .EQ 4
S.NODE.FIFO.Head .EQ 5
*
S.NODE.FIFO .EQ 6
S.NODE.FIFO .EQ 6
*--------------------------------------
* DEVMGR (new API) = Smartport
*--------------------------------------
@ -335,24 +335,24 @@ S.NODE.FIFO .EQ 6
* BLK : ROM Entry point Cn($Cnff)
* PRT : ROM Entry point Cn($Cnff)+3
*--------------------------------------
S.DEV.DRV.JMP .EQ 2
S.DEV.S .EQ 4
S.DEV.S.BLOCK .EQ %10000000
S.DEV.S.WRITE .EQ %01000000
S.DEV.S.READ .EQ %00100000
S.DEV.S.ONLINE .EQ %00010000
S.DEV.S.NOFMT .EQ %00001000
S.DEV.S.WENABL .EQ %00000100
S.DEV.S.IRQ .EQ %00000010
S.DEV.S.OPENED .EQ %00000001
S.DEV.F .EQ 5
S.DEV.BUSID .EQ 6
S.DEV.DEVID .EQ 7
S.DEV.ROM.JMP .EQ 8 word
S.DEV.DRV.JMP .EQ 2
S.DEV.S .EQ 4
S.DEV.S.BLOCK .EQ %10000000
S.DEV.S.WRITE .EQ %01000000
S.DEV.S.READ .EQ %00100000
S.DEV.S.ONLINE .EQ %00010000
S.DEV.S.NOFMT .EQ %00001000
S.DEV.S.WENABL .EQ %00000100
S.DEV.S.IRQ .EQ %00000010
S.DEV.S.OPENED .EQ %00000001
S.DEV.F .EQ 5
S.DEV.BUSID .EQ 6
S.DEV.DEVID .EQ 7
S.DEV.ROM.JMP .EQ 8 word
*
S.DEV.NAME .EQ 11 4+\0 MAX
S.DEV.NAME .EQ 11 4+\0 MAX
*
S.DEV .EQ 16
S.DEV .EQ 16
*--------------------------------------
IOCTL.STATUS .EQ 0
IOCTL.READBLOCK .EQ 2

View File

@ -42,11 +42,12 @@ LIB.UNLOAD clc
rts
*/--------------------------------------
* # Pak
* **In:**
* PUSHW = Src PTR
* PUSHW = Src Length
* PUSHW = Dst PTR Output Buffer
* PUSHW = Dst PTR S.PAKSTAT
* **In:**
* ##ASM
* PUSHW = Src PTR
* PUSHW = Src Length
* PUSHW = Dst PTR Output Buffer
* PUSHW = Dst PTR S.PAKSTAT
*\--------------------------------------
* PASS #1 : BL+REP dryrun with raw BYTE store (no bit prefix) -> Dst
* if BL stat=0, disable BL in PASS #2
@ -495,11 +496,12 @@ Pak.UpdateStats inc Pak.Stat,x
inc Pak.Stat+1,x
.8 rts
*/--------------------------------------
* UnPak
* In :
* PUSHW = Src PTR Compressed Buffer
* PUSHW = Dst PTR
*/--------------------------------------
* #UnPak
* ##ASM
* **In:**
* PUSHW = Src PTR Compressed Buffer
* PUSHW = Dst PTR
*\--------------------------------------
UnZPSrcPtr .EQ ZPLIB
UnZPDstPtr .EQ ZPLIB+2
UnPak.ShrtTbl .EQ ZPLIB+4

View File

@ -540,6 +540,6 @@ DevMgr.SYS.BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0
DevMgr.SYS.BASEH .HS 04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.D01
SAVE /A2OSX.SRC/SYS/KERNEL.S.DRV
LOAD /A2OSX.SRC/SYS/KERNEL.S
ASM

View File

@ -4,11 +4,17 @@ AUTO 4,1
*/--------------------------------------
* # FAdd,FSub,FMult,FDiv,FPwr
* Return X+Y, X-Y, X*Y, X/Y, X^Y
* ## ASM
* **In:**
* PUSHF = X (Float)
* PUSHF = Y (Float)
* `>PUSHF X (float)`
* `>PUSHF Y (float)`
* `>SYSCALL fadd`
* `>SYSCALL fsub`
* `>SYSCALL fmult`
* `>SYSCALL fdiv`
* `>SYSCALL fpwr`
* **Out:**
* On stack (Float)
* On stack (float)
*\--------------------------------------
K.FAdd ldx #ROM.FADD
.HS 2C BIT ABS
@ -29,8 +35,18 @@ K.FPwr ldx #ROM.PWR
*/--------------------------------------
* # Log,Sqr,Exp,Cos,Sin,Tan,ATan
* Return Log(x), Sqr(x), E^X, Cos(x), Sin(X), Tan(x), ATan(x)
* ## C
* `float log ( float x);`
* `float sqr ( float x);`
* `float exp ( float x);`
* `float cos ( float x);`
* `float sin ( float x);`
* `float tan ( float x);`
* `float atan ( float x);`
* ## ASM
* **In:**
* PUSHF = X (Float)
* `>PUSHF x (Float)`
* `>SYSCALL log`
* **Out:**
* On stack (Float)
*\--------------------------------------
@ -54,12 +70,15 @@ K.ATan ldx #ROM.ATAN
plx
bra MATH.Go
*/--------------------------------------
* # Float
* # float
* Return 'floated' long
* ## C
* `float f = (float)12345678;
* ## ASM
* **In:**
* PUSHL = X (long)
* `>PUSHL X` (long)
* **Out:**
* On stack (Float)
* On stack (float)
*\--------------------------------------
K.Float >PULLW FAC+1
>PULLW FAC+3
@ -86,14 +105,18 @@ MATH.Go jsr GP.ROMCALL
clc
rts
*/--------------------------------------
* # LRIntF
* Return Float rounded into a long
* # lrintf
* Return float rounded into a long
* ## C
* `long int lrintf (float x);`
* ## ASM
* **In:**
* PUSHF = X (Float)
* `>PUSHF x`
* `>SYSCALL lrintf`
* **Out:**
* On stack (long)
*\--------------------------------------
K.LRIntF jsr MATH.PullFAC
K.lrintf jsr MATH.PullFAC
ldx #ROM.QINT
jsr GP.ROMCALL

View File

@ -10,13 +10,6 @@ ZPSListIBlkPtr .EQ ZPMEMMGR+8
ZPSListDBlkPtr .EQ ZPMEMMGR+10
ZPSListKeyPtr .EQ ZPMEMMGR+12
ZPSListDataPtr .EQ ZPMEMMGR+14
*--------------------------------------
* TODO :
* - Create a 256 bytes table
* mapping hMem's to real memory blocks to help
* Garbage collector move blocks
* - mem.ID=0 always used! useful to test if hMem=0
*--------------------------------------
*/--------------------------------------
* # GetMem0
* **In:**

View File

@ -874,16 +874,19 @@ K.SScanF.GetVAL tya Y=char count parsed
*/--------------------------------------
* # FOpen
* Open a file
* ## C
* `hFILE fopen ( const char * filename, short int mode, short int ftype, int auxtype );`
* **In:**
* PUSHW = AUXTYPE
* PUSHB = TYPE
* PUSHB = MODE
* SYS.FOpen.R : if R and !exists -> ERROR
* SYS.FOpen.W : if W and !exists -> CREATE
* SYS.FOpen.A : Append
* SYS.FOpen.T : Open/Append in Text mode
* SYS.FOpen.X : Create if not exists
* PUSHW = PATH (PSTR)
* ## ASM
* `>PUSHWI auxtype`
* `>PUSHBI ftype`
* `>PUSHBI mode`
* + SYS.FOpen.R : if R and !exists -> ERROR
* + SYS.FOpen.W : if W and !exists -> CREATE
* + SYS.FOpen.A : Append
* + SYS.FOpen.T : Open/Append in Text mode
* + SYS.FOpen.X : Create if not exists
* `>LDYAI filename`
* **Out:**
* CC : A = hFILE
* CS : A = EC

View File

@ -2,18 +2,19 @@ NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
*/--------------------------------------
* # StrToF
* # strtof
* Convert String to 40 bits Float
* ## C
* ##C
* `float strtof (const char* str, char** endptr);`
* ## ASM
* ##ASM
* **In:**
* `>PUSHWI EndPtr`
* `>LDYA str`
* `>SYSCALL strtof`
* **Out:**
* On stack (float)
*\--------------------------------------
K.StrToF >STYA TXTPTR Ptr to source string
K.strtof >STYA TXTPTR Ptr to source string
>PULLW ZPPtr1
jsr K.AToF.I
@ -32,6 +33,7 @@ K.StrToF >STYA TXTPTR Ptr to source string
* ## ASM
* **In:**
* `>LDYA str`
* `>SYSCALL atof`
* **Out:**
* On stack (float)
*\--------------------------------------
@ -66,7 +68,8 @@ K.AToF.I jsr CHARGOT
* **In:**
* `>PUSHB Base`
* `>PUSHWI EndPtr`
* `>LDYA str`
* `>LDYAI str`
* `>SYSCALL strtol`
* **Out:**
* On stack (long)
*\--------------------------------------
@ -90,13 +93,14 @@ K.StrToUL.Exit adc ZPPtr2
K.StrToUL.rts rts
*/--------------------------------------
* # AToL
* Convert String to 32 bits int
* # atol
* Convert String to 32 bits long
* ## C
* `long atol ( const char * str );`
* ## ASM
* **In:**
* `>LDYA str`
* `>SYSCALL atol`
* **Out:**
* On stack (long)
*\--------------------------------------
@ -124,16 +128,18 @@ K.AToL.I jsr STDLIB.GetDec
.9 rts
*/--------------------------------------
* # AToI.YA
* # atoi
* Convert String to 16 bits int
* ## C
* `int atoi ( const char * str );`
* ## ASM
* **In:**
* `>LDYA str`
* `>LDYAI str`
* `>SYSCALL atoi`
* **Out:**
* Y,A = Int
* Y,A = int
*\--------------------------------------
K.AToI.YA >STYA ZPPtr2
K.atoi >STYA ZPPtr2
lda #10 base 10
sec signed
@ -272,17 +278,21 @@ STDLIB.32.Clear ldx #3
bpl .1
rts
*/--------------------------------------
* # RealPath.YA
* # realpath
* Return the canonicalized absolute pathname
* ## C
* `unsigned short int realpath (const char* str);`
* ## ASM
* **In:**
* Y,A = Ptr to Relative Filename (C-String)
* `>LDYA str`
* `>SYSCALL realpath`
* **Out:**
* CC : success
* Y,A = Ptr to Full Path (C-String)
* X = hMem of Full Path
* CS : A = Error Code
* CC : success
* Y,A = Ptr to Full Path (C-String)
* X = hMem of Full Path
* CS : A = Error Code
*\--------------------------------------
K.RealPath.YA >STYA ZPPtr1
K.realpath >STYA ZPPtr1
ldx #$ff
lda (ZPPtr1)

View File

@ -19,7 +19,8 @@ AUTO 4,1
.INB /A2OSX.SRC/X.PRINTF.S
A2osX.MAIN .PH $1100
.INB /A2OSX.SRC/SYS/KERNEL.S.CORE
.INB /A2OSX.SRC/SYS/KERNEL.S.D01
.INB /A2OSX.SRC/SYS/KERNEL.S.IO
.INB /A2OSX.SRC/SYS/KERNEL.S.DRV
.EP
A2osX.AUX .PH $0C00
.INB /A2OSX.SRC/SYS/KERNEL.S.OSD
@ -36,6 +37,7 @@ A2osX.D1 .PH $D000
.INB /A2OSX.SRC/SYS/KERNEL.S.STDLIB
.INB /A2OSX.SRC/SYS/KERNEL.S.PFT
.INB /A2OSX.SRC/SYS/KERNEL.S.DEV
.INB /A2OSX.SRC/SYS/KERNEL.S.FIO
.EP
A2osX.D2 .PH $D000
.DA #RRAMWRAMBNK2
@ -51,8 +53,6 @@ A2osX.E0 .PH $E000
.INB /A2OSX.SRC/SYS/KERNEL.S.JMP
.INB /A2OSX.SRC/SYS/KERNEL.S.IRQ
.INB /A2OSX.SRC/SYS/KERNEL.S.MEM
********* TMP ***** go to A2osX.D1
.INB /A2OSX.SRC/SYS/KERNEL.S.FIO
DevMgr.FreeMem .EQ *
.EP
A2osX.E0.E .EQ *