Kernel 0.93+

This commit is contained in:
Rémy GIBERT 2019-11-25 08:05:07 +01:00
parent 861f1fbdcd
commit 30a656af0f
7 changed files with 388 additions and 281 deletions

View File

@ -230,42 +230,6 @@ Change The type of a ProDOS File
## RETURN VALUE
# LoadTxtFile
Load TXT a file in memory (with ending 0)
## C
`int loadtxtfile ( const char * filename, short int flags, short int ftype, int auxtype );`
## ASM
**In:**
`>PUSHW auxtype`
`>PUSHB ftype`
`>PUSHB flags`
`>LDYA filename`
`>SYSCALL loadtxtfile`
## RETURN VALUE
Y,A = File Length (without ending 0)
X = hMem of Loaded File
# LoadFile
Load a file in memory
## C
`int loadfile ( const char * filename, short int flags, short int ftype, int auxtype );`
## ASM
**In:**
`>PUSHW auxtype`
`>PUSHB ftype`
`>PUSHB flags`
`>LDYA filename`
`>SYSCALL loadfile`
## RETURN VALUE
Y,A = File Length
X = hMem of Loaded File
# ChOwn
**In:**
PUSHW = mod
@ -276,6 +240,19 @@ Load a file in memory
PUSHW = GID
PUSHW = PATH
# Add32,Sub32,Mul32,IMul32,Div32,IDiv32,Mod32,IMod32,Cmp32,ICmp32
Return X+Y, X-Y, X*Y, X/Y, X mod Y....
## ASM
**In:**
`>PUSHF X (long)`
`>PUSHF Y (long)`
`>FPU add32`
`...`
## RETURN VALUE
On stack (long)
# FAdd,FSub,FMult,FDiv,FPwr
Return X+Y, X-Y, X*Y, X/Y, X^Y
@ -316,11 +293,12 @@ Return Log(x), Sqr(x), E^X, Cos(x), Sin(X), Tan(x), ATan(x)
Return 'floated' long
## C
`float f = (float)12345678;
`float f = (float)l;
## ASM
**In:**
`>PUSHL X` (long)
`>PUSHL l` (long)
`>FPU float`
## RETURN VALUE
On stack (float)
@ -334,68 +312,11 @@ Return float rounded into a long
## ASM
**In:**
`>PUSHF x`
`>SYSCALL lrintf`
`>FPU lrintf`
## RETURN VALUE
On stack (long)
# open
## C
`hFD open(const char *pathname, short int flags);`
## ASM
**In:**
`>PUSHB flags`
`>LDYA pathname`
`>SYSCALL open`
## RETURN VALUE
A = hFD
REG File created on ProDOS : T=TXT,X=$0000
# close
## C
`int close(hFD fd);`
## ASM
**In:**
`lda fd`
`>SYSCALL close`
# read
## C
`int read(hFD fd, void *buf, int count);`
## ASM
**In:**
`>PUSHWI count`
`>PUSHW buf`
`lda fd`
`>SYSCALL read`
## RETURN VALUE
CC: Y,A = bytes read
CS: A = EC
# write
## C
`int write(hFD fd, const void *buf, int count);`
## ASM
**In:**
`>PUSHWI count`
`>PUSHW buf`
`lda fd`
`>SYSCALL write`
## RETURN VALUE
CC: Y,A = bytes written
CS: A = EC
# IOCTL
## C
@ -444,12 +365,165 @@ A = hMem
Y,A = PTR to MemBlock
(X unmodified)
# NewStkObj
Y,A = Size Requested
## RETURN VALUE
CC : success
YA = PTR to Mem (Uninitialised)
* X = hMem
CS :
A = EC
# LoadStkObj
Load a file in AUX memory (Stock Objects)
PUSHW = AUXTYPE (Handled by....
PUSHB = TYPE ...
PUSHB = MODE ...
LDYA = PATH ...FOpen)
## RETURN VALUE
Y,A = File Length
X = hMem of Loaded Object in AUX mem
# GetStkObjPtr
## ASM
`lda hStkObj`
`>SYSCALL GetStkObjPtr`
## RETURN VALUE
# FreeStkObj
A = hMem To Free (AUX Memory)
## RETURN VALUE
none.
(X,Y unmodified)
# ExecL
## C
`int execl(const char* cmdline, short int flags);`
## ASM
`>PUSHB flags`
`>LDYA cmdline`
`>SYSCALL execl`
## RETURN VALUE
A = Child PSID
# ExecV
## C
`int execv(const char* argv[], short int flags);`
## ASM
`>PUSHB flags`
`>LDYA argv`
`>SYSCALL execv`
## RETURN VALUE
A = Child PSID
# Kill
## C
`int kill(short int pid, short int sig);`
## ASM
`>PUSHB sig`
`lda pid`
`>SYSCALL kill`
## RETURN VALUE
A = Child PSID
# LoadTxtFile
Load TXT a file in memory (with ending 0)
## C
`int loadtxtfile ( const char * filename, short int flags, short int ftype, int auxtype );`
## ASM
**In:**
`>PUSHW auxtype`
`>PUSHB ftype`
`>PUSHB flags`
`>LDYA filename`
`>SYSCALL loadtxtfile`
## RETURN VALUE
Y,A = File Length (without ending 0)
X = hMem of Loaded File
# LoadFile
Load a file in memory
## C
`int loadfile ( const char * filename, short int flags, short int ftype, int auxtype );`
## ASM
**In:**
`>PUSHW auxtype`
`>PUSHB ftype`
`>PUSHB flags`
`>LDYA filename`
`>SYSCALL loadfile`
## RETURN VALUE
Y,A = File Length
X = hMem of Loaded File
# GetMemStat
**In:**
Y,A = Ptr to 24 bytes buffer
## RETURN VALUE
Buffer filled with memory stats
# GetPWUID
## C
`int getpwuid(short int uid, S.PW* passwd );`
## ASM
`>PUSHW passwd`
`lda uid`
`>SYSCALL getpwuid`
## RETURN VALUE
# GetPWName
## C
`int getpwname(const char* name, S.PW* passwd );`
## ASM
`>PUSHW passwd`
`>LDYA name`
`>SYSCALL getpwname`
## RETURN VALUE
# PutPW
## C
`int putpw( S.PW* passwd );`
## ASM
`>LDYA passwd`
`>SYSCALL putpw`
## RETURN VALUE
# SListGetData
## ASM
`PUSHW DataOfs`
`PUSHW DataLen`
`PUSHW DataPtr`
`PUSHW DataOfs` (Start offset in Data)
`PUSHW DataLen` (Data bytes to return, 0 if String mode)
`PUSHW DataPtr` (0 if KERNEL should allocate a buffer)
`PUSHW KeyID`
`lda hSList`
`>SYSCALL SListGetData`
@ -529,123 +603,6 @@ A=hSList
## RETURN VALUE
# NewStkObj
Y,A = Size Requested
## RETURN VALUE
CC : success
YA = PTR to Mem (Uninitialised)
* X = hMem
CS :
A = EC
# LoadStkObj
Load a file in AUX memory (Stock Objects)
PUSHW = AUXTYPE (Handled by....
PUSHB = TYPE ...
PUSHB = MODE ...
LDYA = PATH ...FOpen)
## RETURN VALUE
Y,A = File Length
X = hMem of Loaded Object in AUX mem
# GetStkObjPtr
## ASM
`lda hStkObj`
`>SYSCALL GetStkObjPtr`
## RETURN VALUE
# FreeStkObj
A = hMem To Free (AUX Memory)
## RETURN VALUE
none.
(X,Y unmodified)
# ExecL
## C
`int execl(const char* cmdline, short int flags);`
## ASM
`>PUSHB flags`
`>LDYA cmdline`
`>SYSCALL execl`
## RETURN VALUE
A = Child PSID
# ExecV
## C
`int execv(const char* argv[], short int flags);`
## ASM
`>PUSHB flags`
`>LDYA argv`
`>SYSCALL execv`
## RETURN VALUE
A = Child PSID
# Kill
## C
`int kill(short int pid, short int sig);`
## ASM
`>PUSHB sig`
`lda pid`
`>SYSCALL kill`
## RETURN VALUE
A = Child PSID
# GetPWUID
## C
`int getpwuid(short int uid, S.PW* passwd );`
## ASM
`>PUSHW passwd`
`lda uid`
`>SYSCALL getpwuid`
## RETURN VALUE
# GetPWName
## C
`int getpwname(const char* name, S.PW* passwd );`
## ASM
`>PUSHW passwd`
`>LDYA name`
`>SYSCALL getpwname`
## RETURN VALUE
# PutPW
## C
`int putpw( S.PW* passwd );`
## ASM
`>LDYA passwd`
`>SYSCALL putpw`
## RETURN VALUE
# GetMemStat
**In:**
Y,A = Ptr to 24 bytes buffer
## RETURN VALUE
Buffer filled with memory stats
# Stat
Return information about a file
@ -847,7 +804,7 @@ Specifiers :
Modifiers for len and padding :
+ %d : '9' '12'
+ %2d : ' 9' '12'
+ %2d : ' 9' '12'
+ %02d : '09' '12'
+ %11s : 'ABCDEFGH '
+ %011s : 'ABCDEFGH000'
@ -1178,7 +1135,7 @@ Return the canonicalized absolute pathname
## RETURN VALUE
CC : success
Y,A = Ptr to Full Path (C-String)
Y,A = Ptr to Full Path (C-String Buffer, MLI.MAXPATH+1)
X = hMem of Full Path
CS : A = Error Code
@ -1232,7 +1189,7 @@ Y,A = Ptr to source C-String
## RETURN VALUE
CC : success
Y,A = PTR to String
X = hMem (PSTR)
X = hMem (C-String)
CS : error
A = SYS error code
@ -1358,6 +1315,63 @@ Convert S.TIME struct to CSTR
## RETURN VALUE
none. always succeed.
# open
## C
`hFD open(const char *pathname, short int flags);`
## ASM
**In:**
`>PUSHB flags`
`>LDYA pathname`
`>SYSCALL open`
## RETURN VALUE
A = hFD
REG File created on ProDOS : T=TXT,X=$0000
# close
## C
`int close(hFD fd);`
## ASM
**In:**
`lda fd`
`>SYSCALL close`
# read
## C
`int read(hFD fd, void *buf, int count);`
## ASM
**In:**
`>PUSHWI count`
`>PUSHW buf`
`lda fd`
`>SYSCALL read`
## RETURN VALUE
CC: Y,A = bytes read
CS: A = EC
# write
## C
`int write(hFD fd, const void *buf, int count);`
## ASM
**In:**
`>PUSHWI count`
`>PUSHW buf`
`lda fd`
`>SYSCALL write`
## RETURN VALUE
CC: Y,A = bytes written
CS: A = EC
## License
A2osX is licensed under the GNU General Pulic License.

