Added ANSI support in CONSOLE.DRV

for EDIT.S.txt
This commit is contained in:
Rémy GIBERT 2015-11-29 23:19:10 +01:00
parent a1719ba89f
commit 6ae2016154
12 changed files with 595 additions and 311 deletions

Binary file not shown.

Binary file not shown.

View File

@ -8,19 +8,18 @@ echo Env:
SET
INSDRV CONSOLE.DRV
GETTY CON SBIN/LOGIN
#INSDRV UTHERNET.DRV 000E3A123456
#TCPIP ETH3
#DHCPCLNT
#INSDRV SSC.DRV 9600 N 8 1 X
#GETTY COM2 SBIN/LOGIN
#INSDRV PPIC.DRV
INSDRV UTHERNET.DRV 000E3A123456
TCPIP ETH3
DHCPCLNT
#TELNETD
#MOUNT TFTP 192.168.1.5:/A2OSX /MNT/A2OSX
#MOUNT CIFS 192.168.1.5:/MSSHARE /MNT/MSSHARE
INSDRV DHGR.DRV
INSDRV MOUSE.DRV
GUI
PS
#INSDRV DHGR.DRV
#INSDRV MOUSE.DRV
#DESKTOP
ECHO *** End A2osX Startup file ***
MAN
TEXT A2OSX.STARTUP

View File

@ -7,6 +7,13 @@ AUTO 6
.OP 65C02
.OR $2000
.TF /A2OSX.BOOT/BIN/EDIT
*--------------------------------------
* ^C = Exit (Cancel)
* ^KH = Help
* ^KB = Begin Block
* ^KK = End Block
* ^KC = Copy Block
* ^KV = Move Block
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
@ -33,6 +40,10 @@ CS.START cld
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.SEQ.INV .DA SEQ.INV
L.SEQ.NORM .DA SEQ.NORM
L.MSG.TOPBAR .DA MSG.TOPBAR
L.MSG.NEWFILE .DA MSG.NEWFILE
.DA 0
*--------------------------------------
CS.INIT lda #0
@ -55,6 +66,7 @@ CS.INIT lda #0
ldy #S.PS.hARGS
lda (pPs),y
>SYSCALL SYS.PStrCpyA
bra .3
.10 ldy #S.PS.hARGS
@ -72,7 +84,7 @@ CS.INIT lda #0
bcs .9
bra .8
.7 >PUSHWI 16
.7 >PUSHWI 2048
>PUSHBI 0
>SYSCALL SYS.GetMem
bcs .9
@ -96,8 +108,7 @@ CS.INIT lda #0
ldy #bInsert
sta (pData),y
lda #12
jsr COUT
jsr InitScreen
lda (pPs)
ora #S.PS.F.EVENT Now accept events
@ -151,20 +162,51 @@ CS.QUIT ldy #hBuffer
lda (pData),y
>SYSCALL SYS.FreeMemA
ldy #hFileName
lda (pData),y
beq .8
>SYSCALL SYS.FreeMemA
.8 clc
rts
*--------------------------------------
InitScreen lda #0
ldy #cPos
sta (pData),y
ldy #rPos
sta (pData),y
lda #12
>SYSCALL SYS.CoutA
bcs .9
jsr UpdateTopBar
bcs .9
clc
rts
.9 rts
*--------------------------------------
CROUT lda #13
*--------------------------------------
COUT phx
phy
ldx #DEVMGR.COUT
jsr pDevJmp
ply
plx
rts
UpdateTopBar ldy #hFileName
lda (pData),y
beq .1
>SYSCALL SYS.GetMemPtrA
bra .2
.1 >LDYA L.MSG.NEWFILE
.2 >PUSHYA
>LDYA L.MSG.TOPBAR
>SYSCALL SYS.PSTRoutYA
bcs .9
clc
.9 rts
*--------------------------------------
CS.END
SEQ.INV >PSTRING "\e[7m"
SEQ.NORM >PSTRING "\e[0m"
MSG.TOPBAR >PSTRING "\e[H\e[7mA2osX Edit:%S\e[K\e[0m"
MSG.NEWFILE >PSTRING "(new file)"
*--------------------------------------
.DUMMY
.OR 0

View File

