mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 20:33:13 +00:00
Kernel 0.94
This commit is contained in:
parent
8c89a474c3
commit
2b8967657e
Binary file not shown.
@ -8,7 +8,6 @@ NEW
|
||||
.INB INC/MACROS.I
|
||||
.INB INC/A2OSX.I
|
||||
.INB INC/MLI.E.I
|
||||
.INB INC/LIBCRYPT.I
|
||||
*--------------------------------------
|
||||
FILEBUF.SIZE .EQ 4096
|
||||
*--------------------------------------
|
||||
@ -115,11 +114,13 @@ CS.RUN.FILE >LDYAI FILEBUF.SIZE
|
||||
|
||||
>STYA ZPDataBufPtr
|
||||
stx hDataBuf
|
||||
>PUSHWZ Aux type
|
||||
>PUSHBI 0 ftype
|
||||
>PUSHBI O.RDONLY
|
||||
|
||||
lda Arg
|
||||
>SYSCALL ArgV
|
||||
>PUSHYA
|
||||
>PUSHBI O.RDONLY
|
||||
>PUSHBI 0 ftype
|
||||
>PUSHWZ Aux type
|
||||
>SYSCALL FOpen
|
||||
bcs .9
|
||||
|
||||
|
@ -3,7 +3,7 @@ NEW
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF BIN/MEMDUMP
|
||||
.TF bin/memdump
|
||||
*--------------------------------------
|
||||
.INB INC/MACROS.I
|
||||
.INB INC/A2OSX.I
|
||||
@ -48,9 +48,6 @@ L.MSG1.STR .DA MSG1.STR
|
||||
L.MSG1.HEX .DA MSG1.HEX
|
||||
L.MSG2 .DA MSG2
|
||||
L.MSG3 .DA MSG3
|
||||
L.MSG4 .DA MSG4
|
||||
L.MSG5 .DA MSG5
|
||||
L.MSG.FREE .DA MSG.FREE
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT clc
|
||||
@ -68,15 +65,20 @@ CS.RUN >LEA.G MemStat
|
||||
|
||||
CS.RUN.LOOP >LDA.G bSTOP
|
||||
beq .1
|
||||
|
||||
.10 >SYSCALL GetChar
|
||||
cmp #3 Ctrl-C ?
|
||||
beq CS.RUN.LOOP.RTS
|
||||
|
||||
cmp #C.SPACE
|
||||
bne .10
|
||||
|
||||
>STZ.G bSTOP
|
||||
.1 lda (ZPPTR1)
|
||||
bpl .2
|
||||
|
||||
>INC.G USED.COUNT
|
||||
|
||||
.2 jsr CS.RUN.PRINTMEM
|
||||
lda ZPPTR1
|
||||
clc
|
||||
@ -88,67 +90,52 @@ CS.RUN.LOOP >LDA.G bSTOP
|
||||
>CMP.G MemStat+S.MSTAT.MLast
|
||||
beq CS.RUN.FOOTER
|
||||
bra CS.RUN.LOOP
|
||||
sec
|
||||
|
||||
CS.RUN.LOOP.RTS rts
|
||||
|
||||
CS.RUN.FOOTER >SYSCALL GetChar
|
||||
bcs CS.RUN.LOOP.RTS
|
||||
>PUSHB.G MEM.COUNT
|
||||
|
||||
>PUSHW L.MSG2
|
||||
>PUSHB.G USED.COUNT
|
||||
>PUSHB.G MEM.COUNT
|
||||
>PUSHBI 2
|
||||
>LDYA L.MSG2
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW L.MSG3
|
||||
>PUSHW.G MemStat+S.MSTAT.MH
|
||||
>PUSHBI 2
|
||||
>LDYA L.MSG3
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW.G MemStat+S.MSTAT.MF
|
||||
>PUSHBI 2
|
||||
>LDYA L.MSG4
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW.G MemStat+S.MSTAT.ML
|
||||
>PUSHBI 2
|
||||
>LDYA L.MSG5
|
||||
>SYSCALL printf
|
||||
sec
|
||||
>LDA.G MemStat+S.MSTAT.MF
|
||||
sec
|
||||
>SBC.G MemStat+S.MSTAT.ML
|
||||
pha
|
||||
>LDA.G MemStat+S.MSTAT.MF+1
|
||||
>SBC.G MemStat+S.MSTAT.ML+1
|
||||
ply
|
||||
>PUSHYA
|
||||
>PUSHBI 2
|
||||
>LDYA L.MSG.FREE
|
||||
>PUSHBI 8
|
||||
>SYSCALL printf
|
||||
|
||||
lda #0
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.PRINTMEM ldy #S.MEM.LEN+1
|
||||
CS.RUN.PRINTMEM >PUSHW L.MSG1
|
||||
|
||||
>PUSHB.G MEM.COUNT
|
||||
|
||||
ldx #4
|
||||
.13 lda (ZPPTR1),y
|
||||
>PUSHA
|
||||
dey
|
||||
dex
|
||||
bne .13
|
||||
ldy #S.MEM.REFCNT
|
||||
lda (ZPPTR1),y
|
||||
>PUSHA
|
||||
ldy #S.MEM.OWNERPID
|
||||
lda (ZPPTR1),y
|
||||
>PUSHA
|
||||
lda (ZPPTR1) Get flags
|
||||
ldy #MEM.FLAGS+7
|
||||
ldx #7
|
||||
|
||||
.20 lsr
|
||||
pha
|
||||
lda #'-'
|
||||
bcc .30
|
||||
|
||||
lda MSG.FLAGS,x
|
||||
|
||||
.30 sta (pData),y
|
||||
pla
|
||||
dey
|
||||
@ -156,25 +143,50 @@ CS.RUN.PRINTMEM ldy #S.MEM.LEN+1
|
||||
bpl .20
|
||||
|
||||
>PUSHEA.G MEM.FLAGS
|
||||
>PUSHB.G MEM.COUNT
|
||||
|
||||
ldy #S.MEM.OWNERPID
|
||||
lda (ZPPTR1),y
|
||||
>PUSHA
|
||||
|
||||
ldy #S.MEM.REFCNT
|
||||
lda (ZPPTR1),y
|
||||
>PUSHA
|
||||
|
||||
ldy #S.MEM.PTR+1
|
||||
lda (ZPPTR1),y
|
||||
>PUSHA
|
||||
dey
|
||||
lda (ZPPTR1),y
|
||||
>PUSHA
|
||||
|
||||
ldy #S.MEM.LEN+1
|
||||
lda (ZPPTR1),y
|
||||
>PUSHA
|
||||
dey
|
||||
lda (ZPPTR1),y
|
||||
>PUSHA
|
||||
|
||||
lda (ZPPTR1) Get flags
|
||||
bpl .12
|
||||
|
||||
ldy #S.MEM.OWNERPID
|
||||
lda (ZPPTR1),y
|
||||
jsr CS.RUN.CHECKPS
|
||||
bcc .12
|
||||
|
||||
>PUSHW L.MSG1.INV
|
||||
>PUSHBI 0
|
||||
>LDYA L.MSG1.INV
|
||||
>SYSCALL printf
|
||||
|
||||
.12 >PUSHBI 9
|
||||
>LDYA L.MSG1
|
||||
>SYSCALL printf
|
||||
|
||||
lda (ZPPTR1)
|
||||
and #S.MEM.F.CODE
|
||||
bne CS.RUN.PRINTMEM.BIN
|
||||
****** DATA
|
||||
|
||||
CS.RUN.PRINTMEM.DATA
|
||||
|
||||
ldy #S.MEM.PTR
|
||||
lda (ZPPTR1),y
|
||||
sta ZPPTR2
|
||||
@ -190,30 +202,37 @@ CS.RUN.PRINTMEM ldy #S.MEM.LEN+1
|
||||
iny
|
||||
bne .1
|
||||
|
||||
.11 tya
|
||||
beq .2 Startig with 0...PrintHEX
|
||||
.11 >PUSHW L.MSG1.STR
|
||||
tya
|
||||
beq .2 Starting with 0...PrintHEX
|
||||
|
||||
>PUSHA len
|
||||
>PUSHW ZPPTR2 String
|
||||
tya Len
|
||||
>PUSHA
|
||||
>PUSHBI 3
|
||||
>LDYA L.MSG1.STR
|
||||
|
||||
bra CS.RUN.PRINTMEM.OUT
|
||||
|
||||
.2 ldy #15
|
||||
.2 >PUSHW L.MSG1.HEX
|
||||
|
||||
ldy #0
|
||||
|
||||
.3 >PUSHB (ZPPTR2),y
|
||||
dey
|
||||
bpl .3
|
||||
iny
|
||||
cpy #16
|
||||
bne .3
|
||||
|
||||
>PUSHBI 16
|
||||
>LDYA L.MSG1.HEX
|
||||
|
||||
bra CS.RUN.PRINTMEM.OUT
|
||||
CS.RUN.PRINTMEM.BIN
|
||||
>PUSHW L.MSG1.BIN
|
||||
|
||||
ldy #S.MEM.BIN
|
||||
lda (ZPPTR1),y
|
||||
>SYSCALL GetMemPtr
|
||||
>PUSHYA
|
||||
>PUSHBI 2
|
||||
>LDYA L.MSG1.BIN
|
||||
|
||||
CS.RUN.PRINTMEM.OUT
|
||||
>SYSCALL printf
|
||||
>INC.G LINE.COUNT
|
||||
@ -251,10 +270,10 @@ MSG1.BIN .AZ "{%s}\e[0m\r\n"
|
||||
MSG1.STR .AZ "[%03d:%s]\e[0m\r\n"
|
||||
MSG1.HEX .AZ "?HEX:%h%h.%h%h.%h%h.%h%h.%h%h.%h%h.%h%h.%h%h\e[0m\r\n"
|
||||
MSG2 .AZ "\r\nAllocated hMem:%d, Total:%d\r\n"
|
||||
MSG3 .AZ "High Memory: $%H\r\n"
|
||||
MSG4 .AZ "Free ULimit: $%H\r\n"
|
||||
MSG5 .AZ "Low Memory: $%H\r\n"
|
||||
MSG.FREE .AZ "\r\nFree Memory: %D Bytes.\r\n"
|
||||
MSG3 .AS "High Memory: $%H\r\n"
|
||||
.AS "Free ULimit: $%H\r\n"
|
||||
.AS "Low Memory: $%H\r\n"
|
||||
.AZ "\r\nFree Memory: %D Bytes.\r\n"
|
||||
MSG.FLAGS .AS "UZXAfcds"
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
|
@ -629,10 +629,10 @@ K.Kill.2 ldy #S.PS.hSID
|
||||
* `int loadtxtfile ( const char * filename, short int flags, short int ftype, int auxtype );`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* `>PUSHW auxtype`
|
||||
* `>PUSHB ftype`
|
||||
* `>PUSHW filename`
|
||||
* `>PUSHB flags`
|
||||
* `>LDYA filename`
|
||||
* `>PUSHB ftype`
|
||||
* `>PUSHW auxtype`
|
||||
* `>SYSCALL loadtxtfile`
|
||||
* ## RETURN VALUE
|
||||
* Y,A = File Length (without ending 0)
|
||||
@ -655,10 +655,10 @@ K.LoadTxtFile sec
|
||||
* `int loadfile ( const char * filename, short int flags, short int ftype, int auxtype );`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* `>PUSHW auxtype`
|
||||
* `>PUSHB ftype`
|
||||
* `>PUSHW filename`
|
||||
* `>PUSHB flags`
|
||||
* `>LDYA filename`
|
||||
* `>PUSHB ftype`
|
||||
* `>PUSHW auxtype`
|
||||
* `>SYSCALL loadfile`
|
||||
* ## RETURN VALUE
|
||||
* Y,A = File Length
|
||||
@ -742,13 +742,14 @@ K.LoadFile clc
|
||||
* Search a file in the provided PATH list
|
||||
* And return, if found, the full path to it.
|
||||
* ## C
|
||||
* `int filesearch ( char * filename, char * searchpath, char * fullpath, stat * filestat);`
|
||||
* `int filesearch( char *filename, char *searchpath, char *fullpath, stat *filestat);`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* `>PUSHWI filename`
|
||||
* `>PUSHWI fullpath`
|
||||
* `>PUSHWI searchpath`
|
||||
* `>PUSHWI filestat`
|
||||
* `>PUSHW filename`
|
||||
* `>PUSHW fullpath`
|
||||
* `>PUSHW searchpath`
|
||||
* `>PUSHW filestat`
|
||||
* `>SYSCALL filesearch`
|
||||
* ## RETURN VALUE
|
||||
* CC : success
|
||||
* DstBuf = FilePath
|
||||
|
Loading…
Reference in New Issue
Block a user