View File

@ -4,20 +4,17 @@
Copyright 2015 - 2019, Remy Gibert and the A2osX contributors.
# Pak
**In:**
##ASM
PUSHW = Src PTR
PUSHW = Src Length
PUSHW = Dst PTR Output Buffer
PUSHW = Dst PTR S.PAKSTAT
`>PUSHW StatPtr`
`>PUSHW DstPtr`
`>PUSHW SrcLen`
`>PUSHW SrcPtr`
`>LIBCALL hLIBPAK,Pak`
#UnPak
##ASM
**In:**
PUSHW = Src PTR Compressed Buffer
PUSHW = Dst PTR
## RETURN VALUE
CC, Y,A = CLEN
CS, Pak failure
## License
A2osX is licensed under the GNU General Pulic License.

Binary file not shown.

View File

@ -87,28 +87,21 @@ DLG.Open >STYA ZPPTR2
bcs .9
ldy #S.DLG.Ctrls
sty TmpByte
.5 lda (ZPPTR1),y
beq .8
tay
lda (ZPPTR1),y Ctrl Type
tax
jsr .6
phy
tya
jsr DLG.CTRL.Draw
ply
bcs .9
inc TmpByte
ldy TmpByte
iny
bra .5
.8 clc
.9 rts
.6 >LDYA.G LineBufBase
>STYA LineBufPtr
jmp (J.DLG.DrawCtrls,x)
*--------------------------------------
DLG.Run >SYSCALL getchar
bcs .9
@ -120,19 +113,49 @@ DLG.Run >SYSCALL getchar
beq .8
cmp #C.TAB
beq DLG.NextFocus
bne DLG.Run
bra DLG.Run
jsr DLG.NextFocus
bcc DLG.Run
rts
.8 clc
.9 rts
.9
DLG.Run.RTS rts
*--------------------------------------
DLG.NextFocus
*--------------------------------------
DLG.SetFocus
DLG.NextFocus ldy #S.DLG.Focus
lda (ZPPTR1),y get actual focused Ctrl
clc
rts
pha save it...
tax
.1 inx next one
.2 txa
tay
lda (ZPPTR1),y Get Ctrl
bne .3 end of list, get first
ldx #S.DLG.Ctrls
bra .2
.3 tay
lda (ZPPTR1),y Get Ctrl Type
beq .1 LBL
txa
ldy #S.DLG.Focus
sta (ZPPTR1),y
pla get old focused
phx save new focused
jsr DLG.CTRL.Draw
pla
bcs DLG.Run.RTS
jmp DLG.CTRL.Draw
*--------------------------------------
DLG.Close ldy #S.DLG.H
lda (ZPPTR1),y
@ -172,8 +195,18 @@ DLG.Close ldy #S.DLG.H
.8 clc
rts
*--------------------------------------
DLG.DrawCtrls.LBL
jsr DLG.DrawCtrls.GotoXY
DLG.CTRL.Draw sta TmpByte A=CtrlID
tay
lda (ZPPTR1),y Ctrl Definition
tay
lda (ZPPTR1),y Ctrl Type
tax
jmp (J.DLG.CTRL.Draw,x)
*--------------------------------------
DLG.CTRL.Draw.LBL
jsr SCRN.LineBufInitNorm
jsr DLG.CTRL.GotoXY
bcs .9
ldy TmpByte CtrlID
@ -194,8 +227,10 @@ DLG.DrawCtrls.LBL
.8 jmp SCRN.LineBufOut
.9 rts
*--------------------------------------
DLG.DrawCtrls.TB
jsr DLG.DrawCtrls.GotoXY
DLG.CTRL.Draw.TB
jsr SCRN.LineBufInitNorm
jsr DLG.CTRL.GotoXY
bcs .9
ldy TmpByte
@ -217,8 +252,17 @@ DLG.DrawCtrls.TB
>SYSCALL getmemptr
>STYA ZPPTR2
lda #"["
jsr SCRN.ToLineBuf
ldy #S.DLG.Focus
lda (ZPPTR1),y
eor TmpByte
bne .10
sec
.10 lda #C.SPACE
bcc .11
lda #'['
.11 jsr SCRN.ToLineBuf
ldy #0
@ -243,7 +287,7 @@ DLG.DrawCtrls.TB
iny
.3 txa
cmp (ZPPTR1),y MAXCHAR
eor (ZPPTR1),y MAXCHAR
beq .8
lda #C.SPACE
@ -251,14 +295,18 @@ DLG.DrawCtrls.TB
inx
bra .3
.8 lda #"]"
jsr SCRN.ToLineBuf
.8 lda #C.SPACE
bcc .81
lda #']'
.81 jsr SCRN.ToLineBuf
jmp SCRN.LineBufOut
.9 rts
*--------------------------------------
DLG.DrawCtrls.OL
jsr DLG.DrawCtrls.GotoXY
DLG.CTRL.Draw.OL
jsr SCRN.LineBufInitNorm
jsr DLG.CTRL.GotoXY
bcs .9
ldy TmpByte
@ -308,13 +356,19 @@ DLG.DrawCtrls.OL
.8 jmp SCRN.LineBufOut
.9 rts
*--------------------------------------
DLG.DrawCtrls.BUT
DLG.CTRL.Draw.BUT
jsr SCRN.LineBufInitInv
jsr DLG.DrawCtrls.GotoXY
jsr DLG.CTRL.GotoXY
bcs .9
ldy TmpByte CtrlID
ldy #S.DLG.Focus
lda (ZPPTR1),y
eor TmpByte
bne .10
sec
.10 ldy TmpByte CtrlID
lda (ZPPTR1),y
tay
@ -323,6 +377,12 @@ DLG.DrawCtrls.BUT
iny
iny
lda #C.SPACE
bcc .11
lda #'['
.11 jsr SCRN.ToLineBuf
.1 lda (ZPPTR1),y
beq .8
@ -331,10 +391,31 @@ DLG.DrawCtrls.BUT
iny
bra .1
.8 jmp SCRN.LineBufOut
.8 lda #C.SPACE
bcc .81
lda #']'
.81 jsr SCRN.ToLineBuf
jmp SCRN.LineBufOut
.9 rts
*--------------------------------------
DLG.DrawCtrls.GotoXY
DLG.CTRL.Focus sta TmpByte A=CtrlID
tay
lda (ZPPTR1),y Ctrl Definition
tay
lda (ZPPTR1),y Ctrl Type
tax
jmp (J.DLG.CTRL.Focus,x)
*--------------------------------------
DLG.CTRL.Focus.LBL
DLG.CTRL.Focus.TB
DLG.CTRL.Focus.OL
DLG.CTRL.Focus.BUT
clc
rts
*--------------------------------------
DLG.CTRL.GotoXY
ldy TmpByte CtrlID
lda (ZPPTR1),y
tay
@ -358,7 +439,7 @@ DLG.DrawCtrls.GotoXY
tay
jmp SCRN.GotoXY
*--------------------------------------
*--------------------------------------
DLG.SetOrigin ldy #S.DLG.X
lda (ZPPTR1),y
bne .1

