GUI:Work in progress

This commit is contained in:
Rémy GIBERT 2016-07-22 16:11:13 +02:00
parent d2cacb006a
commit 44dd59a5ab
3 changed files with 373 additions and 269 deletions

View File

@ -14,9 +14,9 @@ AUTO 6
.INB INC/LIBGFX.I .INB INC/LIBGFX.I
*-------------------------------------- *--------------------------------------
ZPBase .EQ ZPDRV ZPBase .EQ ZPDRV
ZPBitBlt .EQ ZPDRV+2 ZPShiftLo .EQ ZPDRV+2
ZPShiftLo .EQ ZPDRV+4 ZPShiftHi .EQ ZPDRV+4
ZPShiftHi .EQ ZPDRV+6 ZPCtrlBlk .EQ ZPDRV+8 limited to 8 bytes for now...have to modify kernel
*-------------------------------------- *--------------------------------------
* File Header (16 Bytes) * File Header (16 Bytes)
*-------------------------------------- *--------------------------------------
@ -130,7 +130,7 @@ MSG.DETECT >PSTRING "\nApple IIe/IIc DHGR Driver.\n"
DEV.HEADER cld DEV.HEADER cld
jmp (DRV.CS.START,x) jmp (DRV.CS.START,x)
.HS 00 DevID .HS 00 DevID
.DA #S.DEV.F.EVENT .DA #0 No Flag
>PSTRING "GFX" NAME >PSTRING "GFX" NAME
.HS 00 NAME must Be 5 bytes long .HS 00 NAME must Be 5 bytes long
.HS 00 .HS 00
@ -177,12 +177,18 @@ OPEN ldy #S.DEV.ID
inc inc
sta DIV7.hi+2 sta DIV7.hi+2
lda L.MOD7.0+1 ldy #0
sta MOD7.hi ldx #0
inc
sta MOD7.hi+1 .1 lda L.MOD7.0,y
inc sta MOD7.lo,x
sta MOD7.hi+2 iny
lda L.MOD7.0,y
sta MOD7.hi,x
iny
inx
cpx #3
bne .1
ldx #7 ldx #7
lda L.Shift0.Lo+1 lda L.Shift0.Lo+1
@ -201,19 +207,7 @@ OPEN ldy #S.DEV.ID
.8 clc .8 clc
rts rts
*-------------------------------------- *--------------------------------------
GETEVENT lda A2osX.ASCREEN GETEVENT
cmp #3
bne .9
>SYSCALL SYS.GetKeyboardEvent
bcs .9
rts
.9 lda #0 Error = no event
sec
rts
*--------------------------------------
COUT COUT
IRQ sec IRQ sec
rts rts
@ -244,119 +238,91 @@ SELECT sta CLRTEXT
rts rts
*-------------------------------------- *--------------------------------------
* SETPIXEL * SETPIXEL
* PULLB = Mode * In : YA = Ptr to CtrlBlk :
* 00000001=B/W * 0 : X
* 00000010=16 colors * 2 : Y
* 1000000=xor (mono on 1 bit) * 4 : Mode
* PULLW = X * 00000000=xor
* PULLB = Y * 00000001=b/w (1 bit/pixel)
* PULLB = Color (if not xor) * 00000100=16 colors (4 bits/pixel)
* 00001000=256 colors (8 bits/pixel)
* 5 : Color
*-------------------------------------- *--------------------------------------
SETPIXEL sta SET80STORE SETPIXEL >STYA ZPBase
ldy #5
.1 lda (ZPBase),y
sta ZPCtrlBlk,y
dey
bpl .1
>PULLA Pull Mode sta SET80STORE
and #$FF
bpl SETPIXEL.1
SETPIXEL.XOR >PULLAX A=X.LO,X=X.HI lda ZPCtrlBlk+4
tay bit #%00000100
bne .7
ldx ZPCtrlBlk+1 X.HI
lda DIV7.hi,x lda DIV7.hi,x
sta .1+2
lda MOD7.hi,x
sta .2+2 sta .2+2
.1 lda DIV7.0,y A=Colx2 lda MOD7.lo,x
eor #1 sta .4+1
lda MOD7.hi,x
sta .4+2
lsr A=Col, CS=MMem, CC=XMem ldx ZPCtrlBlk X.LO
pha Save Col .2 lda DIV7.0,x A=Col*2+AuxBit
lsr .3+1 reset CLRPAGE2 address
lsr CS=Aux
rol .3+1 if CS, -> SETPAGE2
lda #CLRPAGE2>1
asl
sta .3+1
.3 sta CLRPAGE2 .3 sta CLRPAGE2
>PULLA Pull Y ldy ZPCtrlBlk+2 Y.LO
tax adc BASEL,y setup line Base Ptr (A=Col)
lda BASEL,x setup line Base Ptr
sta ZPBase sta ZPBase
lda BASEH,x lda BASEH,y
sta ZPBase+1 sta ZPBase+1
.2 ldx MOD7.0,y Y=X.LO .4 ldy MOD7.0,x x = X.LO
ply get back Col dec ZPCtrlBlk+4 get mode
lda (ZPBase),y bne .5
eor Mono.Masks,x x = mod 7
sta (ZPBase),y lda (ZPBase) Mode=0, XOR
eor Mono.Masks,y y = mod 7
sta (ZPBase)
sta CLR80STORE sta CLR80STORE
rts rts
*--------------------------------------
SETPIXEL.1 lsr
bcc SETPIXEL.COLOR
>PULLAX A=X.LO,X=X.HI .5 lda (ZPBase)
tay ldx ZPCtrlBlk+5 mode=1, get color
bne .6
lda DIV7.hi,x and Mono.NMasks,y includes And $7F for mono
sta .1+2 sta (ZPBase)
lda MOD7.hi,x
sta .2+2
.1 lda DIV7.0,y A=Colx2
eor #1
lsr A=Col, CS=MMem, CC=XMem
pha Save Col
lda #CLRPAGE2>1
asl
sta .3+1
.3 sta CLRPAGE2
>PULLA Pull Y
tax
lda BASEL,x setup line Base Ptr
sta ZPBase
lda BASEH,x
sta ZPBase+1
.2 ldx MOD7.0,y Y=X.LO
ply get back Col
>PULLA Pull Color
lsr
lda (ZPBase),y
bcs .6 set white pixel
and Mono.NMasks,x includes And $7F for mono
sta (ZPBase),y
sta CLR80STORE sta CLR80STORE
rts rts
.6 and #$7F switch back this byte to mono .6 and #$7F switch back this byte to mono
ora Mono.Masks,x ora Mono.Masks,y
sta (ZPBase),y sta (ZPBase)
sta CLR80STORE sta CLR80STORE
rts rts
*--------------------------------------
SETPIXEL.COLOR >PULLW CX Get X.LO...
>PULLB CY
lda CX .7 lda ZPCtrlBlk X.LO
lsr CX+1 divide by 4 lsr ZPCtrlBlk+1 divide by 4
ror ror
lsr CX+1 lsr ZPCtrlBlk+1
ror ror
tay Y=CX/4 (range 0->139) tay Y=CX/4 (range 0->139)
lda DIV7.0,y A=CX/4/7 (range 0->19) lda DIV7.0,y A=CX/4/7 (range 0->19)
asl times 2 (range 0->38) asl times 2 (range 0->38)
ldx CY ldx ZPCtrlBlk+2
adc BASEL,x setup line Base Ptr (cc by asl) adc BASEL,x setup line Base Ptr (cc by asl)
sta ZPBase ZPBase now point to first of... sta ZPBase ZPBase now point to first of...
lda BASEH,x lda BASEH,x
@ -368,14 +334,14 @@ SETPIXEL.COLOR >PULLW CX Get X.LO...
asl asl
tax set in X for Masks,NMasks tax set in X for Masks,NMasks
>PULLA get COLOR lda ZPCtrlBlk+5 get COLOR
asl times 4 to compute index in PIXELS table asl times 4 to compute index in PIXELS table
asl asl
tay tay
lda Color.Masks,x bits in 1st byte to light? lda Color.Masks,x bits in 1st byte to light?
beq .1 beq .10
and Color.Pixels,y apply color and Color.Pixels,y apply color
sta GBYTE sta GBYTE
@ -386,11 +352,11 @@ SETPIXEL.COLOR >PULLW CX Get X.LO...
ora GBYTE ora GBYTE
sta (ZPBase) sta (ZPBase)
.1 inx .10 inx
iny iny
lda Color.Masks,x lda Color.Masks,x
beq .2 beq .11
and Color.Pixels,y apply color and Color.Pixels,y apply color
sta GBYTE sta GBYTE
@ -401,12 +367,12 @@ SETPIXEL.COLOR >PULLW CX Get X.LO...
ora GBYTE ora GBYTE
sta (ZPBase) sta (ZPBase)
.2 inc ZPBase .11 inc ZPBase
inx inx
iny iny
lda Color.Masks,x lda Color.Masks,x
beq .3 beq .12
and Color.Pixels,y apply color and Color.Pixels,y apply color
sta GBYTE sta GBYTE
@ -417,11 +383,11 @@ SETPIXEL.COLOR >PULLW CX Get X.LO...
ora GBYTE ora GBYTE
sta (ZPBase) sta (ZPBase)
.3 inx .12 inx
iny iny
lda Color.Masks,x lda Color.Masks,x
beq .8 beq .13
and Color.Pixels,y apply color and Color.Pixels,y apply color
sta GBYTE sta GBYTE
@ -432,7 +398,7 @@ SETPIXEL.COLOR >PULLW CX Get X.LO...
ora GBYTE ora GBYTE
sta (ZPBase) sta (ZPBase)
.8 sta CLR80STORE .13 sta CLR80STORE
rts rts
*-------------------------------------- *--------------------------------------
GETPIXEL rts GETPIXEL rts
@ -444,7 +410,7 @@ VLINE rts
FILLREC rts FILLREC rts
*-------------------------------------- *--------------------------------------
* BitBlt * BitBlt
* In : YA = Ptr to Job : * In : YA = Ptr to CtrlBlk :
* 0 : Operation * 0 : Operation
* %00000001 : Save * %00000001 : Save
* %00000010 : Replace * %00000010 : Replace
@ -460,8 +426,8 @@ FILLREC rts
* 14 : DestY * 14 : DestY
* 16 : BM Struct * 16 : BM Struct
*-------------------------------------- *--------------------------------------
BITBLT >STYA ZPBitBlt BITBLT >STYA ZPCtrlBlk
lda (ZPBitBlt) lda (ZPCtrlBlk)
clc clc
rts rts
*-------------------------------------- *--------------------------------------
@ -638,6 +604,7 @@ Shift6.hi .BS 128
.INB DRV/DHGR.DRV.T .INB DRV/DHGR.DRV.T
*-------------------------------------- *--------------------------------------
DIV7.hi .BS 3 DIV7.hi .BS 3
MOD7.lo .BS 3
MOD7.hi .BS 3 MOD7.hi .BS 3
Shiftlo.hi .BS 7 Shiftlo.hi .BS 7
Shifthi.hi .BS 7 Shifthi.hi .BS 7

