mirror of
https://github.com/A2osX/A2osX.git
synced 2024-12-27 18:30:51 +00:00
GUI:Work in progress
This commit is contained in:
parent
d2cacb006a
commit
44dd59a5ab
@ -14,9 +14,9 @@ AUTO 6
|
||||
.INB INC/LIBGFX.I
|
||||
*--------------------------------------
|
||||
ZPBase .EQ ZPDRV
|
||||
ZPBitBlt .EQ ZPDRV+2
|
||||
ZPShiftLo .EQ ZPDRV+4
|
||||
ZPShiftHi .EQ ZPDRV+6
|
||||
ZPShiftLo .EQ ZPDRV+2
|
||||
ZPShiftHi .EQ ZPDRV+4
|
||||
ZPCtrlBlk .EQ ZPDRV+8 limited to 8 bytes for now...have to modify kernel
|
||||
*--------------------------------------
|
||||
* File Header (16 Bytes)
|
||||
*--------------------------------------
|
||||
@ -130,7 +130,7 @@ MSG.DETECT >PSTRING "\nApple IIe/IIc DHGR Driver.\n"
|
||||
DEV.HEADER cld
|
||||
jmp (DRV.CS.START,x)
|
||||
.HS 00 DevID
|
||||
.DA #S.DEV.F.EVENT
|
||||
.DA #0 No Flag
|
||||
>PSTRING "GFX" NAME
|
||||
.HS 00 NAME must Be 5 bytes long
|
||||
.HS 00
|
||||
@ -177,12 +177,18 @@ OPEN ldy #S.DEV.ID
|
||||
inc
|
||||
sta DIV7.hi+2
|
||||
|
||||
lda L.MOD7.0+1
|
||||
sta MOD7.hi
|
||||
inc
|
||||
sta MOD7.hi+1
|
||||
inc
|
||||
sta MOD7.hi+2
|
||||
ldy #0
|
||||
ldx #0
|
||||
|
||||
.1 lda L.MOD7.0,y
|
||||
sta MOD7.lo,x
|
||||
iny
|
||||
lda L.MOD7.0,y
|
||||
sta MOD7.hi,x
|
||||
iny
|
||||
inx
|
||||
cpx #3
|
||||
bne .1
|
||||
|
||||
ldx #7
|
||||
lda L.Shift0.Lo+1
|
||||
@ -201,19 +207,7 @@ OPEN ldy #S.DEV.ID
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
GETEVENT lda A2osX.ASCREEN
|
||||
cmp #3
|
||||
bne .9
|
||||
|
||||
>SYSCALL SYS.GetKeyboardEvent
|
||||
bcs .9
|
||||
|
||||
rts
|
||||
|
||||
.9 lda #0 Error = no event
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
GETEVENT
|
||||
COUT
|
||||
IRQ sec
|
||||
rts
|
||||
@ -244,119 +238,91 @@ SELECT sta CLRTEXT
|
||||
rts
|
||||
*--------------------------------------
|
||||
* SETPIXEL
|
||||
* PULLB = Mode
|
||||
* 00000001=B/W
|
||||
* 00000010=16 colors
|
||||
* 1000000=xor (mono on 1 bit)
|
||||
* PULLW = X
|
||||
* PULLB = Y
|
||||
* PULLB = Color (if not xor)
|
||||
* In : YA = Ptr to CtrlBlk :
|
||||
* 0 : X
|
||||
* 2 : Y
|
||||
* 4 : Mode
|
||||
* 00000000=xor
|
||||
* 00000001=b/w (1 bit/pixel)
|
||||
* 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
|
||||
and #$FF
|
||||
bpl SETPIXEL.1
|
||||
|
||||
SETPIXEL.XOR >PULLAX A=X.LO,X=X.HI
|
||||
tay
|
||||
sta SET80STORE
|
||||
|
||||
lda ZPCtrlBlk+4
|
||||
bit #%00000100
|
||||
bne .7
|
||||
|
||||
ldx ZPCtrlBlk+1 X.HI
|
||||
lda DIV7.hi,x
|
||||
sta .1+2
|
||||
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 MOD7.lo,x
|
||||
sta .4+1
|
||||
lda MOD7.hi,x
|
||||
sta .4+2
|
||||
|
||||
ldx ZPCtrlBlk X.LO
|
||||
.2 lda DIV7.0,x A=Col*2+AuxBit
|
||||
|
||||
lda #CLRPAGE2>1
|
||||
asl
|
||||
sta .3+1
|
||||
lsr .3+1 reset CLRPAGE2 address
|
||||
lsr CS=Aux
|
||||
rol .3+1 if CS, -> SETPAGE2
|
||||
|
||||
.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
|
||||
lda (ZPBase),y
|
||||
eor Mono.Masks,x x = mod 7
|
||||
sta (ZPBase),y
|
||||
ldy ZPCtrlBlk+2 Y.LO
|
||||
adc BASEL,y setup line Base Ptr (A=Col)
|
||||
sta ZPBase
|
||||
lda BASEH,y
|
||||
sta ZPBase+1
|
||||
|
||||
.4 ldy MOD7.0,x x = X.LO
|
||||
|
||||
dec ZPCtrlBlk+4 get mode
|
||||
bne .5
|
||||
|
||||
lda (ZPBase) Mode=0, XOR
|
||||
eor Mono.Masks,y y = mod 7
|
||||
sta (ZPBase)
|
||||
|
||||
sta CLR80STORE
|
||||
rts
|
||||
*--------------------------------------
|
||||
SETPIXEL.1 lsr
|
||||
bcc SETPIXEL.COLOR
|
||||
|
||||
>PULLAX A=X.LO,X=X.HI
|
||||
tay
|
||||
.5 lda (ZPBase)
|
||||
ldx ZPCtrlBlk+5 mode=1, get color
|
||||
bne .6
|
||||
|
||||
lda DIV7.hi,x
|
||||
sta .1+2
|
||||
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
|
||||
and Mono.NMasks,y includes And $7F for mono
|
||||
sta (ZPBase)
|
||||
sta CLR80STORE
|
||||
rts
|
||||
|
||||
.6 and #$7F switch back this byte to mono
|
||||
ora Mono.Masks,x
|
||||
sta (ZPBase),y
|
||||
sta CLR80STORE
|
||||
ora Mono.Masks,y
|
||||
sta (ZPBase)
|
||||
sta CLR80STORE
|
||||
rts
|
||||
*--------------------------------------
|
||||
SETPIXEL.COLOR >PULLW CX Get X.LO...
|
||||
>PULLB CY
|
||||
|
||||
lda CX
|
||||
lsr CX+1 divide by 4
|
||||
.7 lda ZPCtrlBlk X.LO
|
||||
lsr ZPCtrlBlk+1 divide by 4
|
||||
ror
|
||||
lsr CX+1
|
||||
lsr ZPCtrlBlk+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
|
||||
ldx ZPCtrlBlk+2
|
||||
adc BASEL,x setup line Base Ptr (cc by asl)
|
||||
sta ZPBase ZPBase now point to first of...
|
||||
lda BASEH,x
|
||||
@ -368,14 +334,14 @@ SETPIXEL.COLOR >PULLW CX Get X.LO...
|
||||
asl
|
||||
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
|
||||
tay
|
||||
|
||||
lda Color.Masks,x bits in 1st byte to light?
|
||||
beq .1
|
||||
beq .10
|
||||
and Color.Pixels,y apply color
|
||||
sta GBYTE
|
||||
|
||||
@ -386,11 +352,11 @@ SETPIXEL.COLOR >PULLW CX Get X.LO...
|
||||
ora GBYTE
|
||||
sta (ZPBase)
|
||||
|
||||
.1 inx
|
||||
.10 inx
|
||||
iny
|
||||
|
||||
lda Color.Masks,x
|
||||
beq .2
|
||||
beq .11
|
||||
and Color.Pixels,y apply color
|
||||
sta GBYTE
|
||||
|
||||
@ -401,12 +367,12 @@ SETPIXEL.COLOR >PULLW CX Get X.LO...
|
||||
ora GBYTE
|
||||
sta (ZPBase)
|
||||
|
||||
.2 inc ZPBase
|
||||
.11 inc ZPBase
|
||||
inx
|
||||
iny
|
||||
|
||||
lda Color.Masks,x
|
||||
beq .3
|
||||
beq .12
|
||||
and Color.Pixels,y apply color
|
||||
sta GBYTE
|
||||
|
||||
@ -417,11 +383,11 @@ SETPIXEL.COLOR >PULLW CX Get X.LO...
|
||||
ora GBYTE
|
||||
sta (ZPBase)
|
||||
|
||||
.3 inx
|
||||
.12 inx
|
||||
iny
|
||||
|
||||
lda Color.Masks,x
|
||||
beq .8
|
||||
beq .13
|
||||
and Color.Pixels,y apply color
|
||||
sta GBYTE
|
||||
|
||||
@ -432,7 +398,7 @@ SETPIXEL.COLOR >PULLW CX Get X.LO...
|
||||
ora GBYTE
|
||||
sta (ZPBase)
|
||||
|
||||
.8 sta CLR80STORE
|
||||
.13 sta CLR80STORE
|
||||
rts
|
||||
*--------------------------------------
|
||||
GETPIXEL rts
|
||||
@ -444,7 +410,7 @@ VLINE rts
|
||||
FILLREC rts
|
||||
*--------------------------------------
|
||||
* BitBlt
|
||||
* In : YA = Ptr to Job :
|
||||
* In : YA = Ptr to CtrlBlk :
|
||||
* 0 : Operation
|
||||
* %00000001 : Save
|
||||
* %00000010 : Replace
|
||||
@ -460,8 +426,8 @@ FILLREC rts
|
||||
* 14 : DestY
|
||||
* 16 : BM Struct
|
||||
*--------------------------------------
|
||||
BITBLT >STYA ZPBitBlt
|
||||
lda (ZPBitBlt)
|
||||
BITBLT >STYA ZPCtrlBlk
|
||||
lda (ZPCtrlBlk)
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -638,6 +604,7 @@ Shift6.hi .BS 128
|
||||
.INB DRV/DHGR.DRV.T
|
||||
*--------------------------------------
|
||||
DIV7.hi .BS 3
|
||||
MOD7.lo .BS 3
|
||||
MOD7.hi .BS 3
|
||||
Shiftlo.hi .BS 7
|
||||
Shifthi.hi .BS 7
|
||||
|
@ -66,50 +66,54 @@ Color.Pixels .DA #%00000000,#%00000000,#%00000000,#%00000000 black (color bit di
|
||||
.DA #%11011101,#%10111011,#%11110111,#%11101110 pink
|
||||
.DA #%11101110,#%11011101,#%10111011,#%11110111 yellow
|
||||
*--------------------------------------
|
||||
DIV7.0 .HS 0000000000000001010101010101
|
||||
.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
|
||||
* COL*2+AUX Bit
|
||||
*--------------------------------------
|
||||
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
|
||||
@ -125,32 +129,10 @@ MOD7.0 .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 00
|
||||
*--------------------------------------
|
||||
BASEL .HS 00.00.00.00.00.00.00.00
|
||||
.HS 80.80.80.80.80.80.80.80
|
||||
|
@ -34,6 +34,8 @@ L.LIBGFX .DA LIBGFX
|
||||
L.DEVNAME.GFX .DA DEVNAME.GFX
|
||||
L.DEVNAME.MOUSE .DA DEVNAME.MOUSE
|
||||
L.MSG.INIT .DA MSG.INIT
|
||||
L.SetPixel.X .DA SetPixel.X
|
||||
L.DrawLine.X1 .DA DrawLine.X1
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT >LDYA L.MSG.INIT
|
||||
@ -49,7 +51,17 @@ CS.INIT >LDYA L.MSG.INIT
|
||||
rts
|
||||
|
||||
.10 stx hDevGFX
|
||||
|
||||
ldx pDev
|
||||
phx
|
||||
ldx pDev+1
|
||||
phx
|
||||
|
||||
>STYA pDevGFX
|
||||
>STYA pDev
|
||||
|
||||
ldx #DEVMGR.OPEN
|
||||
jsr GoDevGFX
|
||||
|
||||
.11 >LDYA L.DEVNAME.MOUSE
|
||||
>SYSCALL SYS.GetDevByNameYA
|
||||
@ -59,134 +71,270 @@ CS.INIT >LDYA L.MSG.INIT
|
||||
lda DEVNAME.MOUSE+4
|
||||
cmp #'8'
|
||||
bne .11
|
||||
sec
|
||||
rts
|
||||
beq .21 No mouse found, skip mouse init
|
||||
|
||||
.20 stx hDevMouse
|
||||
>STYA pDevMouse
|
||||
>STYA pDev
|
||||
|
||||
ldx #DEVMGR.OPEN
|
||||
jsr GoDevMouse
|
||||
|
||||
lda pDev
|
||||
pha
|
||||
lda pDev+1
|
||||
pha
|
||||
|
||||
lda pDevGFX
|
||||
sta pDev
|
||||
lda pDevGFX+1
|
||||
sta pDev+1
|
||||
|
||||
ldx #DEVMGR.OPEN
|
||||
jsr GoDevGFX
|
||||
|
||||
pla
|
||||
.21 pla
|
||||
sta pDev+1
|
||||
pla
|
||||
sta pDev
|
||||
|
||||
lda hDevGFX
|
||||
>LIBCALL hLibGFX,LIBGFX.InitDevA
|
||||
>LIBCALL hLibGFX,LIBGFX.InitGFXA
|
||||
|
||||
* jmp .8
|
||||
|
||||
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)
|
||||
lda (pPs)
|
||||
ora #S.PS.F.EVENT Now accept events
|
||||
sta (pPs)
|
||||
|
||||
jsr Destop.Paint
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.DOEVENT ldy #S.EVT.hDEV
|
||||
lda (pEvent),y
|
||||
CS.DOEVENT lda hDevMouse Mouse is active ?
|
||||
beq .1 go check KB
|
||||
|
||||
cmp hDevMouse
|
||||
bne .99
|
||||
ldy #S.EVT.hDEV
|
||||
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
|
||||
lda (pEvent),y
|
||||
and #4 mouse move
|
||||
beq .98
|
||||
|
||||
>PUSHBI 15 COLOR
|
||||
|
||||
ldy #S.EVT.DATAW2
|
||||
lda (pEvent),y
|
||||
>PUSHA Y
|
||||
sta SetPixel.Y
|
||||
|
||||
dey
|
||||
lda (pEvent),y X.HI
|
||||
>PUSHA
|
||||
sta SetPixel.X+1
|
||||
|
||||
dey
|
||||
lda (pEvent),y
|
||||
>PUSHA X.LO
|
||||
lda (pEvent),y 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
|
||||
jsr GoDevGFX
|
||||
|
||||
.98 clc
|
||||
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
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.QUIT clc
|
||||
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)
|
||||
GoDevMouse jmp (pDevMouse)
|
||||
*--------------------------------------
|
||||
@ -200,9 +348,16 @@ hDevGFX .BS 1
|
||||
pDevGFX .BS 2
|
||||
hDevMouse .BS 1
|
||||
pDevMouse .BS 2
|
||||
X .BS 2
|
||||
Y .BS 1
|
||||
C .BS 1
|
||||
SetPixel.X .BS 2
|
||||
SetPixel.Y .BS 2
|
||||
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
|
||||
SAVE SBIN/DESKTOP.S
|
||||
ASM
|
||||
|
Loading…
Reference in New Issue
Block a user