View File

@ -134,10 +134,15 @@ J.CTRL .DA Ctrl.Invalid
.DA Ctrl.Invalid
.DA Ctrl.Invalid
L.DLG.SAVE .DA DLG.SAVE
J.DLG.DrawCtrls .DA DLG.DrawCtrls.LBL
.DA DLG.DrawCtrls.TB
.DA DLG.DrawCtrls.OL
.DA DLG.DrawCtrls.BUT
J.DLG.CTRL.Draw .DA DLG.CTRL.Draw.LBL
.DA DLG.CTRL.Draw.TB
.DA DLG.CTRL.Draw.OL
.DA DLG.CTRL.Draw.BUT
J.DLG.CTRL.Focus
.DA DLG.CTRL.Focus.LBL
.DA DLG.CTRL.Focus.TB
.DA DLG.CTRL.Focus.OL
.DA DLG.CTRL.Focus.BUT
.DA 0
*--------------------------------------
CS.INIT clc
@ -445,7 +450,7 @@ DLG.SAVE .DA #DLG.SAVE.LEN Size
.DA #DLG.SAVE.T-DLG.SAVE Title
.DA #DLG.SAVE.S-DLG.SAVE Status
.DA #0 Focus
.DA #9 Focus
.DA #DLG.SAVE.1-DLG.SAVE
.DA #DLG.SAVE.2-DLG.SAVE
.DA #DLG.SAVE.3-DLG.SAVE
@ -475,7 +480,7 @@ DLG.SAVE.5 .DA #S.DLG.Ctrl.BUT,#40,#8
.DA #C.CR
.AZ " Save "
DLG.SAVE.6 .DA #S.DLG.Ctrl.BUT,#50,#8
DLG.SAVE.6 .DA #S.DLG.Ctrl.BUT,#52,#8
.DA #3 Ctrl-C
.AZ " Cancel "