View File

@ -66,50 +66,54 @@ Color.Pixels .DA #%00000000,#%00000000,#%00000000,#%00000000 black (color bit di
.DA #%11011101,#%10111011,#%11110111,#%11101110 pink .DA #%11011101,#%10111011,#%11110111,#%11101110 pink
.DA #%11101110,#%11011101,#%10111011,#%11110111 yellow .DA #%11101110,#%11011101,#%10111011,#%11110111 yellow
*-------------------------------------- *--------------------------------------
DIV7.0 .HS 0000000000000001010101010101 * COL*2+AUX Bit
.HS 0202020202020203030303030303
.HS 0404040404040405050505050505
.HS 0606060606060607070707070707
.HS 0808080808080809090909090909
.HS 0A0A0A0A0A0A0A0B0B0B0B0B0B0B
.HS 0C0C0C0C0C0C0C0D0D0D0D0D0D0D
.HS 0E0E0E0E0E0E0E0F0F0F0F0F0F0F
.HS 1010101010101011111111111111
.HS 1212121212121213131313131313
.HS 1414141414141415151515151515
.HS 1616161616161617171717171717
.HS 1818181818181819191919191919
.HS 1A1A1A1A1A1A1A1B1B1B1B1B1B1B
.HS 1C1C1C1C1C1C1C1D1D1D1D1D1D1D
.HS 1E1E1E1E1E1E1E1F1F1F1F1F1F1F
.HS 2020202020202021212121212121
.HS 2222222222222223232323232323
.HS 24242424
DIV7.256 .HS 24242425252525252525
.HS 2626262626262627272727272727
.HS 2828282828282829292929292929
.HS 2A2A2A2A2A2A2A2B2B2B2B2B2B2B
.HS 2C2C2C2C2C2C2C2D2D2D2D2D2D2D
.HS 2E2E2E2E2E2E2E2F2F2F2F2F2F2F
.HS 3030303030303031313131313131
.HS 3232323232323233333333333333
.HS 3434343434343435353535353535
.HS 3636363636363637373737373737
.HS 3838383838383839393939393939
.HS 3A3A3A3A3A3A3A3B3B3B3B3B3B3B
.HS 3C3C3C3C3C3C3C3D3D3D3D3D3D3D
.HS 3E3E3E3E3E3E3E3F3F3F3F3F3F3F
.HS 4040404040404041414141414141
.HS 4242424242424243434343434343
.HS 4444444444444445454545454545
.HS 4646464646464647474747474747
.HS 4848484848484849
DIV7.512 .HS 494949494949
.HS 4A4A4A4A4A4A4A4B4B4B4B4B4B4B
.HS 4C4C4C4C4C4C4C4D4D4D4D4D4D4D
.HS 4E4E4E4E4E4E4E4F4F4F4F4F4F4F
*-------------------------------------- *--------------------------------------
MOD7.0 .HS 0001020304050600010203040506 DIV7.0 .HS 0101010101010100000000000000
.HS 0303030303030302020202020202
.HS 0505050505050504040404040404
.HS 0707070707070706060606060606
.HS 0909090909090908080808080808
.HS 0B0B0B0B0B0B0B0A0A0A0A0A0A0A
.HS 0D0D0D0D0D0D0D0C0C0C0C0C0C0C
.HS 0F0F0F0F0F0F0F0E0E0E0E0E0E0E
.HS 1111111111111110101010101010
.HS 1313131313131312121212121212
.HS 1515151515151514141414141414
.HS 1717171717171716161616161616
.HS 1919191919191918181818181818
.HS 1B1B1B1B1B1B1B1A1A1A1A1A1A1A
.HS 1D1D1D1D1D1D1D1C1C1C1C1C1C1C
.HS 1F1F1F1F1F1F1F1E1E1E1E1E1E1E
.HS 2121212121212120202020202020
.HS 2323232323232322222222222222
.HS 25252525
DIV7.256 .HS 25252524242424242424
.HS 2727272727272726262626262626
.HS 2929292929292928282828282828
.HS 2B2B2B2B2B2B2B2A2A2A2A2A2A2A
.HS 2D2D2D2D2D2D2D2C2C2C2C2C2C2C
.HS 2F2F2F2F2F2F2F2E2E2E2E2E2E2E
.HS 3131313131313130303030303030
.HS 3333333333333332323232323232
.HS 3535353535353534343434343434
.HS 3737373737373736363636363636
.HS 3939393939393938383838383838
.HS 3B3B3B3B3B3B3B3A3A3A3A3A3A3A
.HS 3D3D3D3D3D3D3D3C3C3C3C3C3C3C
.HS 3F3F3F3F3F3F3F3E3E3E3E3E3E3E
.HS 4141414141414140404040404040
.HS 4343434343434342424242424242
.HS 4545454545454544444444444444
.HS 4747474747474746464646464646
.HS 4949494949494948
DIV7.512 .HS 484848484848
.HS 4B4B4B4B4B4B4B4A4A4A4A4A4A4A
.HS 4D4D4D4D4D4D4D4C4C4C4C4C4C4C
.HS 4F4F4F4F4F4F4F4E4E4E4E4E4E4E
*--------------------------------------
MOD7.0 .HS 00
MOD7.512 .HS 010203
MOD7.256 .HS 040506
.HS 0001020304050600010203040506 .HS 0001020304050600010203040506
.HS 0001020304050600010203040506 .HS 0001020304050600010203040506
.HS 0001020304050600010203040506 .HS 0001020304050600010203040506
@ -125,32 +129,10 @@ MOD7.0 .HS 0001020304050600010203040506
.HS 0001020304050600010203040506 .HS 0001020304050600010203040506
.HS 0001020304050600010203040506 .HS 0001020304050600010203040506
.HS 0001020304050600010203040506 .HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 00010203
MOD7.256 .HS 04050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600010203040506
.HS 0001020304050600
MOD7.512 .HS 010203040506
.HS 0001020304050600010203040506 .HS 0001020304050600010203040506
.HS 0001020304050600010203040506 .HS 0001020304050600010203040506
.HS 0001020304050600010203040506 .HS 0001020304050600010203040506
.HS 00
*-------------------------------------- *--------------------------------------
BASEL .HS 00.00.00.00.00.00.00.00 BASEL .HS 00.00.00.00.00.00.00.00
.HS 80.80.80.80.80.80.80.80 .HS 80.80.80.80.80.80.80.80

