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 SET
INSDRV CONSOLE.DRV INSDRV CONSOLE.DRV
GETTY CON SBIN/LOGIN GETTY CON SBIN/LOGIN
#INSDRV UTHERNET.DRV 000E3A123456
#TCPIP ETH3
#DHCPCLNT
#INSDRV SSC.DRV 9600 N 8 1 X #INSDRV SSC.DRV 9600 N 8 1 X
#GETTY COM2 SBIN/LOGIN #GETTY COM2 SBIN/LOGIN
#INSDRV PPIC.DRV #INSDRV PPIC.DRV
INSDRV UTHERNET.DRV 000E3A123456
TCPIP ETH3
DHCPCLNT
#TELNETD #TELNETD
#MOUNT TFTP 192.168.1.5:/A2OSX /MNT/A2OSX #MOUNT TFTP 192.168.1.5:/A2OSX /MNT/A2OSX
#MOUNT CIFS 192.168.1.5:/MSSHARE /MNT/MSSHARE #MOUNT CIFS 192.168.1.5:/MSSHARE /MNT/MSSHARE
INSDRV DHGR.DRV #INSDRV DHGR.DRV
INSDRV MOUSE.DRV #INSDRV MOUSE.DRV
GUI #DESKTOP
PS
ECHO *** End A2osX Startup file *** ECHO *** End A2osX Startup file ***
MAN MAN
TEXT A2OSX.STARTUP TEXT A2OSX.STARTUP

View File

@ -7,6 +7,13 @@ AUTO 6
.OP 65C02 .OP 65C02
.OR $2000 .OR $2000
.TF /A2OSX.BOOT/BIN/EDIT .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/MACROS.I
.INB INC/A2OSX.I .INB INC/A2OSX.I
@ -33,6 +40,10 @@ CS.START cld
.DA CS.RUN .DA CS.RUN
.DA CS.DOEVENT .DA CS.DOEVENT
.DA CS.QUIT .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 .DA 0
*-------------------------------------- *--------------------------------------
CS.INIT lda #0 CS.INIT lda #0
@ -55,6 +66,7 @@ CS.INIT lda #0
ldy #S.PS.hARGS ldy #S.PS.hARGS
lda (pPs),y lda (pPs),y
>SYSCALL SYS.PStrCpyA
bra .3 bra .3
.10 ldy #S.PS.hARGS .10 ldy #S.PS.hARGS
@ -72,7 +84,7 @@ CS.INIT lda #0
bcs .9 bcs .9
bra .8 bra .8
.7 >PUSHWI 16 .7 >PUSHWI 2048
>PUSHBI 0 >PUSHBI 0
>SYSCALL SYS.GetMem >SYSCALL SYS.GetMem
bcs .9 bcs .9
@ -96,8 +108,7 @@ CS.INIT lda #0
ldy #bInsert ldy #bInsert
sta (pData),y sta (pData),y
lda #12 jsr InitScreen
jsr COUT
lda (pPs) lda (pPs)
ora #S.PS.F.EVENT Now accept events ora #S.PS.F.EVENT Now accept events
@ -151,20 +162,51 @@ CS.QUIT ldy #hBuffer
lda (pData),y lda (pData),y
>SYSCALL SYS.FreeMemA >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 clc
rts .9 rts
*-------------------------------------- *--------------------------------------
CROUT lda #13 UpdateTopBar ldy #hFileName
*-------------------------------------- lda (pData),y
COUT phx beq .1
phy >SYSCALL SYS.GetMemPtrA
ldx #DEVMGR.COUT bra .2
jsr pDevJmp
ply .1 >LDYA L.MSG.NEWFILE
plx
rts .2 >PUSHYA
>LDYA L.MSG.TOPBAR
>SYSCALL SYS.PSTRoutYA
bcs .9
clc
.9 rts
*-------------------------------------- *--------------------------------------
CS.END 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 .DUMMY
.OR 0 .OR 0

View File