@ -13,9 +13,11 @@ AUTO 6
.INB INC/IO.I
*--------------------------------------
CURSOR.BLINK.SPEED .EQ 2
ESCSEQ.MAXLEN .EQ 16
*--------------------------------------
ZPBASL1 .EQ ZPDRV
ZPBASL2 .EQ ZPDRV+2
ZPBaseL1 .EQ ZPDRV
ZPBaseL2 .EQ ZPDRV+2
ZPTmpByte .EQ ZPDRV+4
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -64,11 +66,18 @@ DRV.CS.START .DA OPEN
.DA GETINFO
.DA IRQ
L.DEVINFO .DA DEVINFO
.DA 0 end or relocation
J.EscSeq .DA Esc.DispAttr m
.DA Esc.Scroll r
.DA Esc.EraseLine K
.DA Esc.Home H
.DA 0 end of relocation
*--------------------------------------
OPEN stz CURON
lda #$80
sta INVFLG
stz bEscMode
stz bEscModeCSI
jsr RESET
jsr RESETATTR
jsr HOME
lda #A2osX.SCREENS.C
@ -95,7 +104,52 @@ GETEVENT lda A2osX.TIMER16
sec
rts
*--------------------------------------
COUT jsr COUT1
COUT bit bEscMode
bpl .1
jmp EscMode
.1 pha
jsr CUROFF
pla
cmp #32
bcc COUT.CTRL
ora INVFLG
ldx CH
ldy CV
jsr SetCharAtXY
bra FSOUT
COUT.CTRL cmp #8
bne .2
ldx CH
beq .10
dec CH
bra .12
.10 ldy CV
bne .11
clc
rts
.11 lda #79
sta CH
dec CV
.12 lda #$20
ora INVFLG
ldx CH
ldy CV
jmp SetCharAtXY
.2 cmp #12
beq HOME
.3 cmp #13
beq CROUT
cmp #27 ESC
dec bEscMode
clc
rts
*--------------------------------------
@ -112,51 +166,21 @@ IRQ clc
*--------------------------------------
* PRIVATE
*--------------------------------------
COUT1 pha
jsr CUROFF
pla
cmp #32
bcs .80 regular char
cmp #8
bne .2
ldx CH
beq .10
dec CH
bra .12
.10 ldy CV
bne .11
RESET lda #0
sta SCROLLTOP
lda #23
sta SCROLLBOT
rts
.11 lda #79
sta CH
dec CV
.12 lda #$20
ora INVFLG
ldx CH
ldy CV
jsr SetCharAtXY
*--------------------------------------
RESETATTR lda #$80
sta INVFLG
rts
.2 cmp #12
bne .3
jmp HOME
.3 cmp #13
beq CROUT
rts
.80 ora INVFLG
ldx CH
ldy CV
jsr SetCharAtXY
*--------------------------------------
FSOUT ldx CH
cpx #79
beq CROUT1
inc CH
clc
rts
*--------------------------------------
CROUT jsr CLREOL
@ -166,51 +190,7 @@ CROUT1 stz CH
cpy #23
beq SCROLL.UP
inc CV
rts
*--------------------------------------
SCROLL.UP ldx #0
.1 lda BASEL,x
sta ZPBASL1
lda BASEH,x
sta ZPBASL1+1
inx
lda BASEL,x
sta ZPBASL2
lda BASEH,x
sta ZPBASL2+1
ldy #39
sta SETWRITEAUX
sta SETREADAUX
.2 lda (ZPBASL2),y
sta (ZPBASL1),y
dey
bpl .2
ldy #39
sta CLRWRITEAUX
sta CLRREADAUX
.3 lda (ZPBASL2),y
sta (ZPBASL1),y
dey
bpl .3
cpx #23
bne .1
*--------------------------------------
CLREOL ldx CH
.1 phx
ldy CV
lda #$20
ora INVFLG
jsr SetCharAtXY
plx
inx
cpx #80
bne .1
clc
rts
*--------------------------------------
HOME stz CH
@ -219,9 +199,9 @@ HOME stz CH
ldx #23
.1 lda BASEL,x
sta ZPBASL1
sta ZPBaseL1
lda BASEH,x
sta ZPBASL1+1
sta ZPBaseL1+1
lda #' '
ora INVFLG
@ -230,7 +210,7 @@ HOME stz CH
sta SETREADAUX
ldy #39
.2 sta (ZPBASL1),y
.2 sta (ZPBaseL1),y
dey
bpl .2
@ -238,13 +218,71 @@ HOME stz CH
sta CLRREADAUX
ldy #39
.3 sta (ZPBASL1),y
.3 sta (ZPBaseL1),y
dey
bpl .3
dex
bpl .1
clc
rts
*--------------------------------------
SCROLL.UP ldx SCROLLTOP
.1 lda BASEL,x
sta ZPBaseL1
lda BASEH,x
sta ZPBaseL1+1
inx
lda BASEL,x
sta ZPBaseL2
lda BASEH,x
sta ZPBaseL2+1
ldy #39
sta SETWRITEAUX
sta SETREADAUX
.2 lda (ZPBaseL2),y
sta (ZPBaseL1),y
dey
bpl .2
ldy #39
sta CLRWRITEAUX
sta CLRREADAUX
.3 lda (ZPBaseL2),y
sta (ZPBaseL1),y
dey
bpl .3
cpx SCROLLBOT
bne .1
*--------------------------------------
CLREOL ldx CH
ldy #80
bra CLR
CLRLINE ldx #0
ldy #80
bra CLR
CLRSOL ldx #0
ldy CH
CLR sty ZPTmpByte
.1 phx
lda #$20
ora INVFLG
ldy CV
jsr SetCharAtXY
plx
inx
cpx ZPTmpByte
bne .1
clc
rts
*--------------------------------------
CUROFF lda CURON
@ -264,9 +302,10 @@ CURBLNK1 lda CURON
ldy CV
jsr GetCharAtXY
sta CURCHAR
and #$80
ldx CH
ldy CV
lda #$20
eor #" "
jsr SetCharAtXY
bra CUREXIT
@ -280,7 +319,13 @@ CUREXIT lda CURON
sta CURON
CUREXIT.RTS rts
*--------------------------------------
SetCharAtXY pha
SetCharAtXY cmp #$40
bcc .10
cmp #$5F
bcs .10
and #$3F
.10 pha
txa
lsr
@ -289,12 +334,12 @@ SetCharAtXY pha
.1 clc
adc BASEL,y
sta ZPBASL1
sta ZPBaseL1
lda BASEH,y
sta ZPBASL1+1
sta ZPBaseL1+1
pla
sta (ZPBASL1)
sta (ZPBaseL1)
sta CLRWRITEAUX
rts
*--------------------------------------
@ -306,22 +351,201 @@ GetCharAtXY txa
.1 clc
adc BASEL,y
sta ZPBASL1
sta ZPBaseL1
lda BASEH,y
sta ZPBASL1+1
sta ZPBaseL1+1
lda (ZPBASL1)
lda (ZPBaseL1)
sta CLRREADAUX
rts
*--------------------------------------
EscMode bit bEscModeCSI
bmi EscModeCSI
cmp #'['
bne .1
dec bEscModeCSI
stz EscSeq
clc
rts
.1 cmp #'7' save cup & attr
cmp #'8' restore cup & attr
stz bEscMode
clc
rts
EscModeCSI inc EscSeq
ldx EscSeq
sta EscSeq,x
cmp #64 End of Seq ?
bcs ExecEscSeq
cpx #ESCSEQ.MAXLEN too long?
bne .1
stz bEscModeCSI
stz bEscMode
.1 clc
rts
*--------------------------------------
ExecEscSeq stz EscSeqParamCnt
stz EscSeqInNum
ldx #0 EscSeq Ptr
ldy #0 EsqSeqParam Ptr
.1 inx
lda EscSeq,x
jsr IsDigit
bcs .2
dec EscSeqInNum
and #$0F
pha
lda EscSeqParam,y param=param*10
asl
asl
clc
adc EscSeqParam,y
sta EscSeqParam,y
pla
clc
adc EscSeqParam,y
sta EscSeqParam,y
bra .1
.2 bit EscSeqInNum
bpl .3
stz EscSeqInNum
iny
.3 lda EscSeq,x
cmp #';'
beq .1
sty EscSeqParamCnt
stz bEscModeCSI
stz bEscMode
ldy #0
ldx #0
.4 iny
cmp EscSeqCmds,y
beq .5
inx
inx
cpy EscSeqCmds
bne .4
clc
rts
.5 jmp (J.EscSeq,x)
*--------------------------------------
IsDigit cmp #'0'
bcc .9
cmp #'9'+1
rts cc if ok, cs if not
.9 sec
rts
*--------------------------------------
Esc.DispAttr ldx EscSeqParamCnt
beq .8
.1 lda EscSeqParam-1,x
bne .2
jsr RESETATTR
bra .7
.2 cmp #7
bne .8
stz INVFLG
.7 dex
bne .1
.8 clc
rts
*--------------------------------------
Esc.Scroll ldx EscSeqParamCnt
bne .1
lda #0
ldy #23
bra .8
.1 cpx #2
bne .9
lda EscSeqParam
dec
ldy EscSeqParam+1
dey
.8 sta SCROLLTOP
sty SCROLLBOT
.9 clc
rts
*--------------------------------------
Esc.EraseLine ldx EscSeqParamCnt
bne .1
jmp CLREOL
.1 lda EscSeqParam
cmp #1
bne .2
jmp CLRSOL
.2 cmp #2
bne .9
jmp CLRLINE
.9 clc
rts
*--------------------------------------
Esc.Home ldx EscSeqParamCnt
bne .1
stz CH
stz CV
clc
rts
.1 lda EscSeqParam
dec
bmi .9
cmp #80
bcs .9
sta CH
lda EscSeqParam+1
dec
bmi .9
cmp #24
bcs .9
sta CV
.9 clc
rts
*--------------------------------------
DRV.CS.END
BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0
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
CH .BS 1
CV .BS 1
INVFLG .BS 1
SCROLLTOP .BS 1
SCROLLBOT .BS 1
CURON .BS 1
CURCHAR .BS 1
bEscMode .BS 1
bEscModeCSI .BS 1
EscSeq .BS ESCSEQ.MAXLEN+1
EscSeqParamCnt .BS 1
EscSeqParam .BS 4
EscSeqInNum .BS 1
EscSeqCmds >PSTRING "mrKH"
DEVINFO .DA #S.DEVINFO.TYPE.CHAR
.DA #80
.DA #24