View File

@ -137,7 +137,7 @@ K.atoi.RTS rts
* `>SYSCALL realpath`
* ## RETURN VALUE
* CC : success
* Y,A = Ptr to Full Path (C-String)
* Y,A = Ptr to Full Path (C-String Buffer, MLI.MAXPATH+1)
* X = hMem of Full Path
* CS : A = Error Code
*\--------------------------------------
@ -243,9 +243,19 @@ STDLIB.realpath.I
.82 lda #$ff SELF MODIFIED
bpl .88
>LDYAI K.Buf256
ldx #SYS.StrDup BANK 2
jmp K.SYSCALL2
>LDYAI MLI.MAXPATH+1
jsr K.getmem
bcs .90
>STYA ZPPtr1
ldy #$ff
.83 iny
lda K.Buf256,y
sta (ZPPtr1),y
bne .83
>LDYA ZPPtr1
.88 clc
rts
@ -255,7 +265,7 @@ STDLIB.realpath.I
lda #E.BADPATH
sec
rts
.90 rts
*--------------------------------------
K.RealPath.RemoveAtX
txa X = "/something"

View File

@ -78,7 +78,7 @@ K.StrCpy clc
* ## RETURN VALUE
* CC : success
* Y,A = PTR to String
* X = hMem (PSTR)
* X = hMem (C-String)
* CS : error
* A = SYS error code
*\--------------------------------------