2015-03-23 07:28:03 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2015-03-23 07:28:03 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.TF /A2OSX.BUILD/LIB/LIBGFX.O
|
2015-03-23 07:28:03 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.INB /A2OSX.BUILD/INC/MACROS.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/A2OSX.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/LIBGFX.I
|
2015-03-23 07:28:03 +00:00
|
|
|
|
*--------------------------------------
|
2017-06-09 15:36:05 +00:00
|
|
|
|
.MA SWAP16
|
|
|
|
|
lda ]1
|
|
|
|
|
ldx ]2
|
|
|
|
|
stx ]1
|
|
|
|
|
sta ]2
|
|
|
|
|
lda ]1+1
|
|
|
|
|
ldx ]2+1
|
|
|
|
|
stx ]1+1
|
|
|
|
|
sta ]2+1
|
|
|
|
|
.EM
|
|
|
|
|
.MA NOT16
|
|
|
|
|
sec
|
|
|
|
|
lda #0
|
|
|
|
|
sbc ]1
|
|
|
|
|
sta ]1
|
|
|
|
|
lda #0
|
|
|
|
|
sbc ]1+1
|
|
|
|
|
sta ]1+1
|
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPCBPtr .EQ ZPLIB
|
|
|
|
|
ZPDCPtr .EQ ZPLIB+2
|
2016-06-15 06:21:42 +00:00
|
|
|
|
*--------------------------------------
|
2015-08-05 20:38:05 +00:00
|
|
|
|
* File Header (16 Bytes)
|
2015-03-23 07:28:03 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
2015-08-05 20:38:05 +00:00
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
2015-03-23 07:28:03 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
.DA CS.END-CS.START
|
|
|
|
|
.DA 0
|
2015-08-05 20:38:05 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA LIB.LOAD
|
|
|
|
|
.DA LIB.UNLOAD
|
2016-06-15 15:58:45 +00:00
|
|
|
|
.DA InitGFXA
|
2017-06-09 15:36:05 +00:00
|
|
|
|
.DA CloseGFX
|
2016-06-15 15:58:45 +00:00
|
|
|
|
.DA InitCursor
|
|
|
|
|
.DA SetCursorYA
|
|
|
|
|
.DA HideCursor
|
|
|
|
|
.DA ShowCursor
|
2017-06-09 15:36:05 +00:00
|
|
|
|
.DA DrawLine
|
|
|
|
|
L.CB.Cache .DA CB.Cache
|
2015-11-29 22:19:10 +00:00
|
|
|
|
.DA 0
|
2015-03-23 07:28:03 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
LIB.LOAD
|
|
|
|
|
LIB.UNLOAD clc
|
|
|
|
|
rts
|
2016-06-15 06:21:42 +00:00
|
|
|
|
*--------------------------------------
|
2016-06-15 15:58:45 +00:00
|
|
|
|
InitGFXA sta hDev
|
2017-06-09 15:36:05 +00:00
|
|
|
|
>SYSCALL GetDevByIDA
|
|
|
|
|
>STYA GoDevGFX.1+1
|
|
|
|
|
|
2016-06-15 06:21:42 +00:00
|
|
|
|
clc
|
2017-06-09 15:36:05 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CloseGFX
|
|
|
|
|
stz hDev
|
2016-06-15 06:21:42 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2016-10-07 06:09:25 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
InitCursor
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SetCursorYA
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
HideCursor
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ShowCursor
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2016-06-15 06:21:42 +00:00
|
|
|
|
*--------------------------------------
|
2017-06-09 15:36:05 +00:00
|
|
|
|
* In: Control Block
|
|
|
|
|
* hDC
|
|
|
|
|
* OP
|
|
|
|
|
* MODE
|
|
|
|
|
* COLOR
|
|
|
|
|
* X1
|
|
|
|
|
* Y1
|
|
|
|
|
* X2
|
|
|
|
|
* Y2
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DrawLine ldy #S.CB.Y2+1
|
|
|
|
|
jsr GetCB
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
lda CB.Cache+S.CB.X2
|
|
|
|
|
sbc CB.Cache+S.CB.X1
|
|
|
|
|
sta DX
|
|
|
|
|
|
|
|
|
|
lda CB.Cache+S.CB.X2+1
|
|
|
|
|
sbc CB.Cache+S.CB.X1+1
|
|
|
|
|
sta DX+1 DX% = X2% - X1%
|
2017-06-16 15:27:48 +00:00
|
|
|
|
|
2017-06-09 15:36:05 +00:00
|
|
|
|
bmi .1 DX < 0....
|
|
|
|
|
|
|
|
|
|
ora DX
|
|
|
|
|
bne .2 DX > 0...
|
2017-06-16 15:27:48 +00:00
|
|
|
|
|
2017-06-09 15:36:05 +00:00
|
|
|
|
ldx #DEVMGR.GFX.VLINE
|
|
|
|
|
jmp GoDevGFX DX=0 : VLIN Y1,Y2 At X1
|
|
|
|
|
|
|
|
|
|
.1 >SWAP16 CB.Cache+S.CB.X1,CB.Cache+S.CB.X2
|
2017-06-15 15:36:25 +00:00
|
|
|
|
* >SWAP16 CB.Cache+S.CB.Y1,CB.Cache+S.CB.Y2
|
|
|
|
|
lda CB.Cache+S.CB.Y1
|
|
|
|
|
ldx CB.Cache+S.CB.Y2
|
|
|
|
|
stx CB.Cache+S.CB.Y1
|
|
|
|
|
sta CB.Cache+S.CB.Y2
|
2017-06-09 15:36:05 +00:00
|
|
|
|
|
2017-06-15 15:36:25 +00:00
|
|
|
|
>NOT16 DX swap X1/X2, Y1/Y2, set DX=-DX (DX positive)
|
2017-06-09 15:36:05 +00:00
|
|
|
|
|
2017-06-15 15:36:25 +00:00
|
|
|
|
.2 lda #1
|
|
|
|
|
sta IY
|
2017-06-09 15:36:05 +00:00
|
|
|
|
|
|
|
|
|
lda CB.Cache+S.CB.Y2
|
2017-06-15 15:36:25 +00:00
|
|
|
|
sec
|
2017-06-09 15:36:05 +00:00
|
|
|
|
sbc CB.Cache+S.CB.Y1
|
|
|
|
|
sta DY
|
|
|
|
|
|
2017-06-15 15:36:25 +00:00
|
|
|
|
* lda CB.Cache+S.CB.Y2+1
|
|
|
|
|
lda #0
|
|
|
|
|
* sbc CB.Cache+S.CB.Y1+1
|
|
|
|
|
sbc #0
|
2017-06-09 15:36:05 +00:00
|
|
|
|
sta DY+1 DY% = Y2% - Y1%
|
|
|
|
|
|
|
|
|
|
bmi .3 DY < 0 ...
|
|
|
|
|
|
|
|
|
|
ora DY
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
ldx #DEVMGR.GFX.HLINE
|
|
|
|
|
jmp GoDevGFX DY=0 : HLIN X1,X2 At Y1
|
|
|
|
|
|
|
|
|
|
.3 >NOT16 DY set DY=-DY
|
2017-06-15 15:36:25 +00:00
|
|
|
|
lda #$ff
|
|
|
|
|
sta IY set IY=-1
|
2017-06-09 15:36:05 +00:00
|
|
|
|
|
|
|
|
|
.4 ldx #DEVMGR.GFX.SETPIXEL
|
|
|
|
|
jsr GoDevGFX
|
|
|
|
|
|
|
|
|
|
lda DX
|
2017-06-15 15:36:25 +00:00
|
|
|
|
sec
|
2017-06-09 15:36:05 +00:00
|
|
|
|
sbc DY
|
2017-06-15 15:36:25 +00:00
|
|
|
|
tax
|
2017-06-09 15:36:05 +00:00
|
|
|
|
|
|
|
|
|
lda DX+1
|
2017-06-15 15:36:25 +00:00
|
|
|
|
* sbc DY+1
|
|
|
|
|
sbc #0
|
2017-06-09 15:36:05 +00:00
|
|
|
|
bmi DrawLine.IncY DY is greater than DX, we will increase on Y axis
|
|
|
|
|
|
2017-06-15 15:36:25 +00:00
|
|
|
|
txa
|
|
|
|
|
beq DrawLine.IncXY DX=DY, go inc X & Y
|
|
|
|
|
|
|
|
|
|
jmp DrawLine.IncX DY is lower than DX, we will increase on X axis
|
2017-06-09 15:36:05 +00:00
|
|
|
|
|
2017-06-15 15:36:25 +00:00
|
|
|
|
DrawLine.IncXY lda DX DX=DY
|
2017-06-09 15:36:05 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter
|
|
|
|
|
lda DX+1
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter+1
|
|
|
|
|
|
|
|
|
|
.1 inc Counter
|
|
|
|
|
bne .2
|
|
|
|
|
inc Counter+1
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
.2 inc CB.Cache+S.CB.X1
|
|
|
|
|
bne .3
|
|
|
|
|
inc CB.Cache+S.CB.X1+1
|
|
|
|
|
|
2017-06-15 15:36:25 +00:00
|
|
|
|
.3 lda CB.Cache+S.CB.Y1 Y1=Y1+IY
|
|
|
|
|
clc
|
|
|
|
|
adc IY
|
2017-06-09 15:36:05 +00:00
|
|
|
|
sta CB.Cache+S.CB.Y1
|
|
|
|
|
|
2017-06-15 15:36:25 +00:00
|
|
|
|
ldx #DEVMGR.GFX.SETPIXEL
|
2017-06-09 15:36:05 +00:00
|
|
|
|
jsr GoDevGFX
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.8 rts
|
|
|
|
|
|
|
|
|
|
DrawLine.IncY lda DY
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter
|
|
|
|
|
lda DY+1
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter+1
|
|
|
|
|
|
2017-06-15 15:36:25 +00:00
|
|
|
|
lda DX IE=2*DX
|
|
|
|
|
asl
|
|
|
|
|
sta IE
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
lda DX+1
|
|
|
|
|
rol
|
|
|
|
|
sta IE+1
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
pla D=IE-DY
|
|
|
|
|
sec
|
|
|
|
|
sbc DY
|
|
|
|
|
sta D
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
sbc DY+1
|
|
|
|
|
sta D+1
|
|
|
|
|
|
|
|
|
|
lda DX INE=2*(DX-DY)
|
|
|
|
|
sec
|
|
|
|
|
sbc DY
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
lda DX+1
|
|
|
|
|
sbc DY+1
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
asl
|
|
|
|
|
sta INE
|
|
|
|
|
txa
|
|
|
|
|
rol
|
|
|
|
|
sta INE+1
|
|
|
|
|
|
|
|
|
|
.1 inc Counter
|
|
|
|
|
bne .2
|
|
|
|
|
inc Counter+1
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
.2 lda D+1 IF D < 0 ...
|
|
|
|
|
bmi .4
|
|
|
|
|
|
|
|
|
|
lda D D > 0 : D=D+INE
|
|
|
|
|
clc
|
|
|
|
|
adc INE
|
|
|
|
|
sta D
|
|
|
|
|
lda D+1
|
|
|
|
|
adc INE+1
|
|
|
|
|
sta D+1
|
|
|
|
|
|
|
|
|
|
inc CB.Cache+S.CB.X1 X1=X1+1
|
|
|
|
|
bne .5
|
|
|
|
|
inc CB.Cache+S.CB.X1+1
|
|
|
|
|
|
|
|
|
|
bra .5
|
|
|
|
|
|
|
|
|
|
.4 lda D D > 0 : D=D+IE
|
|
|
|
|
clc
|
|
|
|
|
adc IE
|
|
|
|
|
sta D
|
|
|
|
|
lda D+1
|
|
|
|
|
adc IE+1
|
|
|
|
|
sta D+1
|
|
|
|
|
|
|
|
|
|
.5 lda CB.Cache+S.CB.Y1 Y1=Y1+IY
|
|
|
|
|
clc
|
|
|
|
|
adc IY
|
|
|
|
|
sta CB.Cache+S.CB.Y1
|
|
|
|
|
|
|
|
|
|
ldx #DEVMGR.GFX.SETPIXEL
|
|
|
|
|
jsr GoDevGFX
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.8 rts
|
2017-06-09 15:36:05 +00:00
|
|
|
|
|
|
|
|
|
DrawLine.IncX lda DX
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter
|
|
|
|
|
lda DX+1
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter+1
|
|
|
|
|
|
2017-06-15 15:36:25 +00:00
|
|
|
|
lda DY IE=2*DY
|
|
|
|
|
asl
|
|
|
|
|
sta IE
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
* lda DY+1
|
|
|
|
|
lda #0
|
|
|
|
|
rol
|
|
|
|
|
sta IE+1
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
pla D=IE-DX
|
|
|
|
|
sec
|
|
|
|
|
sbc DX
|
|
|
|
|
sta D
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
sbc DX+1
|
|
|
|
|
sta D+1
|
|
|
|
|
|
|
|
|
|
lda DY INE=2*(DY-DX)
|
|
|
|
|
sec
|
|
|
|
|
sbc DX
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
* lda DY+1
|
|
|
|
|
lda #0
|
|
|
|
|
sbc DX+1
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
asl
|
|
|
|
|
sta INE
|
|
|
|
|
txa
|
|
|
|
|
rol
|
|
|
|
|
sta INE+1
|
|
|
|
|
|
|
|
|
|
.1 inc Counter
|
|
|
|
|
bne .2
|
|
|
|
|
inc Counter+1
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
.2 lda D+1 ID D < 0 ....
|
|
|
|
|
bmi .4
|
|
|
|
|
|
|
|
|
|
lda D D > 0 : D=D+INE
|
|
|
|
|
clc
|
|
|
|
|
adc INE
|
|
|
|
|
sta D
|
|
|
|
|
lda D+1
|
|
|
|
|
adc INE+1
|
|
|
|
|
sta D+1
|
|
|
|
|
|
|
|
|
|
lda CB.Cache+S.CB.Y1 Y1=Y1+IY
|
|
|
|
|
clc
|
|
|
|
|
adc IY
|
|
|
|
|
sta CB.Cache+S.CB.Y1
|
|
|
|
|
|
|
|
|
|
bra .5
|
|
|
|
|
|
|
|
|
|
.4 lda D D < 0 : D=D+IE
|
|
|
|
|
clc
|
|
|
|
|
adc IE
|
|
|
|
|
sta D
|
|
|
|
|
lda D+1
|
|
|
|
|
adc IE+1
|
|
|
|
|
sta D+1
|
|
|
|
|
|
|
|
|
|
.5 inc CB.Cache+S.CB.X1 X1=X1+1
|
|
|
|
|
bne .6
|
|
|
|
|
inc CB.Cache+S.CB.X1+1
|
|
|
|
|
|
|
|
|
|
.6 ldx #DEVMGR.GFX.SETPIXEL
|
|
|
|
|
jsr GoDevGFX
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.8 rts
|
2017-06-09 15:36:05 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
GetCB >PULLW ZPCBPtr
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPCBPtr),y Y=Byte count to cache
|
|
|
|
|
sta CB.Cache,y
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
GoDevGFX >LDYA L.CB.Cache
|
|
|
|
|
GoDevGFX.1 jmp $ffff
|
2015-08-05 20:38:05 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2016-06-15 06:21:42 +00:00
|
|
|
|
hDev .BS 1
|
|
|
|
|
*--------------------------------------
|
2017-06-09 15:36:05 +00:00
|
|
|
|
DX .BS 2
|
|
|
|
|
DY .BS 2
|
|
|
|
|
IY .BS 1
|
2017-06-15 15:36:25 +00:00
|
|
|
|
IE .BS 2
|
|
|
|
|
D .BS 2
|
|
|
|
|
INE .BS 2
|
2017-06-09 15:36:05 +00:00
|
|
|
|
Counter .BS 2
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CB.Cache .BS S.CB
|
|
|
|
|
*--------------------------------------
|
2016-06-15 15:58:45 +00:00
|
|
|
|
CUR.Arrow .DA #0
|
|
|
|
|
.DA #0
|
|
|
|
|
CUR.Arrow.DATA .DA %00000001.000000000
|
|
|
|
|
.DA %00000011.000000000
|
|
|
|
|
.DA %00000101.000000000
|
|
|
|
|
.DA %00001001.000000000
|
|
|
|
|
.DA %00010001.000000000
|
|
|
|
|
.DA %00100011.000000000
|
|
|
|
|
.DA %01110101.000000000
|
|
|
|
|
.DA %00011000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
CUR.Arrow.MASK .DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000010.000000000
|
|
|
|
|
.DA %00000110.000000000
|
|
|
|
|
.DA %00001110.000000000
|
|
|
|
|
.DA %00011100.000000000
|
|
|
|
|
.DA %00001000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
|
|
|
|
.DA %00000000.000000000
|
2016-06-15 06:21:42 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-07 06:09:25 +00:00
|
|
|
|
PAT.Arrow .DA #S.BM.F.BBP1
|
2016-06-15 15:58:45 +00:00
|
|
|
|
.DA #1 RowBytes
|
|
|
|
|
.DA 7 W
|
|
|
|
|
.DA 8 H
|
|
|
|
|
.DA 0
|
2016-06-15 06:21:42 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-23 07:28:03 +00:00
|
|
|
|
MAN
|
2017-03-30 06:31:12 +00:00
|
|
|
|
SAVE /A2OSX.SRC/LIB/LIBGFX.S
|
2015-03-23 07:28:03 +00:00
|
|
|
|
ASM
|