View File

@ -83,8 +83,8 @@ OPEN lda #A2osX.SCREENS.G
lda BASEH,x
sta ZPBASE+1
lda #$55
* lda #$00
* lda #$55
lda #$00
ldy #39
sta SETWRITEAUX
@ -92,8 +92,8 @@ OPEN lda #A2osX.SCREENS.G
dey
bpl .82
lda #$2A
* lda #$00
* lda #$2A
lda #$00
ldy #39
sta CLRWRITEAUX
@ -138,7 +138,9 @@ GETINFO >LDYA L.DEVINFO
* PULLB = Y
* PULLB = Color (if not xor)
*--------------------------------------
SETPIXEL >PULLA Pull Mode
SETPIXEL sta SET80STORE
>PULLA Pull Mode
and #$FF
bpl SETPIXEL.1
@ -161,8 +163,8 @@ SETPIXEL.XOR >PULLYA Y=X.LO,A=X.HI
.3 lsr
tay
bcs .4 odd=main ram
sta SETWRITEAUX
sta SETREADAUX
sta SETPAGE2
.4 >PULLA Pull Y
tax
lda BASEL,x setup line Base Ptr
@ -174,17 +176,18 @@ SETPIXEL.XOR >PULLYA Y=X.LO,A=X.HI
eor Mono.Masks,x
sta (ZPBASE),y
sta CLRWRITEAUX
sta CLRREADAUX
sta CLR80STORE
rts
*--------------------------------------
SETPIXEL.1 lsr
bcc SETPIXEL.COLOR
>PULLW CX
>PULLB CY
>PULLYA Y=X.LO,A=X.HI
lsr if 256 =< x < 511
ldy CX
lsr CX+1 if 256 =< x < 511
bcs .1
lsr
lsr CX+1
bcs .2 if 512 < x
lda DIV7.0,y
ldx MOD7.0,y
@ -198,82 +201,72 @@ SETPIXEL.1 lsr
ldx MOD7.512,y
.3 lsr
tay
bcs .4 odd=main ram
sta SETWRITEAUX
sta SETREADAUX
.4 phx
>PULLA Pull Y
tax
lda BASEL,x setup line Base Ptr
bcc .4 odd=main ram
sta CLRPAGE2
clc
bra .41
.4 sta SETPAGE2
.41 ldy CY
adc BASEL,y setup line Base Ptr
sta ZPBASE
lda BASEH,x
lda BASEH,y
sta ZPBASE+1
plx
>PULLA Pull Color
lsr
bcs .6 set white pixel
lda (ZPBASE),y
lda (ZPBASE)
and Mono.NMasks,x includes And $7F for mono
sta (ZPBASE),y
sta CLRWRITEAUX
sta CLRREADAUX
sta (ZPBASE)
sta CLR80STORE
rts
.6 lda (ZPBASE),y
.6 lda (ZPBASE)
and #$7F switch back this byte to mono
ora Mono.Masks,x
sta (ZPBASE),y
sta CLRWRITEAUX
sta CLRREADAUX
sta (ZPBASE)
sta CLR80STORE
rts
*--------------------------------------
SETPIXEL.COLOR >PULLA Get X.LO...
pha
>PULLB GBYTE Get X.HI in temp location
pla
lsr GBYTE divide by 4 (range 0->139)
ror
lsr GBYTE
ror
tay
SETPIXEL.COLOR >PULLW CX Get X.LO...
>PULLB CY
>PULLA Pull Y
tax
lda BASEL,x setup line Base Ptr
sta ZPBASE
lda CX
lsr CX+1 divide by 4
ror
lsr CX+1
ror
tay Y=CX/4 (range 0->139)
lda DIV7.0,y A=CX/4/7 (range 0->19)
asl times 2 (range 0->38)
ldx CY
adc BASEL,x setup line Base Ptr (cc by asl)
sta ZPBASE ZPBASE now point to first of...
lda BASEH,x
sta ZPBASE+1
sta ZPBASE+1 ...the 4 columns
lda DIV7.0,y
lda MOD7.0,y get MOD
asl Carry Cleared, by ASL
adc ZPBASE ZPBASE now point to first of the 4 columns
sta ZPBASE
ldx MOD7.0,y
txa get MOD
asl times 4 to compute index in color tables
asl times 4 to compute index in MASK tables
asl
tax set in X for Masks,NMasks
>PULLA get COLOR
asl
asl times 4 to compute index in PIXELS table
asl
tay
lda Color.Masks,x
lda Color.Masks,x bits in 1st byte to light?
beq .1
and Color.Pixels,y apply color
sta GBYTE
sta SETWRITEAUX
sta SETREADAUX
sta SETPAGE2
lda (ZPBASE)
and Color.NMasks,x reset existing pixel,
@ -288,8 +281,7 @@ SETPIXEL.COLOR >PULLA Get X.LO...
and Color.Pixels,y apply color
sta GBYTE
sta CLRWRITEAUX
sta CLRREADAUX
sta CLRPAGE2
lda (ZPBASE)
and Color.NMasks,x reset existing pixel,
@ -305,8 +297,7 @@ SETPIXEL.COLOR >PULLA Get X.LO...
and Color.Pixels,y apply color
sta GBYTE
sta SETWRITEAUX
sta SETREADAUX
sta SETPAGE2
lda (ZPBASE)
and Color.NMasks,x reset existing pixel,
@ -321,27 +312,37 @@ SETPIXEL.COLOR >PULLA Get X.LO...
and Color.Pixels,y apply color
sta GBYTE
sta SETWRITEAUX
sta SETREADAUX
sta CLRPAGE2
lda (ZPBASE)
and Color.NMasks,x reset existing pixel,
ora GBYTE
sta (ZPBASE)
.8 sta CLRWRITEAUX
sta CLRREADAUX
.8 sta CLR80STORE
rts
*--------------------------------------
GETPIXEL
GETPIXEL rts
*--------------------------------------
HLINE
HLINE rts
*--------------------------------------
VLINE
VLINE rts
*--------------------------------------
FILLREC
FILLREC rts
*--------------------------------------
* params : X,Y,W,H
*
* 0 : hStockObject
* 1 : Operation
* Replace
Combine (Ora)
CombineEx (And with Src Mask,Ora with Src BM)
* 2 : SrcX
* 4 : SrcY
* 6 : DestX
* 8 : DestY
* 12 : Width
* 14 : Height
*
*--------------------------------------
BITBLT
rts
@ -365,6 +366,7 @@ Mono.Masks .DA #%00000001
.DA #%01000000
*--------------------------------------
* bits to "and" to reset color of pixel (0 means nothing to do)
* 4 bytes * 7 mods
*--------------------------------------
* c1110000 c3322221 c5444433 c6666555
Color.NMasks .DA #%01110000,#%00000000,#%00000000,#%00000000
@ -392,6 +394,7 @@ Color.Masks .DA #%10001111,#%00000000,#%00000000,#%00000000
*--------------------------------------
* c1110000 c3322221 c5444433 c6666555
Color.Pixels .DA #%00000000,#%00000000,#%00000000,#%00000000 black (color bit disable)
.DA #%01111111,#%01111111,#%01111111,#%01111111 white (color bit disable)
.DA #%10010001,#%10100010,#%11000100,#%10001000 dark blue
.DA #%10100010,#%11000100,#%10001000,#%10010001 dark green
.DA #%10110011,#%11100110,#%11001100,#%10011001 medium blue
@ -406,7 +409,6 @@ Color.Pixels .DA #%00000000,#%00000000,#%00000000,#%00000000 black (color bit di
.DA #%11001100,#%10011001,#%10110011,#%11100110 orange
.DA #%11011101,#%10111011,#%11110111,#%11101110 pink
.DA #%11101110,#%11011101,#%10111011,#%11110111 yellow
.DA #%01111111,#%01111111,#%01111111,#%01111111 white (color bit disable)
*--------------------------------------
DIV7.0 .HS 0000000000000001010101010101
.HS 0202020202020203030303030303
@ -544,6 +546,9 @@ BASEH .HS 20.24.28.2C.30.34.38.3C
.HS 23.27.2B.2F.33.37.3B.3F
.HS 23.27.2B.2F.33.37.3B.3F
*--------------------------------------
CX .BS 2
CY .BS 1
COL .BS 1
GBYTE .BS 1
*--------------------------------------
DEVINFO .DA #S.DEVINFO.TYPE.GFX type of DEVINFO STRUCT