@ -13,9 +13,11 @@ AUTO 6
.INB INC/IO.I .INB INC/IO.I
*-------------------------------------- *--------------------------------------
CURSOR.BLINK.SPEED .EQ 2 CURSOR.BLINK.SPEED .EQ 2
ESCSEQ.MAXLEN .EQ 16
*-------------------------------------- *--------------------------------------
ZPBASL1 .EQ ZPDRV ZPBaseL1 .EQ ZPDRV
ZPBASL2 .EQ ZPDRV+2 ZPBaseL2 .EQ ZPDRV+2
ZPTmpByte .EQ ZPDRV+4
*-------------------------------------- *--------------------------------------
* File Header (16 Bytes) * File Header (16 Bytes)
*-------------------------------------- *--------------------------------------
@ -64,11 +66,18 @@ DRV.CS.START .DA OPEN
.DA GETINFO .DA GETINFO
.DA IRQ .DA IRQ
L.DEVINFO .DA DEVINFO 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 OPEN stz CURON
lda #$80 stz bEscMode
sta INVFLG stz bEscModeCSI
jsr RESET
jsr RESETATTR
jsr HOME jsr HOME
lda #A2osX.SCREENS.C lda #A2osX.SCREENS.C
@ -95,7 +104,52 @@ GETEVENT lda A2osX.TIMER16
sec sec
rts 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 clc
rts rts
*-------------------------------------- *--------------------------------------
@ -112,51 +166,21 @@ IRQ clc
*-------------------------------------- *--------------------------------------
* PRIVATE * PRIVATE
*-------------------------------------- *--------------------------------------
COUT1 pha RESET lda #0
jsr CUROFF sta SCROLLTOP
pla lda #23
cmp #32 sta SCROLLBOT
bcs .80 regular char
cmp #8
bne .2
ldx CH
beq .10
dec CH
bra .12
.10 ldy CV
bne .11
rts rts
*--------------------------------------
.11 lda #79 RESETATTR lda #$80
sta CH sta INVFLG
dec CV
.12 lda #$20
ora INVFLG
ldx CH
ldy CV
jsr SetCharAtXY
rts 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 FSOUT ldx CH
cpx #79 cpx #79
beq CROUT1 beq CROUT1
inc CH inc CH
clc
rts rts
*-------------------------------------- *--------------------------------------
CROUT jsr CLREOL CROUT jsr CLREOL
@ -166,51 +190,7 @@ CROUT1 stz CH
cpy #23 cpy #23
beq SCROLL.UP beq SCROLL.UP
inc CV inc CV
rts clc
*--------------------------------------
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
rts rts
*-------------------------------------- *--------------------------------------
HOME stz CH HOME stz CH
@ -219,9 +199,9 @@ HOME stz CH
ldx #23 ldx #23
.1 lda BASEL,x .1 lda BASEL,x
sta ZPBASL1 sta ZPBaseL1
lda BASEH,x lda BASEH,x
sta ZPBASL1+1 sta ZPBaseL1+1
lda #' ' lda #' '
ora INVFLG ora INVFLG
@ -230,7 +210,7 @@ HOME stz CH
sta SETREADAUX sta SETREADAUX
ldy #39 ldy #39
.2 sta (ZPBASL1),y .2 sta (ZPBaseL1),y
dey dey
bpl .2 bpl .2
@ -238,13 +218,71 @@ HOME stz CH
sta CLRREADAUX sta CLRREADAUX
ldy #39 ldy #39
.3 sta (ZPBASL1),y .3 sta (ZPBaseL1),y
dey dey
bpl .3 bpl .3
dex dex
bpl .1 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 rts
*-------------------------------------- *--------------------------------------
CUROFF lda CURON CUROFF lda CURON
@ -264,9 +302,10 @@ CURBLNK1 lda CURON
ldy CV ldy CV
jsr GetCharAtXY jsr GetCharAtXY
sta CURCHAR sta CURCHAR
and #$80
ldx CH ldx CH
ldy CV ldy CV
lda #$20 eor #" "
jsr SetCharAtXY jsr SetCharAtXY
bra CUREXIT bra CUREXIT
@ -280,7 +319,13 @@ CUREXIT lda CURON
sta CURON sta CURON
CUREXIT.RTS rts CUREXIT.RTS rts
*-------------------------------------- *--------------------------------------
SetCharAtXY pha SetCharAtXY cmp #$40
bcc .10
cmp #$5F
bcs .10
and #$3F
.10 pha
txa txa
lsr lsr
@ -289,12 +334,12 @@ SetCharAtXY pha
.1 clc .1 clc
adc BASEL,y adc BASEL,y
sta ZPBASL1 sta ZPBaseL1
lda BASEH,y lda BASEH,y
sta ZPBASL1+1 sta ZPBaseL1+1
pla pla
sta (ZPBASL1) sta (ZPBaseL1)
sta CLRWRITEAUX sta CLRWRITEAUX
rts rts
*-------------------------------------- *--------------------------------------
@ -306,22 +351,201 @@ GetCharAtXY txa
.1 clc .1 clc
adc BASEL,y adc BASEL,y
sta ZPBASL1 sta ZPBaseL1
lda BASEH,y lda BASEH,y
sta ZPBASL1+1 sta ZPBaseL1+1
lda (ZPBASL1) lda (ZPBaseL1)
sta CLRREADAUX sta CLRREADAUX
rts 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 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 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 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 CH .BS 1
CV .BS 1 CV .BS 1
INVFLG .BS 1 INVFLG .BS 1
SCROLLTOP .BS 1
SCROLLBOT .BS 1
CURON .BS 1 CURON .BS 1
CURCHAR .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 DEVINFO .DA #S.DEVINFO.TYPE.CHAR
.DA #80 .DA #80
.DA #24 .DA #24

