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

View File

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

View File

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

View File

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

View File

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