View File

@ -28,6 +28,8 @@ CS.START cld
*--------------------------------------
.1 .DA LIB.LOAD
.DA LIB.UNLOAD
*--------------------------------------
.DA 0
*--------------------------------------
LIB.LOAD
LIB.UNLOAD clc

View File

@ -51,7 +51,7 @@ PRINTFJMP1 .DA PRINTFA
.DA PRINTFI,PRINTFII
.DA PRINTFSC,PRINTFSP
.DA PRINTFT,PRINTFTT
PRINTFJMP2 .DA PRINTFCR,PRINTFBKSLH,PRINTFPERCENT
PRINTFJMP2 .DA PRINTFESC,PRINTFCR,PRINTFBKSLH,PRINTFPERCENT
*--------------------------------------
.DA 0
*--------------------------------------
@ -68,17 +68,19 @@ LIB.UNLOAD clc
* %d pull 1 byte to print unsigned DEC
* %D pull 2 bytes to print unsigned DEC
* %L pull 4 bytes to print unsigned DEC
* %e pull 1 byte to print low Nibble HEX
* %E pull 1 byte to print high Nibble HEX
* %n pull 1 byte to print low Nibble HEX
* %N pull 1 byte to print high Nibble HEX
* %h pull 1 byte to print HEX
* %H pull 2 bytes to print HEX
* %i pull 1 byte to print signed DEC
* %I pull 2 bytes to print signed DEC
* %s pull 2 bytes ptr to C-Style String
* %S pull 2 bytes ptr to P-Style String
* \e print 'ESC' ($1B,27)
* \n print CR=13
* \\ print \
* \% print %
* padding :
* %d '9' '12'
* %2d ' 9' '12'
@ -90,10 +92,9 @@ PRINTF >PULLW ZPTmpPtr1
ldy #0
PRINTFCOUT lda (ZPTmpPtr1),y
beq .1
ora #$80
cmp #"%"
cmp #'%'
beq PRINTFESC1
cmp #"\"
cmp #'\'
beq PRINTFESC2
jsr COUT
iny
@ -105,21 +106,20 @@ PRINTFEXIT ply
rts
*--------------------------------------
PRINTFESC1 stz PADLEN
lda #" "
lda #' '
sta PADCHAR
.1 ldx #PRINTFTBL1.END-PRINTFTBL1-1
iny
lda (ZPTmpPtr1),y
beq .9
ora #$80
.2 cmp PRINTFTBL1,x do we have a %x command?
beq .8 yes, jmp to it!
dex
bpl .2 no valid letter...
cmp #"0" ...a 0...mmm... padding char!!
cmp #'0' ...a 0...mmm... padding char!!
beq .4
bcc .9
cmp #"9"
cmp #'9'
bcs .9
.3 and #$0F we have a digit
pha save it...
@ -139,7 +139,7 @@ PRINTFESC1 stz PADLEN
bra .5
.4 lda PADLEN do we already had met digits to build PADLEN ?
bne .3 yes, continue to build PADLEN
lda #"0"
lda #'0'
sta PADCHAR no, this is the first 0, so make it PADCHAR
.5 bra .1
.8 phy
@ -153,7 +153,6 @@ PRINTFESC2 ldx #PRINTFTBL2.END-PRINTFTBL2-1
iny
lda (ZPTmpPtr1),y
beq .9
ora #$80
.2 cmp PRINTFTBL2,x
beq .3
dex
@ -170,7 +169,7 @@ PRINTFA >PULLA
ldx #0
.1 asl
pha
lda #"-"
lda #'-'
bcc .2
lda PRINTF.ATTRIB,x
.2 jsr COUT
@ -254,12 +253,16 @@ PRINTFT jsr PRINTTIME
jmp PRINTFEXIT
PRINTFTT jsr PRINTDATE
jmp PRINTFEXIT
PRINTFCR jsr CROUT
jmp PRINTFEXIT
PRINTFBKSLH lda #"\"
*--------------------------------------
PRINTFESC lda #$1B ESC
jsr COUT
jmp PRINTFEXIT
PRINTFPERCENT lda #"%"
PRINTFCR jsr CROUT
jmp PRINTFEXIT
PRINTFBKSLH lda #'\'
jsr COUT
jmp PRINTFEXIT
PRINTFPERCENT lda #'%'
jsr COUT
jmp PRINTFEXIT
*--------------------------------------
@ -267,7 +270,6 @@ PRINTC >PULLW ZPTmpPtr2
ldy #0
.1 lda (ZPTmpPtr2),y
beq .8
ora #$80
jsr COUT
iny
bne .1
@ -280,7 +282,6 @@ PRINTP >PULLW ZPTmpPtr2
beq .8
.1 iny
lda (ZPTmpPtr2),y
ora #$80
jsr COUT
dex
bne .1
@ -388,7 +389,7 @@ LCASEP phx
PRINTDATE stz HEXBUF+1
stz HEXBUF+2
stz HEXBUF+3
ldx #"0"
ldx #'0'
stx PADCHAR
ldx #2
stx PADLEN
@ -405,9 +406,9 @@ PRINTDATE stz HEXBUF+1
pla
sta HEXBUF
jsr HEX2DEC
lda #"/"
lda #'/'
jsr COUT
ldx #"0"
ldx #'0'
stx PADCHAR
ldx #2
stx PADLEN
@ -422,9 +423,9 @@ PRINTDATE stz HEXBUF+1
lsr
sta HEXBUF
jsr HEX2DEC
lda #"/"
lda #'/'
jsr COUT
ldx #"0"
ldx #'0'
stx PADCHAR
ldx #2
stx PADLEN
@ -439,7 +440,7 @@ PRINTDATE stz HEXBUF+1
PRINTTIME stz HEXBUF+1
stz HEXBUF+2
stz HEXBUF+3
ldx #"0"
ldx #'0'
stx PADCHAR
ldx #2
stx PADLEN
@ -447,9 +448,9 @@ PRINTTIME stz HEXBUF+1
and #$1F
sta HEXBUF
jsr HEX2DEC
lda #":"
lda #':'
jsr COUT
ldx #"0"
ldx #'0'
stx PADCHAR
ldx #2
stx PADLEN
@ -560,7 +561,6 @@ PRINTYA >STYA ZPTmpPtr2
ldy #0
.1 lda (ZPTmpPtr2),y
beq .2
ora #$80
jsr COUT
iny
bne .1
@ -578,7 +578,6 @@ PRINTYAP phx
beq .8
.1 iny
lda (ZPTmpPtr2),y
ora #$80
jsr COUT
lda PADLEN
beq .2
@ -762,11 +761,11 @@ COUT phx
rts
*--------------------------------------
CS.END
PRINTFTBL1 .AS -"abBdDLeEhHiIsStT"
PRINTFTBL1 .AS "abBdDLnNhHiIsStT"
PRINTFTBL1.END
PRINTFTBL2 .AS -"n\%"
PRINTFTBL2 .AS "en\%"
PRINTFTBL2.END
PRINTF.ATTRIB .AS -"dnb+++wr"
PRINTF.ATTRIB .AS "dnb+++wr"
*--------------------------------------
PADCHAR .BS 1
PADLEN .BS 1