View File

@ -83,8 +83,8 @@ OPEN lda #A2osX.SCREENS.G
lda BASEH,x lda BASEH,x
sta ZPBASE+1 sta ZPBASE+1
lda #$55 * lda #$55
* lda #$00 lda #$00
ldy #39 ldy #39
sta SETWRITEAUX sta SETWRITEAUX
@ -92,8 +92,8 @@ OPEN lda #A2osX.SCREENS.G
dey dey
bpl .82 bpl .82
lda #$2A * lda #$2A
* lda #$00 lda #$00
ldy #39 ldy #39
sta CLRWRITEAUX sta CLRWRITEAUX
@ -138,7 +138,9 @@ GETINFO >LDYA L.DEVINFO
* PULLB = Y * PULLB = Y
* PULLB = Color (if not xor) * PULLB = Color (if not xor)
*-------------------------------------- *--------------------------------------
SETPIXEL >PULLA Pull Mode SETPIXEL sta SET80STORE
>PULLA Pull Mode
and #$FF and #$FF
bpl SETPIXEL.1 bpl SETPIXEL.1
@ -161,8 +163,8 @@ SETPIXEL.XOR >PULLYA Y=X.LO,A=X.HI
.3 lsr .3 lsr
tay tay
bcs .4 odd=main ram bcs .4 odd=main ram
sta SETWRITEAUX sta SETPAGE2
sta SETREADAUX
.4 >PULLA Pull Y .4 >PULLA Pull Y
tax tax
lda BASEL,x setup line Base Ptr lda BASEL,x setup line Base Ptr
@ -174,17 +176,18 @@ SETPIXEL.XOR >PULLYA Y=X.LO,A=X.HI
eor Mono.Masks,x eor Mono.Masks,x
sta (ZPBASE),y sta (ZPBASE),y
sta CLRWRITEAUX sta CLR80STORE
sta CLRREADAUX
rts rts
*-------------------------------------- *--------------------------------------
SETPIXEL.1 lsr SETPIXEL.1 lsr
bcc SETPIXEL.COLOR bcc SETPIXEL.COLOR
>PULLW CX
>PULLB CY
>PULLYA Y=X.LO,A=X.HI ldy CX
lsr if 256 =< x < 511 lsr CX+1 if 256 =< x < 511
bcs .1 bcs .1
lsr lsr CX+1
bcs .2 if 512 < x bcs .2 if 512 < x
lda DIV7.0,y lda DIV7.0,y
ldx MOD7.0,y ldx MOD7.0,y
@ -198,82 +201,72 @@ SETPIXEL.1 lsr
ldx MOD7.512,y ldx MOD7.512,y
.3 lsr .3 lsr
tay bcc .4 odd=main ram
bcs .4 odd=main ram sta CLRPAGE2
sta SETWRITEAUX clc
sta SETREADAUX bra .41
.4 phx .4 sta SETPAGE2
>PULLA Pull Y
tax .41 ldy CY
lda BASEL,x setup line Base Ptr adc BASEL,y setup line Base Ptr
sta ZPBASE sta ZPBASE
lda BASEH,x lda BASEH,y
sta ZPBASE+1 sta ZPBASE+1
plx
>PULLA Pull Color >PULLA Pull Color
lsr lsr
bcs .6 set white pixel bcs .6 set white pixel
lda (ZPBASE),y lda (ZPBASE)
and Mono.NMasks,x includes And $7F for mono and Mono.NMasks,x includes And $7F for mono
sta (ZPBASE),y sta (ZPBASE)
sta CLRWRITEAUX sta CLR80STORE
sta CLRREADAUX
rts rts
.6 lda (ZPBASE),y .6 lda (ZPBASE)
and #$7F switch back this byte to mono and #$7F switch back this byte to mono
ora Mono.Masks,x ora Mono.Masks,x
sta (ZPBASE),y sta (ZPBASE)
sta CLRWRITEAUX sta CLR80STORE
sta CLRREADAUX
rts rts
*-------------------------------------- *--------------------------------------
SETPIXEL.COLOR >PULLA Get X.LO... SETPIXEL.COLOR >PULLW CX Get X.LO...
pha >PULLB CY
>PULLB GBYTE Get X.HI in temp location
pla
lsr GBYTE divide by 4 (range 0->139)
ror
lsr GBYTE
ror
tay
>PULLA Pull Y lda CX
tax lsr CX+1 divide by 4
lda BASEL,x setup line Base Ptr ror
sta ZPBASE 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 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 asl times 4 to compute index in MASK tables
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 asl
tax set in X for Masks,NMasks tax set in X for Masks,NMasks
>PULLA get COLOR >PULLA get COLOR
asl asl times 4 to compute index in PIXELS table
asl asl
tay tay
lda Color.Masks,x lda Color.Masks,x bits in 1st byte to light?
beq .1 beq .1
and Color.Pixels,y apply color and Color.Pixels,y apply color
sta GBYTE sta GBYTE
sta SETWRITEAUX sta SETPAGE2
sta SETREADAUX
lda (ZPBASE) lda (ZPBASE)
and Color.NMasks,x reset existing pixel, and Color.NMasks,x reset existing pixel,
@ -288,8 +281,7 @@ SETPIXEL.COLOR >PULLA Get X.LO...
and Color.Pixels,y apply color and Color.Pixels,y apply color
sta GBYTE sta GBYTE
sta CLRWRITEAUX sta CLRPAGE2
sta CLRREADAUX
lda (ZPBASE) lda (ZPBASE)
and Color.NMasks,x reset existing pixel, and Color.NMasks,x reset existing pixel,
@ -305,8 +297,7 @@ SETPIXEL.COLOR >PULLA Get X.LO...
and Color.Pixels,y apply color and Color.Pixels,y apply color
sta GBYTE sta GBYTE
sta SETWRITEAUX sta SETPAGE2
sta SETREADAUX
lda (ZPBASE) lda (ZPBASE)
and Color.NMasks,x reset existing pixel, and Color.NMasks,x reset existing pixel,
@ -321,27 +312,37 @@ SETPIXEL.COLOR >PULLA Get X.LO...
and Color.Pixels,y apply color and Color.Pixels,y apply color
sta GBYTE sta GBYTE
sta SETWRITEAUX sta CLRPAGE2
sta SETREADAUX
lda (ZPBASE) lda (ZPBASE)
and Color.NMasks,x reset existing pixel, and Color.NMasks,x reset existing pixel,
ora GBYTE ora GBYTE
sta (ZPBASE) sta (ZPBASE)
.8 sta CLRWRITEAUX .8 sta CLR80STORE
sta CLRREADAUX
rts 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 BITBLT
rts rts
@ -365,6 +366,7 @@ Mono.Masks .DA #%00000001
.DA #%01000000 .DA #%01000000
*-------------------------------------- *--------------------------------------
* bits to "and" to reset color of pixel (0 means nothing to do) * bits to "and" to reset color of pixel (0 means nothing to do)
* 4 bytes * 7 mods
*-------------------------------------- *--------------------------------------
* c1110000 c3322221 c5444433 c6666555 * c1110000 c3322221 c5444433 c6666555
Color.NMasks .DA #%01110000,#%00000000,#%00000000,#%00000000 Color.NMasks .DA #%01110000,#%00000000,#%00000000,#%00000000
@ -392,6 +394,7 @@ Color.Masks .DA #%10001111,#%00000000,#%00000000,#%00000000
*-------------------------------------- *--------------------------------------
* c1110000 c3322221 c5444433 c6666555 * c1110000 c3322221 c5444433 c6666555
Color.Pixels .DA #%00000000,#%00000000,#%00000000,#%00000000 black (color bit disable) 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 #%10010001,#%10100010,#%11000100,#%10001000 dark blue
.DA #%10100010,#%11000100,#%10001000,#%10010001 dark green .DA #%10100010,#%11000100,#%10001000,#%10010001 dark green
.DA #%10110011,#%11100110,#%11001100,#%10011001 medium blue .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 #%11001100,#%10011001,#%10110011,#%11100110 orange
.DA #%11011101,#%10111011,#%11110111,#%11101110 pink .DA #%11011101,#%10111011,#%11110111,#%11101110 pink
.DA #%11101110,#%11011101,#%10111011,#%11110111 yellow .DA #%11101110,#%11011101,#%10111011,#%11110111 yellow
.DA #%01111111,#%01111111,#%01111111,#%01111111 white (color bit disable)
*-------------------------------------- *--------------------------------------
DIV7.0 .HS 0000000000000001010101010101 DIV7.0 .HS 0000000000000001010101010101
.HS 0202020202020203030303030303 .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
.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 GBYTE .BS 1
*-------------------------------------- *--------------------------------------
DEVINFO .DA #S.DEVINFO.TYPE.GFX type of DEVINFO STRUCT DEVINFO .DA #S.DEVINFO.TYPE.GFX type of DEVINFO STRUCT

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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