A2osX/DRV/DHGR.DRV.S.txt

562 lines
15 KiB
Plaintext
Raw Normal View History

2015-03-14 21:48:35 +00:00
PR#3
2015-06-03 18:30:57 +00:00
PREFIX /A2OSX.SRC
2015-03-14 21:48:35 +00:00
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
2015-06-03 18:30:57 +00:00
.TF /A2OSX.BOOT/DRV/DHGR.DRV
2015-03-14 21:48:35 +00:00
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/IO.I
*--------------------------------------
ZPBASE .EQ ZPDRV
ZPCOLOR .EQ ZPDRV+2
*--------------------------------------
2015-06-03 18:30:57 +00:00
* File Header (16 Bytes)
2015-03-14 21:48:35 +00:00
*--------------------------------------
CS.START cld
2015-06-03 18:30:57 +00:00
jmp Dev.Detect cld,jmp abs=DRV
.DA #$61 6502,Level 1 (65c02)
.DA #1 DRV Layout Version 1
.DA 0
.DA CS.END-CS.START Code Length
.DA DEV.HEADER-CS.START Device Header Offset
.DA DRV.CS.START-CS.START Driver Code Offset
.DA DRV.CS.END-DRV.CS.START Drv Code Length
*--------------------------------------
* Relocation Table
*--------------------------------------
L.MSG.DETECT .DA MSG.DETECT
.DA 0 End Of Reloc Table
*--------------------------------------
Dev.Detect >LDYA L.MSG.DETECT
>SYSCALL SYS.PSTROutYA
2015-06-03 18:30:57 +00:00
lda A2osX.SCREENS
ora #A2osX.SCREENS.G
sta A2osX.SCREENS
clc
rts
CS.END
MSG.DETECT >PSTRING "\nApple IIe/IIc DHGR Driver.\n"
2015-06-03 18:30:57 +00:00
*--------------------------------------
* Device Header (16 Bytes)
*--------------------------------------
DEV.HEADER cld
jmp (DRV.CS.START,x)
.DA #S.DEV.F.EVENT
2015-06-03 18:30:57 +00:00
>PSTRING "GFX" NAME
.HS 00 NAME must Be 5 bytes long
.HS 00.00
.HS 00.00.00.00
*--------------------------------------
* Driver Code
*--------------------------------------
DRV.CS.START .DA OPEN
2015-03-14 21:48:35 +00:00
.DA GETEVENT
2015-06-03 18:30:57 +00:00
.DA COUT
2015-03-14 21:48:35 +00:00
.DA CLOSE
.DA GETINFO
2015-06-03 18:30:57 +00:00
.DA IRQ
2015-03-14 21:48:35 +00:00
.DA SETPIXEL
.DA GETPIXEL
.DA HLINE
.DA VLINE
.DA BITBLT
2015-06-03 18:30:57 +00:00
.DA FILLREC
2015-03-14 21:48:35 +00:00
L.DEVINFO .DA DEVINFO
.DA 0 end or relocation
*--------------------------------------
OPEN lda #A2osX.SCREENS.G
>SYSCALL SYS.ScreenSelectA
ldx #192
.81 dex
lda BASEL,x
sta ZPBASE
lda BASEH,x
sta ZPBASE+1
* lda #$55
lda #$00
2015-06-03 18:30:57 +00:00
ldy #39
sta SETWRITEAUX
.82 sta (ZPBASE),y
dey
bpl .82
* lda #$2A
lda #$00
ldy #39
sta CLRWRITEAUX
2015-06-03 18:30:57 +00:00
.83 sta (ZPBASE),y
dey
2015-06-03 18:30:57 +00:00
bpl .83
txa
bne .81
clc
2015-03-14 21:48:35 +00:00
rts
*--------------------------------------
GETEVENT lda A2osX.ASCREEN
and #A2osX.SCREENS.G is screen active?
beq .9
>SYSCALL SYS.GetKeyboardEvent
bcs .9
rts
.9 lda #0 Error = no event
sec
rts
*--------------------------------------
2015-06-03 18:30:57 +00:00
COUT
IRQ sec
2015-03-14 21:48:35 +00:00
rts
*--------------------------------------
2015-06-03 18:30:57 +00:00
CLOSE clc
2015-03-14 21:48:35 +00:00
rts
*--------------------------------------
GETINFO >LDYA L.DEVINFO
clc
rts
*--------------------------------------
* SETPIXEL
* PULLB = Mode
2015-06-03 18:30:57 +00:00
* 00000001=B/W
* 00000010=16 colors
* 1000000=xor (mono on 1 bit)
2015-06-03 18:30:57 +00:00
* PULLW = X
* PULLB = Y
2015-03-14 21:48:35 +00:00
* PULLB = Color (if not xor)
*--------------------------------------
SETPIXEL sta SET80STORE
>PULLA Pull Mode
2015-06-03 18:30:57 +00:00
and #$FF
bpl SETPIXEL.1
SETPIXEL.XOR >PULLYA Y=X.LO,A=X.HI
2015-03-14 21:48:35 +00:00
lsr if 256 =< x < 511
bcs .1
lsr
bcs .2 if 512 < x
2015-06-03 18:30:57 +00:00
lda DIV7.0,y
ldx MOD7.0,y
2015-03-14 21:48:35 +00:00
bra .3
2015-06-03 18:30:57 +00:00
.1 lda DIV7.256,y
ldx MOD7.256,y
2015-03-14 21:48:35 +00:00
bra .3
2015-06-03 18:30:57 +00:00
.2 lda DIV7.512,y
ldx MOD7.512,y
2015-03-14 21:48:35 +00:00
2015-06-03 18:30:57 +00:00
.3 lsr
tay
bcs .4 odd=main ram
sta SETPAGE2
.4 >PULLA Pull Y
2015-03-14 21:48:35 +00:00
tax
lda BASEL,x setup line Base Ptr
sta ZPBASE
lda BASEH,x
sta ZPBASE+1
2015-06-03 18:30:57 +00:00
lda (ZPBASE),y
eor Mono.Masks,x
sta (ZPBASE),y
sta CLR80STORE
rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
2015-06-03 18:30:57 +00:00
SETPIXEL.1 lsr
bcc SETPIXEL.COLOR
>PULLW CX
>PULLB CY
2015-06-03 18:30:57 +00:00
ldy CX
lsr CX+1 if 256 =< x < 511
2015-06-03 18:30:57 +00:00
bcs .1
lsr CX+1
2015-06-03 18:30:57 +00:00
bcs .2 if 512 < x
lda DIV7.0,y
ldx MOD7.0,y
bra .3
.1 lda DIV7.256,y
ldx MOD7.256,y
bra .3
.2 lda DIV7.512,y
ldx MOD7.512,y
.3 lsr
bcc .4 odd=main ram
sta CLRPAGE2
clc
bra .41
.4 sta SETPAGE2
.41 ldy CY
adc BASEL,y setup line Base Ptr
2015-06-03 18:30:57 +00:00
sta ZPBASE
lda BASEH,y
2015-06-03 18:30:57 +00:00
sta ZPBASE+1
>PULLA Pull Color
2015-03-14 21:48:35 +00:00
lsr
2015-06-03 18:30:57 +00:00
bcs .6 set white pixel
2015-03-14 21:48:35 +00:00
lda (ZPBASE)
and Mono.NMasks,x includes And $7F for mono
sta (ZPBASE)
sta CLR80STORE
2015-03-14 21:48:35 +00:00
rts
.6 lda (ZPBASE)
and #$7F switch back this byte to mono
2015-03-14 21:48:35 +00:00
ora Mono.Masks,x
sta (ZPBASE)
sta CLR80STORE
2015-03-14 21:48:35 +00:00
rts
*--------------------------------------
SETPIXEL.COLOR >PULLW CX Get X.LO...
>PULLB CY
lda CX
lsr CX+1 divide by 4
2015-06-03 18:30:57 +00:00
ror
lsr CX+1
2015-06-03 18:30:57 +00:00
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...
2015-06-03 18:30:57 +00:00
lda BASEH,x
sta ZPBASE+1 ...the 4 columns
2015-06-03 18:30:57 +00:00
lda MOD7.0,y get MOD
asl times 4 to compute index in MASK tables
2015-06-03 18:30:57 +00:00
asl
2015-03-14 21:48:35 +00:00
tax set in X for Masks,NMasks
>PULLA get COLOR
2015-06-03 18:30:57 +00:00
asl times 4 to compute index in PIXELS table
2015-03-14 21:48:35 +00:00
asl
tay
lda Color.Masks,x bits in 1st byte to light?
2015-03-14 21:48:35 +00:00
beq .1
2015-03-23 17:09:21 +00:00
and Color.Pixels,y apply color
sta GBYTE
2015-03-14 21:48:35 +00:00
sta SETPAGE2
2015-03-14 21:48:35 +00:00
lda (ZPBASE)
and Color.NMasks,x reset existing pixel,
2015-03-23 17:09:21 +00:00
ora GBYTE
2015-03-14 21:48:35 +00:00
sta (ZPBASE)
.1 inx
iny
lda Color.Masks,x
beq .2
2015-03-23 17:09:21 +00:00
and Color.Pixels,y apply color
sta GBYTE
2015-03-14 21:48:35 +00:00
sta CLRPAGE2
2015-03-14 21:48:35 +00:00
lda (ZPBASE)
and Color.NMasks,x reset existing pixel,
2015-03-23 17:09:21 +00:00
ora GBYTE
2015-03-14 21:48:35 +00:00
sta (ZPBASE)
.2 inc ZPBASE
inx
iny
lda Color.Masks,x
beq .3
2015-03-23 17:09:21 +00:00
and Color.Pixels,y apply color
sta GBYTE
2015-03-14 21:48:35 +00:00
sta SETPAGE2
2015-03-14 21:48:35 +00:00
lda (ZPBASE)
and Color.NMasks,x reset existing pixel,
2015-03-23 17:09:21 +00:00
ora GBYTE
2015-03-14 21:48:35 +00:00
sta (ZPBASE)
.3 inx
iny
lda Color.Masks,x
beq .8
2015-03-23 17:09:21 +00:00
and Color.Pixels,y apply color
sta GBYTE
2015-03-14 21:48:35 +00:00
sta CLRPAGE2
2015-03-14 21:48:35 +00:00
lda (ZPBASE)
and Color.NMasks,x reset existing pixel,
2015-03-23 17:09:21 +00:00
ora GBYTE
2015-03-14 21:48:35 +00:00
sta (ZPBASE)
2015-03-23 17:09:21 +00:00
.8 sta CLR80STORE
rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
GETPIXEL rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
HLINE rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
VLINE rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
FILLREC rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
*
* 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
*
2015-03-14 21:48:35 +00:00
*--------------------------------------
BITBLT
rts
*--------------------------------------
2015-06-03 18:30:57 +00:00
DRV.CS.END
*--------------------------------------
Mono.NMasks .DA #%01111110
.DA #%01111101
.DA #%01111011
.DA #%01110111
.DA #%01101111
.DA #%01011111
.DA #%00111111
*--------------------------------------
Mono.Masks .DA #%00000001
.DA #%00000010
.DA #%00000100
.DA #%00001000
.DA #%00010000
.DA #%00100000
.DA #%01000000
*--------------------------------------
* bits to "and" to reset color of pixel (0 means nothing to do)
* 4 bytes * 7 mods
2015-06-03 18:30:57 +00:00
*--------------------------------------
* c1110000 c3322221 c5444433 c6666555
Color.NMasks .DA #%01110000,#%00000000,#%00000000,#%00000000
.DA #%00001111,#%01111110,#%00000000,#%00000000
.DA #%00000000,#%01100001,#%00000000,#%00000000
.DA #%00000000,#%00011111,#%01111100,#%00000000
.DA #%00000000,#%00000000,#%01000011,#%00000000
.DA #%00000000,#%00000000,#%00111111,#%01111000
.DA #%00000000,#%00000000,#%00000000,#%00000111
*--------------------------------------
* bits to "and" to Get color of pixel (0 means nothing to do)
* 4 bytes * 7 mods
*--------------------------------------
* c1110000 c3322221 c5444433 c6666555
Color.Masks .DA #%10001111,#%00000000,#%00000000,#%00000000
.DA #%11110000,#%00000001,#%00000000,#%00000000
.DA #%00000000,#%10011110,#%00000000,#%00000000
.DA #%00000000,#%11100000,#%00000011,#%00000000
.DA #%00000000,#%00000000,#%10111100,#%00000000
.DA #%00000000,#%00000000,#%11000000,#%00000111
.DA #%00000000,#%00000000,#%00000000,#%11111000
*--------------------------------------
* bits to "ora" to set color of pixel (including "color bit set" for byte hosting bit0)
* 4 bytes * 16 Colors
*--------------------------------------
* c1110000 c3322221 c5444433 c6666555
Color.Pixels .DA #%00000000,#%00000000,#%00000000,#%00000000 black (color bit disable)
.DA #%01111111,#%01111111,#%01111111,#%01111111 white (color bit disable)
2015-06-03 18:30:57 +00:00
.DA #%10010001,#%10100010,#%11000100,#%10001000 dark blue
.DA #%10100010,#%11000100,#%10001000,#%10010001 dark green
.DA #%10110011,#%11100110,#%11001100,#%10011001 medium blue
.DA #%11000100,#%10001000,#%10010001,#%10100010 brown
.DA #%11010101,#%10101010,#%11010101,#%10101010 grey2
.DA #%11100110,#%11001100,#%10011001,#%10110011 green
.DA #%11110111,#%11101110,#%11011101,#%10111011 aqua
.DA #%10001000,#%10010001,#%10100010,#%11000100 Magenta
.DA #%10011001,#%10110011,#%11100110,#%11001100 violet
.DA #%10101010,#%11010101,#%10101010,#%11010101 grey1
.DA #%10111011,#%11110111,#%11101110,#%11011101 light blue
.DA #%11001100,#%10011001,#%10110011,#%11100110 orange
.DA #%11011101,#%10111011,#%11110111,#%11101110 pink
.DA #%11101110,#%11011101,#%10111011,#%11110111 yellow
*--------------------------------------
2015-03-14 21:48:35 +00:00
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
*--------------------------------------
MOD7.0 .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 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
*--------------------------------------
BASEL .HS 00.00.00.00.00.00.00.00
.HS 80.80.80.80.80.80.80.80
.HS 00.00.00.00.00.00.00.00
.HS 80.80.80.80.80.80.80.80
.HS 00.00.00.00.00.00.00.00
.HS 80.80.80.80.80.80.80.80
.HS 00.00.00.00.00.00.00.00
.HS 80.80.80.80.80.80.80.80
.HS 28.28.28.28.28.28.28.28
.HS A8.A8.A8.A8.A8.A8.A8.A8
.HS 28.28.28.28.28.28.28.28
.HS A8.A8.A8.A8.A8.A8.A8.A8
.HS 28.28.28.28.28.28.28.28
.HS A8.A8.A8.A8.A8.A8.A8.A8
.HS 28.28.28.28.28.28.28.28
.HS A8.A8.A8.A8.A8.A8.A8.A8
.HS 50.50.50.50.50.50.50.50
.HS D0.D0.D0.D0.D0.D0.D0.D0
.HS 50.50.50.50.50.50.50.50
.HS D0.D0.D0.D0.D0.D0.D0.D0
.HS 50.50.50.50.50.50.50.50
.HS D0.D0.D0.D0.D0.D0.D0.D0
.HS 50.50.50.50.50.50.50.50
.HS D0.D0.D0.D0.D0.D0.D0.D0
*--------------------------------------
BASEH .HS 20.24.28.2C.30.34.38.3C
.HS 20.24.28.2C.30.34.38.3C
.HS 21.25.29.2D.31.35.39.3D
.HS 21.25.29.2D.31.35.39.3D
.HS 22.26.2A.2E.32.36.3A.3E
.HS 22.26.2A.2E.32.36.3A.3E
.HS 23.27.2B.2F.33.37.3B.3F
.HS 23.27.2B.2F.33.37.3B.3F
.HS 20.24.28.2C.30.34.38.3C
.HS 20.24.28.2C.30.34.38.3C
.HS 21.25.29.2D.31.35.39.3D
.HS 21.25.29.2D.31.35.39.3D
.HS 22.26.2A.2E.32.36.3A.3E
.HS 22.26.2A.2E.32.36.3A.3E
.HS 23.27.2B.2F.33.37.3B.3F
.HS 23.27.2B.2F.33.37.3B.3F
.HS 20.24.28.2C.30.34.38.3C
.HS 20.24.28.2C.30.34.38.3C
.HS 21.25.29.2D.31.35.39.3D
.HS 21.25.29.2D.31.35.39.3D
.HS 22.26.2A.2E.32.36.3A.3E
.HS 22.26.2A.2E.32.36.3A.3E
.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
2015-03-23 17:09:21 +00:00
GBYTE .BS 1
2015-03-14 21:48:35 +00:00
*--------------------------------------
2015-06-03 18:30:57 +00:00
DEVINFO .DA #S.DEVINFO.TYPE.GFX type of DEVINFO STRUCT
DEVINFO.MODES .DA #%10000011 XOR,16 & B/W
2015-03-14 21:48:35 +00:00
DEVINFO.W .DA 560 X.SIZE
DEVINFO.H .DA 192 Y.SIZE
*--------------------------------------
MAN
SAVE DRV/DHGR.DRV.S
ASM