View File

@ -34,6 +34,8 @@ L.LIBGFX .DA LIBGFX
L.DEVNAME.GFX .DA DEVNAME.GFX L.DEVNAME.GFX .DA DEVNAME.GFX
L.DEVNAME.MOUSE .DA DEVNAME.MOUSE L.DEVNAME.MOUSE .DA DEVNAME.MOUSE
L.MSG.INIT .DA MSG.INIT L.MSG.INIT .DA MSG.INIT
L.SetPixel.X .DA SetPixel.X
L.DrawLine.X1 .DA DrawLine.X1
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
CS.INIT >LDYA L.MSG.INIT CS.INIT >LDYA L.MSG.INIT
@ -49,7 +51,17 @@ CS.INIT >LDYA L.MSG.INIT
rts rts
.10 stx hDevGFX .10 stx hDevGFX
ldx pDev
phx
ldx pDev+1
phx
>STYA pDevGFX >STYA pDevGFX
>STYA pDev
ldx #DEVMGR.OPEN
jsr GoDevGFX
.11 >LDYA L.DEVNAME.MOUSE .11 >LDYA L.DEVNAME.MOUSE
>SYSCALL SYS.GetDevByNameYA >SYSCALL SYS.GetDevByNameYA
@ -59,134 +71,270 @@ CS.INIT >LDYA L.MSG.INIT
lda DEVNAME.MOUSE+4 lda DEVNAME.MOUSE+4
cmp #'8' cmp #'8'
bne .11 bne .11
sec beq .21 No mouse found, skip mouse init
rts
.20 stx hDevMouse .20 stx hDevMouse
>STYA pDevMouse >STYA pDevMouse
>STYA pDev
ldx #DEVMGR.OPEN ldx #DEVMGR.OPEN
jsr GoDevMouse jsr GoDevMouse
lda pDev .21 pla
pha
lda pDev+1
pha
lda pDevGFX
sta pDev
lda pDevGFX+1
sta pDev+1
ldx #DEVMGR.OPEN
jsr GoDevGFX
pla
sta pDev+1 sta pDev+1
pla pla
sta pDev sta pDev
lda hDevGFX lda hDevGFX
>LIBCALL hLibGFX,LIBGFX.InitDevA >LIBCALL hLibGFX,LIBGFX.InitGFXA
* jmp .8 lda (pPs)
lda #15
sta C
lda #0
sta Y
.1 lda #0
sta X
lda /0
sta X+1
.2 >PUSHB C
>PUSHB Y
>PUSHW X
>PUSHBI 2 Mode:1=B/W,2=16 colors,...,128=XOR
ldx #DEVMGR.GFX.SETPIXEL
jsr GoDevGFX
lda X
clc
adc #4
sta X
bcc .3
inc X+1
.3 lda X
sec
sbc #559
lda X+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 ora #S.PS.F.EVENT Now accept events
sta (pPs) sta (pPs)
jsr Destop.Paint
clc clc
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN clc CS.RUN clc
rts rts
*-------------------------------------- *--------------------------------------
CS.DOEVENT ldy #S.EVT.hDEV CS.DOEVENT lda hDevMouse Mouse is active ?
lda (pEvent),y beq .1 go check KB
cmp hDevMouse ldy #S.EVT.hDEV
bne .99 cmp (pEvent),y Event coming from Mouse ?
bne .1
lda A2osX.ASCREEN GUI screen active ?
cmp #3
bne .98 no, discard mouse event & exit
ldy #S.EVT.DATALO ldy #S.EVT.DATALO
lda (pEvent),y lda (pEvent),y
and #4 mouse move and #4 mouse move
beq .98 beq .98
>PUSHBI 15 COLOR
ldy #S.EVT.DATAW2 ldy #S.EVT.DATAW2
lda (pEvent),y lda (pEvent),y
>PUSHA Y sta SetPixel.Y
dey dey
lda (pEvent),y X.HI lda (pEvent),y X.HI
>PUSHA sta SetPixel.X+1
dey dey
lda (pEvent),y lda (pEvent),y X.LO
>PUSHA X.LO sta SetPixel.X
>PUSHBI 128 Mode:1=B/W,2=16 colors,...,128=XOR lda #4
sta SetPixel.Mode
lda #15
sta SetPixel.Color
>LDYA L.SetPixel.X
ldx #DEVMGR.GFX.SETPIXEL ldx #DEVMGR.GFX.SETPIXEL
jsr GoDevGFX jsr GoDevGFX
.98 clc .98 clc
rts rts
.1 lda (pEvent)
cmp #S.EVT.F.KEY
bne .99
ldy #S.EVT.DATAHI
lda (pEvent),y
bne .99 Open Apple ?
lda A2osX.ASCREEN
cmp #3
bne .98
jsr Destop.Paint
clc
rts
.99 sec .99 sec
rts rts
*-------------------------------------- *--------------------------------------
CS.QUIT clc CS.QUIT clc
rts rts
*-------------------------------------- *--------------------------------------
Destop.Paint lda #4
sta SetPixel.Mode
lda #0
sta SetPixel.Color
lda #0
sta SetPixel.Y
.1 lda #0
sta SetPixel.X
lda /0
sta SetPixel.X+1
.2 >LDYA L.SetPixel.X
ldx #DEVMGR.GFX.SETPIXEL
jsr GoDevGFX
lda SetPixel.X
clc
adc #4
sta SetPixel.X
bcc .3
inc SetPixel.X+1
.3 lda SetPixel.X
cmp #279
lda SetPixel.X+1
sbc /279
bcc .2
inc SetPixel.Y
lda SetPixel.Y
cmp #192
beq .8
and #$7
bne .1
inc SetPixel.Color
lda SetPixel.Color
cmp #16
bne .1
.8 rts
*--------------------------------------
* Midpoint algorithm
{
dx=x2-x1;
if (dx=0) => VLINE;
if(dx<0)
{
swap(&x1,&x2);
swap(&y1,&y2);
dx=-dx;
}
dy=y2-y1;
if (dy=0) => HLINE;
if (dy<0)
{
incY=-1;
dy=-dy;
}
else
{
incY=1;
}
if(dy>dx)
{
incE=2*dx;
d=incE-dy;
incNE=2*(dx-dy);
while(y1<y2)
{
if(d>0)
{
d=d+incNE;
x1=x1+incY;
}
else
d=d+incE;
y1++;
putpixel(x1,y1,COLOR);
}
}
else
{
incE=2*dy;
d=incE-dx;
incNE=2*(dy-dx);
while(x1<x2)
{
if(d>0)
{
d=d+incNE;
y1=y1+incY;
}
else
d=d+incE;
x1++;
putpixel(x1,y1,COLOR);
}
}
*--------------------------------------
DrawLine >STYA ZPBase
ldy #9
.1 lda (ZPBase),y
sta ZPCtrlBlk,y
dey
bpl .1
lda ZPCtrlBlk+4 X2.LO
sec
sbc ZPCtrlBlk X1.LO
sta DrawLine.DX
lda ZPCtrlBlk+5 X2.HI
sbc ZPCtrlBlk+1 X1.HI
sta DrawLine.DX+1
ora DrawLine.DX DX=0?
beq DrawLineV yes, call DRV.VLINE
bcs .2 is CS, X1<X2, no swap,no ABS
lda ZPCtrlBlk SWAP X1,X2
ldx ZPCtrlBlk+4
sta ZPCtrlBlk+4
stx ZPCtrlBlk
lda ZPCtrlBlk+1
ldx ZPCtrlBlk+5
sta ZPCtrlBlk+5
stx ZPCtrlBlk+1
lda ZPCtrlBlk+2 SWAP Y1,Y2
ldx ZPCtrlBlk+6
sta ZPCtrlBlk+6
stx ZPCtrlBlk+2
lda ZPCtrlBlk+3
ldx ZPCtrlBlk+7
sta ZPCtrlBlk+7
stx ZPCtrlBlk+3
lda #0 DX=-DX
sec
sbc DrawLine.DX
sta DrawLine.DX
lda #0
sbc DrawLine.DX+1
sta DrawLine.DX+1
.2 lda ZPCtrlBlk+6 Y2.LO
sec
sbc ZPCtrlBlk+2 Y1.LO
sta DrawLine.DY
lda ZPCtrlBlk+7 Y2.HI
sbc ZPCtrlBlk+3 Y1.HI
sta DrawLine.DY+1
ora DrawLine.DY DY=0?
beq DrawLineH yes, call DRV.HLINE
bcs .3 is CS, Y1<Y2
.3
*--------------------------------------
GoDevGFX jmp (pDevGFX) GoDevGFX jmp (pDevGFX)
GoDevMouse jmp (pDevMouse) GoDevMouse jmp (pDevMouse)
*-------------------------------------- *--------------------------------------
@ -200,9 +348,16 @@ hDevGFX .BS 1
pDevGFX .BS 2 pDevGFX .BS 2
hDevMouse .BS 1 hDevMouse .BS 1
pDevMouse .BS 2 pDevMouse .BS 2
X .BS 2 SetPixel.X .BS 2
Y .BS 1 SetPixel.Y .BS 2
C .BS 1 SetPixel.Mode .BS 1
SetPixel.Color .BS 1
DrawLine.X1 .BS 2
DrawLine.Y1 .BS 2
DrawLine.X2 .BS 2
DrawLine.Y2 .BS 2
DrawLine.Mode .BS 1
DrawLine.Color .BS 1
MAN MAN
SAVE SBIN/DESKTOP.S SAVE SBIN/DESKTOP.S
ASM ASM