A2osX/DRV/DHGR.DRV.S.txt
2017-12-22 22:24:30 +01:00

436 lines
9.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.

NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
.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/PRODOS.I
.INB /A2OSX.BUILD/INC/IO.I
.INB /A2OSX.BUILD/INC/GFX.I
.INB /A2OSX.BUILD/INC/GFX.EVE.I
.INB /A2OSX.BUILD/INC/GUI.I
.INB /A2OSX.BUILD/INC/LIBGUI.I
*--------------------------------------
ZPCmdPtr .EQ ZPDRV
ZPBasePtr .EQ ZPDRV+2
ZPBMShiftPtr .EQ ZPDRV+4
ZPScrShiftPtr .EQ ZPDRV+6
ZPBMDataPtr .EQ ZPDRV+8
ZPBMMaskPtr .EQ ZPDRV+10
ZPBMSavePtr .EQ ZPDRV+12
*--------------------------------------
* 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
L.MSG.DETECT.IIC .DA MSG.DETECT.IIC
L.MSG.DETECT.EVE .DA MSG.DETECT.EVE
L.MSG.DETECT.80C .DA MSG.DETECT.80C
.DA 0 End Of Reloc Table
*--------------------------------------
Dev.Detect >LDYA L.MSG.DETECT
>SYSCALL PrintF.YA
lda MACHID
and #MACHID.T
cmp #MACHID.T.IIc
bne .1
lda #$80
sta DSTAT+S.DSTAT.ST $80=//c
>LDYA L.MSG.DETECT.IIC
bra .3
.1 php
sei
sta SET80STORE
sta SETPAGE2
ldx $400 Save Aux $400
lda #$ff Make sure !=1 for comparing later
sta $400
sta CLRPAGE2
ldy $400 Save Main $400
lda #$01 Select Foreground/BKgrnd Colors
sta TXT16.ON Activate 16 color mode
sta $400 Store something in Main
sta SETPAGE2
eor $400 read back AUX, If EVE, must be F/BG colors
bne .2
dec
sta DSTAT+S.DSTAT.ST 0=80C,$ff=EVE
.2 stx $400 Set back Aux $400
sta CLRPAGE2
sty $400 Set back Main $400
sta CLR80STORE
plp
>LDYA L.MSG.DETECT.EVE
bit DSTAT+S.DSTAT.ST
bmi .3
>LDYA L.MSG.DETECT.80C
.3 >SYSCALL PrintF.YA
clc
rts
*--------------------------------------
CS.END
MSG.DETECT >CSTR "Apple IIe/IIc DHGR Driver.\r\n"
MSG.DETECT.IIC >CSTR "Apple //c detected, Assuming 'Le Chat Mauve' Mode.\r\n"
MSG.DETECT.EVE >CSTR "'Le Chat Mauve EVE' Board Detected.\r\n"
MSG.DETECT.80C >CSTR "No Specific H/W Found, Assuming 80c Mode.\r\n"
*--------------------------------------
* Device Header (16 Bytes)
*--------------------------------------
DEV.HEADER cld
jmp (DRV.CS.START,x)
.DA #0
.BS 6
DEV.HEADER.NAME >CSTR "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 WRITE
.DA A2osX.BADCALL
*--------------------------------------
J.Cmds .DA SETPIXEL
.DA GETPIXEL
.DA HLINE
.DA VLINE
.DA FILLRECT
.DA BITBLT
.DA GETRECTBUFSIZE
*--------------------------------------
J.LBUF.DrawAtY .DA LBUF.DrawAtY.XOR
.DA LBUF.DrawAtY.SET
.DA LBUF.DrawAtY.ORA
.DA $ffff
.DA LBUF.DrawAtY.AND.XOR
.DA LBUF.DrawAtY.AND.SET
.DA LBUF.DrawAtY.AND.ORA
L.SHIFT .DA SHIFT.L1
.DA SHIFT.L2
.DA SHIFT.L3
.DA SHIFT.L4
.DA SHIFT.L5
.DA SHIFT.L6
L.DSTAT .DA DSTAT
L.Color.Pixels .DA Color.Pixels
.DA 0 end or relocation
*--------------------------------------
STATUS >LDYA L.DSTAT
clc
rts
*--------------------------------------
OPEN sta A2osX.SCRNDEVS+2 DEV.ID in A
ldx #0
ldy #1
.1 lda L.SHIFT,x Get relocated LO BYTE
sta Shift.L.LO,y
inx
lda L.SHIFT,x Get relocated HI BYTE
sta Shift.L.HI,y
inx
iny
cpx #12
bne .1
ldx #0 SHIFT.L1 = SHIFT.R6 !!!
ldy #6
.2 lda L.SHIFT,x Get relocated LO BYTE
sta Shift.R.LO,y
inx
lda L.SHIFT,x Get relocated HI BYTE
sta Shift.R.HI,y
inx
dey
bne .2
*--------------------------------------
CONTROL ldy #0
bit DSTAT+S.DSTAT.ST
bmi .1 //c,EVE mode
ldy #CONTROL.LCM-CONTROL.80C
.1 ldx CONTROL.SWTCHES,y
bmi .8 Ending $ff
sta $C000,x
iny
bra .1
.8 lda #3
sta A2osX.ASCREEN
clc
rts
*--------------------------------------
CLOSE clc
rts
*--------------------------------------
WRITE >STYA ZPCmdPtr
sta SETHIRES Make sure SET80STORE active at $2000
sta SET80STORE
lda (ZPCmdPtr) Get Cmd
.1 tax
ldy CB.CmdLen,x
.2 lda (ZPCmdPtr),y
sta CB.Cache,y
dey
bpl .2
.3 jsr .10
sta CLRPAGE2
sta CLR80STORE
clc
rts
.10 jmp (J.Cmds,x)
*--------------------------------------
* IN:
* Y = LO
* A = HI
* OUT:
* A = DIV
* X = MOD
*--------------------------------------
DIVMOD7YA dec
bmi .2
clc
beq .1
lda DIV7.512,y
adc #$49
ldx MOD7.512,y
rts
.1 lda DIV7.256,y
adc #$24
ldx MOD7.256,y
rts
.2 lda DIV7.0,y
ldx MOD7.0,y
rts
*--------------------------------------
* IN:
* Y,A = num1 (16)
* X = num2 (8)
* OUT:
* Y,A = (Y,A) * X
*--------------------------------------
YAMultX stx GBYTE
sty GWORD
sta GWORD+1
ldy #0 Result LO
tya Result HI
bra .3
.1 pha
tya
clc
adc GWORD
tay
pla
adc GWORD+1
.2 asl GWORD
rol GWORD+1
.3 lsr GBYTE
bcs .1
bne .2
rts
*--------------------------------------
.INB /A2OSX.SRC/DRV/DHGR.DRV.S.BLT
.INB /A2OSX.SRC/DRV/DHGR.DRV.S.LBUF
.INB /A2OSX.SRC/DRV/DHGR.DRV.S.LINE
.INB /A2OSX.SRC/DRV/DHGR.DRV.S.PIX
.INB /A2OSX.SRC/DRV/DHGR.DRV.S.RECT
*--------------------------------------
DRV.CS.END
*--------------------------------------
.INB /A2OSX.SRC/DRV/DHGR.DRV.G
*--------------------------------------
CONTROL.SWTCHES
* sta CLRTEXT
* sta CLRMIXED
* sta SETHIRES
* sta CLR80STORE
* sta CLRPAGE2
* sta SETIOUDIS
CONTROL.80C
* sta CLRMIXED STA $CO52 ;Full Screen
* sta SETHIRES STA $C057 ;HIRES
* sta CLRTEXT STA $C050 ;Graphics
* sta CLR80DISP STA $C00C ;80 Columns OFF
* sta SETDHIRES STA $C05E ;AN3 OFF
* sta CLRDHIRES STA $C05F ;AN3 ON
* sta SETDHIRES STA $C05E ;AN3 OFF
* sta CLRDHIRES STA $C05F ;AN3 ON
* sta SET80DISP STA $C00D ;80 Columns ON
* sta SETDHIRES STA $C05E ;AN3 OFF
* sta CLRDHIRES STA $C05F ;AN3 ON
* sta SETDHIRES STA $C05E ;AN3 OFF
.DA #CLRTEXT
.DA #CLRMIXED
.DA #SETHIRES
.DA #CLR80STORE
.DA #CLRPAGE2
.DA #SETIOUDIS
.DA #CLR80DISP
.DA #SETDHIRES
.DA #CLRDHIRES
.DA #SETDHIRES
.DA #CLRDHIRES
.DA #SET80DISP
.DA #SETDHIRES
.DA #CLRDHIRES
.DA #SETDHIRES
.DA #$FF
CONTROL.LCM
* sta CLRTEXT
* sta CLRPAGE2
* sta CLRMIXED
* sta SETHIRES
* sta CLRAN2
* sta CLR80DISP
* sta SETDHIRES
* sta CLRDHIRES
* sta SET80DISP
* sta SETDHIRES
* sta CLRDHIRES
* sta SETDHIRES
.DA #CLRTEXT
.DA #CLRMIXED
.DA #SETHIRES
.DA #CLR80STORE
.DA #CLRPAGE2
.DA #SETIOUDIS
.DA #CLRAN2
.DA #CLR80DISP
.DA #SETDHIRES
.DA #CLRDHIRES
.DA #SET80DISP
.DA #SETDHIRES
.DA #CLRDHIRES
.DA #SETDHIRES
.DA #$ff
*--------------------------------------
Shift.L.LO .BS 7
Shift.L.HI .BS 7
Shift.R.LO .BS 7
Shift.R.HI .BS 7
*--------------------------------------
CB.CmdLen .DA S.CB.Y1+1 SETPIXEL
.DA S.CB.Y1+1 GETPIXEL
.DA S.CB.X2+1 HLINE
.DA S.CB.Y2+1 VLINE
.DA S.CB.Y2+1 FILLRECT
.DA S.CB.DstPtr+1 BITBLT
.DA S.CB.DstPtr+1 GETRECTBUFSIZE
*--------------------------------------
CB.Cache .BS S.CB
BM.Cache .BS S.BM
*--------------------------------------
LBUF.C1 .BS 1
LBUF.C1.MASK .BS 1 Bits to CLR in VMEM : 11100000 00000000 00111111
LBUF.C1.DATA .BS 1 Bits to SET/ORA/XOR : 000ccccc cccccccc cc000000
LBUF.C2 .BS 1 C1 C2
LBUF.C2.MASK .BS 1
LBUF.C2.DATA .BS 1
LBUF.MASK .BS 81 81 because of sta LBUF.DATA+1,x!!!
LBUF.DATA .BS 81
*--------------------------------------
BLT.BMMaskPtr .BS 2
BLT.BMDataPtr .BS 2
BLT.BMBitOfs .BS 1
BLT.BMBitOfsL .BS 1
BLT.ScrBitOfs .BS 1
BLT.ScrColIdx .BS 1
BLT.CMASK .BS 1
*--------------------------------------
GBYTE .BS 1
GWORD .BS 2
*--------------------------------------
DSTAT .DA #0
.DA #0,#0,#0
>PSTR "Apple II DHGR"
.BS 3
.DA #S.DSTAT.T.GFX
.DA #0
.DA #0
.DA #91
*--------------------------------------
.DA #S.CB.M.MONO+S.CB.M.C16
.DA #0 S
.DA 560 W
.DA 192 H
*--------------------------------------
MAN
SAVE /A2OSX.SRC/DRV/DHGR.DRV.S
ASM