mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-22 16:31:07 +00:00
539 lines
14 KiB
Plaintext
539 lines
14 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF /A2OSX.BOOT/DRV/DHGR.DRV
|
||
*--------------------------------------
|
||
.INB INC/MACROS.I
|
||
.INB INC/A2OSX.I
|
||
.INB INC/A2OSX.API.I
|
||
.INB INC/KERNEL.I
|
||
.INB INC/IO.I
|
||
*--------------------------------------
|
||
ZPBASE .EQ ZPDRV
|
||
ZPCOLOR .EQ ZPDRV+2
|
||
*--------------------------------------
|
||
* File Header (16 Bytes)
|
||
*--------------------------------------
|
||
CS.START cld
|
||
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.SysScrPPSTRYA
|
||
|
||
lda A2osX.SCREENS
|
||
ora #A2osX.SCREENS.G
|
||
sta A2osX.SCREENS
|
||
|
||
clc
|
||
rts
|
||
CS.END
|
||
MSG.DETECT >PSTRING "\nApple IIe/IIc DoubleHGR Driver."
|
||
*--------------------------------------
|
||
* Device Header (16 Bytes)
|
||
*--------------------------------------
|
||
DEV.HEADER cld
|
||
jmp (DRV.CS.START,x)
|
||
.DA #0
|
||
>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
|
||
.DA GETEVENT
|
||
.DA COUT
|
||
.DA CLOSE
|
||
.DA GETINFO
|
||
.DA IRQ
|
||
.DA SETPIXEL
|
||
.DA GETPIXEL
|
||
.DA HLINE
|
||
.DA VLINE
|
||
.DA BITBLT
|
||
.DA FILLREC
|
||
L.DEVINFO .DA DEVINFO
|
||
.DA 0 end or relocation
|
||
*--------------------------------------
|
||
OPEN sta SETHIRES
|
||
sta SET80STORE prepare for page switching
|
||
|
||
ldx #192
|
||
|
||
.81 dex
|
||
|
||
lda BASEL,x
|
||
sta ZPBASE
|
||
lda BASEH,x
|
||
sta ZPBASE+1
|
||
|
||
lda #$55
|
||
* lda #$00
|
||
|
||
ldy #39
|
||
sta SETPAGE2
|
||
.82 sta (ZPBASE),y
|
||
dey
|
||
bpl .82
|
||
|
||
lda #$2A
|
||
* lda #$00
|
||
|
||
ldy #39
|
||
sta CLRPAGE2
|
||
.83 sta (ZPBASE),y
|
||
dey
|
||
bpl .83
|
||
|
||
txa
|
||
bne .81
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
GETEVENT
|
||
COUT
|
||
IRQ sec
|
||
rts
|
||
*--------------------------------------
|
||
CLOSE clc
|
||
rts
|
||
*--------------------------------------
|
||
GETINFO >LDYA L.DEVINFO
|
||
clc
|
||
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)
|
||
*--------------------------------------
|
||
SETPIXEL sta SETHIRES
|
||
sta SET80STORE prepare for page switching
|
||
|
||
>PULLA Pull Mode
|
||
and #$FF
|
||
bpl SETPIXEL.1
|
||
|
||
SETPIXEL.XOR >PULLYA Y=X.LO,A=X.HI
|
||
lsr if 256 =< x < 511
|
||
bcs .1
|
||
lsr
|
||
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
|
||
tay
|
||
bcs .4 odd=main ram
|
||
sta SETPAGE2
|
||
bra .5
|
||
.4 sta CLRPAGE2
|
||
|
||
.5 >PULLA Pull Y
|
||
tax
|
||
lda BASEL,x setup line Base Ptr
|
||
sta ZPBASE
|
||
lda BASEH,x
|
||
sta ZPBASE+1
|
||
|
||
lda (ZPBASE),y
|
||
eor Mono.Masks,x
|
||
sta (ZPBASE),y
|
||
rts
|
||
*--------------------------------------
|
||
SETPIXEL.1 lsr
|
||
bcc SETPIXEL.COLOR
|
||
|
||
>PULLYA Y=X.LO,A=X.HI
|
||
lsr if 256 =< x < 511
|
||
bcs .1
|
||
lsr
|
||
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
|
||
tay
|
||
bcs .4 odd=main ram
|
||
sta SETPAGE2
|
||
bra .5
|
||
.4 sta CLRPAGE2
|
||
|
||
.5 phx
|
||
>PULLA Pull Y
|
||
tax
|
||
lda BASEL,x setup line Base Ptr
|
||
sta ZPBASE
|
||
lda BASEH,x
|
||
sta ZPBASE+1
|
||
plx
|
||
|
||
>PULLA Pull Color
|
||
lsr
|
||
bcs .6 set white pixel
|
||
|
||
lda (ZPBASE),y
|
||
and Mono.NMasks,x includes And $7F for mono
|
||
sta (ZPBASE),y
|
||
rts
|
||
|
||
.6 lda (ZPBASE),y
|
||
and #$7F switch back this byte to mono
|
||
ora Mono.Masks,x
|
||
sta (ZPBASE),y
|
||
rts
|
||
*--------------------------------------
|
||
SETPIXEL.COLOR >PULLA Get X.LO...
|
||
pha
|
||
>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
|
||
tax
|
||
lda BASEL,x setup line Base Ptr
|
||
sta ZPBASE
|
||
lda BASEH,x
|
||
sta ZPBASE+1
|
||
|
||
lda DIV7.0,y
|
||
|
||
asl Carry Cleared, by ASL
|
||
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
|
||
tax set in X for Masks,NMasks
|
||
|
||
>PULLA get COLOR
|
||
|
||
asl
|
||
asl
|
||
tay
|
||
|
||
lda Color.Masks,x
|
||
beq .1
|
||
and Color.Pixels,y apply color
|
||
sta GBYTE
|
||
|
||
sta SETPAGE2
|
||
lda (ZPBASE)
|
||
and Color.NMasks,x reset existing pixel,
|
||
ora GBYTE
|
||
sta (ZPBASE)
|
||
|
||
.1 inx
|
||
iny
|
||
|
||
lda Color.Masks,x
|
||
beq .2
|
||
and Color.Pixels,y apply color
|
||
sta GBYTE
|
||
|
||
sta CLRPAGE2
|
||
lda (ZPBASE)
|
||
and Color.NMasks,x reset existing pixel,
|
||
ora GBYTE
|
||
sta (ZPBASE)
|
||
|
||
.2 inc ZPBASE
|
||
inx
|
||
iny
|
||
|
||
lda Color.Masks,x
|
||
beq .3
|
||
and Color.Pixels,y apply color
|
||
sta GBYTE
|
||
|
||
sta SETPAGE2
|
||
lda (ZPBASE)
|
||
and Color.NMasks,x reset existing pixel,
|
||
ora GBYTE
|
||
sta (ZPBASE)
|
||
|
||
.3 inx
|
||
iny
|
||
|
||
lda Color.Masks,x
|
||
beq .8
|
||
and Color.Pixels,y apply color
|
||
sta GBYTE
|
||
|
||
sta CLRPAGE2
|
||
lda (ZPBASE)
|
||
and Color.NMasks,x reset existing pixel,
|
||
ora GBYTE
|
||
sta (ZPBASE)
|
||
|
||
.8 rts
|
||
*--------------------------------------
|
||
GETPIXEL
|
||
*--------------------------------------
|
||
HLINE
|
||
*--------------------------------------
|
||
VLINE
|
||
*--------------------------------------
|
||
FILLREC
|
||
*--------------------------------------
|
||
* params : X,Y,W,H
|
||
*--------------------------------------
|
||
BITBLT
|
||
rts
|
||
*--------------------------------------
|
||
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)
|
||
*--------------------------------------
|
||
* 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 #%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
|
||
.DA #%01111111,#%01111111,#%01111111,#%01111111 white (color bit disable)
|
||
*--------------------------------------
|
||
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
|
||
*--------------------------------------
|
||
GBYTE .BS 1
|
||
*--------------------------------------
|
||
DEVINFO .DA #S.DEVINFO.TYPE.GFX type of DEVINFO STRUCT
|
||
DEVINFO.MODES .DA #%10000011 XOR,16 & B/W
|
||
DEVINFO.W .DA 560 X.SIZE
|
||
DEVINFO.H .DA 192 Y.SIZE
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE DRV/DHGR.DRV.S
|
||
ASM
|