Kernel version 0.8 : Added PPrintF & CPrintF to CIO API

This commit is contained in:
Rémy GIBERT 2016-11-03 17:23:16 +01:00
parent 855092e734
commit 1fd31558f8
5 changed files with 52 additions and 32 deletions

View File

@ -101,10 +101,10 @@ K.SScanF.IsDigit cmp #'0'
.1 sec
rts
*/--------------------------------------
* #PrintFYA
* Prints C-Style String
* #PPrintFYA/CPrintFYA
* Prints P-Stype/C-Style String
* ##In:
* Y,A = PTR to CStr
* Y,A = PTR to PStr/CStr
* %a : pull 2 bytes to Print Access right String 'drwxrwxrwx'
* %b : pull 1 byte to Print BIN
* %B : pull 2 bytes to Print BIN
@ -137,11 +137,15 @@ K.SScanF.IsDigit cmp #'0'
* CC : success
* CS : I/O error from COut
*\--------------------------------------
K.PrintFYA >STYA ZPQuickPtr1
K.PPrintFYA ldx #$01 PSTR
.HS 2C bit abs
K.CPrintFYA ldx #$00 CSTR
>STYA ZPQuickPtr1
stx CIO.GetCharAtPtr1Y+1
ldy #0
ldy #0
.1 lda (ZPQuickPtr1),y
.1 jsr CIO.GetCharAtPtr1Y
beq .99
cmp #'%'
bne .10
@ -151,8 +155,7 @@ K.PrintFYA >STYA ZPQuickPtr1
sta PADCHAR
.2 ldx #PrintFTBL1.END-PrintFTBL1-1
iny
lda (ZPQuickPtr1),y
jsr CIO.GetCharAtPtr1Y
beq .99
.3 cmp PrintFTBL1,x do we have a %x command?
@ -194,37 +197,34 @@ K.PrintFYA >STYA ZPQuickPtr1
tax
jsr PrintFESC
ply
iny
bne .1
bcc .1
rts
.10 cmp #'\'
bne .20
ldx #PrintFTBL2.END-PrintFTBL2-1
iny
lda (ZPQuickPtr1),y
jsr CIO.GetCharAtPtr1Y
beq .99
.12 cmp PrintFTBL2,x
beq .13
dex
bpl .12
bra .80
bra .1
.13 lda PrintFTBL2.OUT,x
.20 jsr K.COutA
.80 iny
bne .1
bcc .1
.99 rts
*--------------------------------------
PrintFESC jmp (PrintFJMP,x)
*--------------------------------------
PrintFTBL1 .AS "abBdDuefhHiILnNsS"
PrintFTBL1.END
PrintFTBL2 .AS "en\%"
PrintFTBL2 .AS "befn\%"
PrintFTBL2.END
PrintFTBL2.OUT .HS 1B.0D \e\n
PrintFTBL2.OUT .HS 08.1B.0C.0D \b\e\f\n
.DA #'\' \\
.DA #'%' \%
PrintFJMP .DA PrintF.A
@ -473,6 +473,26 @@ K.COutA phx
plx
rts
*--------------------------------------
CIO.GetCharAtPtr1Y
lda #$ff Self Modified PSTR/CSTR
bne .1
lda (ZPQuickPtr1),y CSTR
beq .9
iny advance to next char...
clc
rts
.1 tya PSTR
cmp (ZPQuickPtr1)
beq .9
iny
lda (ZPQuickPtr1),y NZ
.9 clc no error, but end of string
rts
*--------------------------------------
PRINTDEC lda PADLEN any Len format ?
beq .1 no

View File

@ -21,30 +21,30 @@ Kernel.Init3 jsr K.DevMgrInit
sta A2osX.ASCREEN
>LDYAI MSG.Init3
>SYSCALL PrintFYA
>SYSCALL CPrintFYA
>LDYAI MSG.IRQ
>SYSCALL PrintFYA
>SYSCALL CPrintFYA
jsr K.IrqMgrInit
bcs *
>LDYAI MSG.MEM
>SYSCALL PrintFYA
>SYSCALL CPrintFYA
jsr K.MemMgrInit
bcs *
>LDYAI MSG.EVT
>SYSCALL PrintFYA
>SYSCALL CPrintFYA
jsr K.EvtMgrInit
bcs *
>LDYAI MSG.FLT
>SYSCALL PrintFYA
>SYSCALL CPrintFYA
jsr K.FltMgrInit
bcs *
>LDYAI MSG.TSK
>SYSCALL PrintFYA
>SYSCALL CPrintFYA
jsr K.TskMgrInit
bcs *
@ -54,11 +54,11 @@ Kernel.Init3 jsr K.DevMgrInit
>PUSHYA
>LDYAI MSG.Prefix
>SYSCALL PrintFYA
>SYSCALL CPrintFYA
>PUSHWI STARTUP.CMDLINE
>LDYAI MSG.Startup
>SYSCALL PrintFYA
>SYSCALL CPrintFYA
>LDYAI STARTUP.CMDLINE
>SYSCALL ExpandPStrYA
@ -69,7 +69,7 @@ Kernel.Init3 jsr K.DevMgrInit
>SYSCALL FreeMemA ...discard...
>LDYAI MSG.Init3.OK
>SYSCALL PrintFYA
>SYSCALL CPrintFYA
>LDYAI TskMgr.Table
>STYA pPs
@ -81,7 +81,7 @@ Kernel.Init3 jsr K.DevMgrInit
.9 >PUSHA
>LDYAI MSG.StartupErr
>SYSCALL PrintFYA
>SYSCALL CPrintFYA
bra * No need to discard Expanded CMDLINE
*--------------------------------------
* K.DevMgrInit

View File

@ -51,8 +51,8 @@ KERNEL.SYSCALL
*--------------------------------------
.DA K.COutA $40
.DA K.SScanF
.DA 0
.DA K.PrintFYA
.DA K.PPrintFYA
.DA K.CPrintFYA
.DA 0
.DA 0
.DA 0

View File

@ -319,7 +319,7 @@ K.FreeMemA phy
>PUSHYA
>LDYAI K.FreeMemA.ERR
jsr K.PrintFYA
jsr K.CPrintFYA
.91 ldx #$ff
bit $C000,x

View File

@ -31,7 +31,7 @@ K.KernelRun jsr TSK.TskMgrRun
bpl .10
>LDYAI MSG.DumpEvent
jsr K.PrintFYA
jsr K.CPrintFYA
.2 jsr EVT.DestroyEvent
@ -78,7 +78,7 @@ K.KernelRun jsr TSK.TskMgrRun
*--------------------------------------
.9 jsr DevMgr.SYS.Select
>LDYAI MSG.KRNLPANIC
jsr K.PrintFYA
jsr K.CPrintFYA
bra *
*--------------------------------------
MSG.DumpEvent >CSTR "!Unhandled Evt:F=%b,DevID=$%h,DATALO=$%h,DATAHI=$%h,W1=$%H,W2=$%H\n"