View File

@ -6,7 +6,7 @@ AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BOOT/SBIN/GUI
.TF /A2OSX.BOOT/SBIN/DESKTOP
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
@ -55,6 +55,10 @@ CS.INIT >LDYA L.DEVNAME.GFX
.20 stx hDevMouse
>STYA pDevMouse
ldx #DEVMGR.OPEN
jsr GoDevMouse
bcs *
ldx #DEVMGR.OPEN
jsr GoDevGFX
bcs *
@ -62,34 +66,20 @@ CS.INIT >LDYA L.DEVNAME.GFX
lda #A2osX.SCREENS.G
>SYSCALL SYS.ScreenSelectA
ldx #DEVMGR.OPEN
jsr GoDevMouse
bcs *
* jmp .8
lda #2
sta BW
lda #15
sta C
stz C
lda #4
sta X
lda /4
sta X+1
.1 lda #2
lda #0
sta Y
.2 lda Y
lsr
lsr
lsr
clc
adc C
and #$0F
.1 lda #0
sta X
lda /0
sta X+1
>PUSHA
.2 >PUSHB C
>PUSHB Y
>PUSHW X
@ -98,35 +88,31 @@ CS.INIT >LDYA L.DEVNAME.GFX
ldx #DEVMGR.GFX.SETPIXEL
jsr GoDevGFX
inc Y
lda Y
cmp #190
bne .2
dec BW
bne .3
lda #2
sta BW
inc C
lda C
cmp #16
bne .3
stz C
.3 lda X
lda X
clc
adc #4
sta X
bcc .4
bcc .3
inc X+1
.4 sec
sbc #556
.3 lda X
sec
sbc #559
lda X+1
sbc /556
bcc .1
sbc /559
bcc .2
.4 inc Y
lda Y
cmp #192
beq .8
and #$7
bne .1
dec C
bpl .1
lda #15
sta C
bra .1
.8 lda (pPs)
ora #S.PS.F.EVENT Now accept events
@ -193,7 +179,6 @@ pDevMouse .BS 2
X .BS 2
Y .BS 1
C .BS 1
BW .BS 1
MAN
SAVE SBIN/GUI.S
SAVE SBIN/DESKTOP.S
ASM

