A2osX/DRV/DHGR.DRV.S.txt
2017-08-22 08:37:03 +02:00

347 lines
6.6 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

PR#3
PREFIX /A2OSX.BUILD
LOMEM $A00
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BUILD/DRV/DHGR.DRV
*--------------------------------------
.INB /A2OSX.BUILD/INC/MACROS.I
.INB /A2OSX.BUILD/INC/A2OSX.I
.INB /A2OSX.BUILD/INC/IO.I
.INB /A2OSX.BUILD/INC/LIBGFX.I
*--------------------------------------
ZPBase .EQ ZPDRV
ZPCount .EQ ZPDRV+2
ZPCountCol .EQ ZPDRV+4
ZPCountMod .EQ ZPDRV+5
*--------------------------------------
* 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 PrintFYA
ldx #0
.1 txa
stz Shift0.hi,x
asl
rol Shift0.hi,x
lsr
sta Shift0.lo,x
inx
bpl .1
ldx #0
.2 lda Shift0.hi,x
sta Shift1.hi,x
lda Shift0.lo,x
asl
asl
rol Shift1.hi,x
lsr
sta Shift1.lo,x
inx
bpl .2
ldx #0
.3 lda Shift1.hi,x
sta Shift2.hi,x
lda Shift1.lo,x
asl
asl
rol Shift2.hi,x
lsr
sta Shift2.lo,x
inx
bpl .3
ldx #0
.4 lda Shift2.hi,x
sta Shift3.hi,x
lda Shift2.lo,x
asl
asl
rol Shift3.hi,x
lsr
sta Shift3.lo,x
inx
bpl .4
ldx #0
.5 lda Shift3.hi,x
sta Shift4.hi,x
lda Shift3.lo,x
asl
asl
rol Shift4.hi,x
lsr
sta Shift4.lo,x
inx
bpl .5
ldx #0
.6 lda Shift4.hi,x
sta Shift5.hi,x
lda Shift4.lo,x
asl
asl
rol Shift5.hi,x
lsr
sta Shift5.lo,x
inx
bpl .6
ldx #0
.7 lda Shift5.hi,x
sta Shift6.hi,x
lda Shift5.lo,x
asl
asl
rol Shift6.hi,x
lsr
sta Shift6.lo,x
inx
bpl .7
clc
rts
CS.END
MSG.DETECT >CSTR "Apple IIe/IIc DHGR Driver.\r\n"
*--------------------------------------
* Device Header (16 Bytes)
*--------------------------------------
DEV.HEADER cld
jmp (DRV.CS.START,x)
.DA #0
.BS 6
DEV.HEADER.NAME >PSTR "GFX"
.BS 1
*--------------------------------------
* Driver Code
*--------------------------------------
DRV.CS.START .DA STATUS
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA CONTROL
.DA A2osX.BADCALL
.DA OPEN
.DA CLOSE
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA A2osX.BADCALL
*--------------------------------------
.DA SETPIXEL
.DA GETPIXEL
.DA HLINE
.DA VLINE
.DA FILLRECT
.DA BITBLT
*--------------------------------------
L.STAT .DA STAT
L.DIV7.0 .DA DIV7.0
.DA DIV7.256
.DA DIV7.512
L.MOD7.0 .DA MOD7.0
.DA MOD7.256
.DA MOD7.512
L.Shift0.Lo .DA Shift0.lo
L.Shift0.Hi .DA Shift0.hi
L.DIVMOD7Y0 .DA DIVMOD7Y0
.DA DIVMOD7Y1
.DA DIVMOD7Y2
.DA 0 end or relocation
*--------------------------------------
STATUS >LDYA L.STAT
clc
rts
*--------------------------------------
OPEN sta A2osX.SCRNDEVS+2 DEV.ID in A
ldy #0
ldx #0
.1 lda L.DIV7.0,y
sta DIV7.lo,x
lda L.MOD7.0,y
sta MOD7.lo,x
iny
lda L.DIV7.0,y
sta DIV7.hi,x
lda L.MOD7.0,y
sta MOD7.hi,x
iny
inx
cpx #3
bne .1
ldx #7
lda L.Shift0.Lo+1
.10 sta Shiftlo.hi,x
inc
dex
bne .10
ldx #7
lda L.Shift0.hi+1
.11 sta Shifthi.hi,x
inc
dex
bne .11
.8 clc
rts
*--------------------------------------
CONTROL sta CLRTEXT
sta CLRMIXED
sta SETHIRES
sta CLR80STORE
sta CLRPAGE2
sta SETIOUDIS
sta SETDHIRES
* sta CLR80DISP
* sta SETDHIRES
* sta CLRDHIRES
* sta SET80DISP
* sta SETDHIRES
* sta CLRDHIRES
* sta SETDHIRES
lda #3
sta A2osX.ASCREEN
clc
rts
*--------------------------------------
CLOSE clc
rts
*--------------------------------------
.INB /A2OSX.SRC/DRV/DHGR.DRV.S.PIX
.INB /A2OSX.SRC/DRV/DHGR.DRV.S.LIN
.INB /A2OSX.SRC/DRV/DHGR.DRV.S.BLT
*--------------------------------------
* FILLRECT
* 2 : Mode
* 3 : Color
* 4 : SrcX1
* 6 : SrcY1
* 8 : SrcX2
* 10 : SrcY2
*--------------------------------------
FILLRECT >STYA ZPBase
ldy #S.CB.Y2
.1 lda (ZPBase),y
sta CB.Cache,y
dey
bpl .1
.2 jsr HLINE.I
lda CB.Cache+S.CB.Y1
cmp CB.Cache+S.CB.Y2
beq .8
inc CB.Cache+S.CB.Y1
bra .2
.8 rts
*--------------------------------------
* IN:
* Y = LO
* X = HI
* OUT:
* A = DIV
* X = MOD
*--------------------------------------
DIVMOD7YX jmp (L.DIVMOD7Y0,x)
DIVMOD7Y0 lda DIV7.0,y
ldx MOD7.0,y
rts
DIVMOD7Y1 lda DIV7.256,y
clc
adc #$24
ldx MOD7.256,y
rts
DIVMOD7Y2 lda DIV7.512,y
clc
adc #$49
ldx MOD7.512,y
rts
*--------------------------------------
DRV.CS.END
*--------------------------------------
Shift0.lo .BS 128
Shift0.hi .BS 128
Shift1.lo .BS 128
Shift1.hi .BS 128
Shift2.lo .BS 128
Shift2.hi .BS 128
Shift3.lo .BS 128
Shift3.hi .BS 128
Shift4.lo .BS 128
Shift4.hi .BS 128
Shift5.lo .BS 128
Shift5.hi .BS 128
Shift6.lo .BS 128
Shift6.hi .BS 128
*--------------------------------------
.INB /A2OSX.SRC/DRV/DHGR.DRV.T
*--------------------------------------
DIV7.lo .BS 3
DIV7.hi .BS 3
MOD7.lo .BS 3
MOD7.hi .BS 3
Shiftlo.hi .BS 7
Shifthi.hi .BS 7
*--------------------------------------
CB.Cache .BS S.CB
*--------------------------------------
XDIV7 .BS 1
XMOD7 .BS 1
XCOL7 .BS 1
GBYTE .BS 1
*--------------------------------------
STAT .DA #0
.DA #0,#0,#0
>PSTR "Apple II DHGR"
.BS 3
.DA #S.DEVSTAT.T.GFX
.DA #0
.DA $0900
*--------------------------------------
DEVSTAT.MODES .DA #S.CB.MODE.MONO+S.CB.MODE.C16
DEVSTAT.W .DA 560 X.SIZE
DEVSTAT.H .DA 192 Y.SIZE
*--------------------------------------
DRV.SIZE .EQ *-DRV.CS.START
*--------------------------------------
.LIST OFF
MAN
SAVE /A2OSX.SRC/DRV/DHGR.DRV.S
ASM