View File

@ -10,7 +10,6 @@ AUTO 6
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/LIBSTR.I
*--------------------------------------
ZPPTR1 .EQ ZPBIN
ZPPTR2 .EQ ZPBIN+2
@ -35,7 +34,6 @@ CS.START cld
.DA CS.EVENT
.DA CS.QUIT
L.MSG.HELP .DA MSG.HELP
L.MSG.LOADING .DA MSG.LOADING
.DA 0
*--------------------------------------
CS.INIT ldy #S.PS.hARGS
@ -46,11 +44,6 @@ CS.INIT ldy #S.PS.hARGS
bra .8
.1 sta hArgs
>LDYA L.MSG.LOADING
>SYSCALL SYS.PSTROutYA
bcs .9
lda hArgs
>SYSCALL SYS.LoadDrvA
bcs .9
@ -67,7 +60,6 @@ CS.QUIT clc
*--------------------------------------
CS.END
MSG.HELP >PSTRING "Usage: insdrv </path/drv/>file.drv <args>\n"
MSG.LOADING >PSTRING "INSDRV:\n"
hArgs .BS 1
MAN
SAVE SBIN/INSDRV.S

View File

@ -327,7 +327,6 @@ PrintError pha
CmdBuffer.PRINT ldy #0
.1 iny
lda (pData),y
ora #$80
>SYSCALL SYS.COutA
tya
cmp (pData)

View File

@ -107,6 +107,8 @@ S.COutA.RTS rts
* %D : word
* %h : hex byte
* %H : hex word
* %s : PSTRING
* \e : ESC
* \n : CR
*--------------------------------------
S.PSTROutA jsr S.GetMemPtrA
@ -114,18 +116,22 @@ S.PSTROutYA >STYA ZPQuickPtr1
ldy #0
.1 iny
lda (ZPQuickPtr1),y
cmp #'\'
.1 jsr S.PSTROut.Next
bne .12
.8 clc
rts
.12 cmp #'\'
bne .2
tya
cmp (ZPQuickPtr1)
jsr S.PSTROut.Next
beq .8
iny
lda (ZPQuickPtr1),y
cmp #'n'
cmp #'e'
bne .11
lda #27
bra .6
.11 cmp #'n'
bne .6
lda #13
bra .6
@ -133,19 +139,15 @@ S.PSTROutYA >STYA ZPQuickPtr1
.2 cmp #'%'
bne .6
tya
cmp (ZPQuickPtr1)
jsr S.PSTROut.Next
beq .8
iny
lda (ZPQuickPtr1),y
cmp #'d'
bne .3
phy
>PULLA
jsr S.DecOutA
ply
bcc .7
bcc .1
rts
.3 cmp #'D'
@ -154,7 +156,7 @@ S.PSTROutYA >STYA ZPQuickPtr1
>PULLYA
jsr S.DecOutYA
ply
bcc .7
bcc .1
rts
.4 cmp #'h'
@ -163,7 +165,7 @@ S.PSTROutYA >STYA ZPQuickPtr1
>PULLA
jsr S.HexOutA
ply
bcc .7
bcc .1
rts
.5 cmp #'H'
@ -172,10 +174,22 @@ S.PSTROutYA >STYA ZPQuickPtr1
>PULLYA
jsr S.HexOutYA
ply
bcc .7
bcc .1
rts
.51 tax
.51 cmp #'s'
bne .52
jsr S.PSTROutYAS1
bcc .1
rts
.52 cmp #'S'
bne .53
jsr S.PSTROutYAS2
bcc .10
rts
.53 tax
lda #'%'
jsr S.COutA
bcs .9
@ -183,13 +197,36 @@ S.PSTROutYA >STYA ZPQuickPtr1
.6 jsr S.COutA
bcs .9
.10 jmp .1
.9 rts
*--------------------------------------
S.PSTROut.Next tya
eor (ZPQuickPtr1)
beq .8
iny
lda (ZPQuickPtr1),y
.8 rts
*--------------------------------------
S.PSTROutYAS1 phy
>PULLA
jsr S.GetMemPtrA
bra S.PSTROutYAS
.7 tya
cmp (ZPQuickPtr1)
S.PSTROutYAS2 phy
>PULLYA
S.PSTROutYAS >STYA ZPQuickPtr2
ldy #0
.1 iny
lda (ZPQuickPtr2),y
jsr S.COutA
bcs .9
tya
eor (ZPQuickPtr2) do not alter C
bne .1
.8 clc
.9 rts
.9 ply
rts
*--------------------------------------
HEX .BS 2
BCD .BS 3