mirror of
https://github.com/bobbimanners/Applecorn.git
synced 2025-01-05 19:29:37 +00:00
Reverted JGH's VDU driver PR for now. Breaks too much!
This commit is contained in:
parent
29507b1471
commit
aa639c8922
BIN
applecorn.po
BIN
applecorn.po
Binary file not shown.
@ -7,7 +7,6 @@
|
|||||||
* Assembled with the Merlin 8 v2.58 assembler on Apple II.
|
* Assembled with the Merlin 8 v2.58 assembler on Apple II.
|
||||||
|
|
||||||
XC ; 65c02
|
XC ; 65c02
|
||||||
XC ; 65816
|
|
||||||
ORG $4000 ; Load addr of loader in main memory
|
ORG $4000 ; Load addr of loader in main memory
|
||||||
; Clear of first HGR frame buffer
|
; Clear of first HGR frame buffer
|
||||||
|
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
* 09-Sep-2021 Moved keyboard and VDU OSBYTEs to Keyboard and VDU.
|
* 09-Sep-2021 Moved keyboard and VDU OSBYTEs to Keyboard and VDU.
|
||||||
|
|
||||||
|
|
||||||
|
XC ; 65c02
|
||||||
|
|
||||||
*************************
|
*************************
|
||||||
* OSBYTE DISPATCH TABLE *
|
* OSBYTE DISPATCH TABLE *
|
||||||
*************************
|
*************************
|
||||||
|
468
auxmem.vdu.s
468
auxmem.vdu.s
@ -13,9 +13,6 @@
|
|||||||
* 09-Sep-2021 New dispatch routine.
|
* 09-Sep-2021 New dispatch routine.
|
||||||
* 22-Sep-2021 More VDU workspace, started MODE definitions.
|
* 22-Sep-2021 More VDU workspace, started MODE definitions.
|
||||||
* 23-Sep-2021 More or less sorted VDU workspace.
|
* 23-Sep-2021 More or less sorted VDU workspace.
|
||||||
* 24-Sep-2021 Characters always stored in text buffer even with graphics screen.
|
|
||||||
* 24-Sep-2021 AppleGS text written/read via 65816 screen banks.
|
|
||||||
* 25-Sep-2021 VDU 22 sets up MODE definitions.
|
|
||||||
|
|
||||||
|
|
||||||
**********************************
|
**********************************
|
||||||
@ -36,15 +33,10 @@ VDUSTATUS EQU $D0 ; $D0 # VDU status
|
|||||||
* bit 1 = Don't scroll (COPY cursor or VDU 5 mode)
|
* bit 1 = Don't scroll (COPY cursor or VDU 5 mode)
|
||||||
* bit 0 = VDU 2 printer echo active
|
* bit 0 = VDU 2 printer echo active
|
||||||
*
|
*
|
||||||
VDUCHAR EQU VDUSTATUS+1 ; $D1 current control character
|
VDUCHAR EQU VDUSTATUS+1 ; $D1
|
||||||
VDUTEMP EQU VDUCHAR ; &D1
|
VDUADDR EQU VDUSTATUS+4 ; $D4 address of current char cell
|
||||||
VDUADDR EQU VDUSTATUS+2 ; $D2 address of current char cell
|
OLDCHAR EQU OSKBD1 ; *TEMP* character under cursor
|
||||||
VDUBANK EQU VDUADDR+2 ; $D4 screen bank
|
COPYCHAR EQU OSKBD2 ; *TEMP* character under copy cursor
|
||||||
VDUADDR2 EQU VDUADDR+3 ; $D5 address being scrolled
|
|
||||||
VDUBANK2 EQU VDUBANK+3 ; $D7 screen bank being scrolled
|
|
||||||
*
|
|
||||||
OLDCHAR EQU OSKBD1 ; &EC character under cursor
|
|
||||||
COPYCHAR EQU OSKBD2 ; &ED character under copy cursor
|
|
||||||
|
|
||||||
* VDU DRIVER MAIN WORKSPACE
|
* VDU DRIVER MAIN WORKSPACE
|
||||||
***************************
|
***************************
|
||||||
@ -74,57 +66,50 @@ VDUCOPYX EQU VDUVARS+$1A ; absolute COPY text X posn
|
|||||||
VDUCOPYY EQU VDUVARS+$1B ; absolute COPY text Y posn
|
VDUCOPYY EQU VDUVARS+$1B ; absolute COPY text Y posn
|
||||||
*
|
*
|
||||||
PIXELPLOTX EQU VDUVARS+$1C ; PLOT graphics X in pixels
|
PIXELPLOTX EQU VDUVARS+$1C ; PLOT graphics X in pixels
|
||||||
PIXELPLOTY EQU VDUVARS+$1E ; PLOT graphics Y in pixels
|
PIXELPLOTY EQU VDUVARS+$1E ; PLOT graphics Y in pixels
|
||||||
PIXELPOSNX EQU VDUVARS+$20 ; current graphics X in pixels
|
PIXELPOSNX EQU VDUVARS+$20 ; current graphics X in pixels
|
||||||
PIXELPOSNY EQU VDUVARS+$22 ; current graphics Y in pixels
|
PIXELPOSNY EQU VDUVARS+$22 ; current graphics Y in pixels
|
||||||
PIXELLASTX EQU VDUVARS+$24 ; last graphics X in pixels
|
PIXELLASTX EQU VDUVARS+$24 ; last graphics X in pixels
|
||||||
PIXELLASTY EQU VDUVARS+$26 ; last graphics Y in pixels
|
PIXELLASTY EQU VDUVARS+$26 ; last graphics Y in pixels
|
||||||
VDURESETEND EQU VDUVARS+$27 ; end of section reset by VDU 26
|
|
||||||
*
|
*
|
||||||
CURSOR EQU VDUVARS+$28 ; character used for cursor
|
CURSOR EQU VDUVARS+$28 ; character used for cursor
|
||||||
CURSORCP EQU VDUVARS+$29 ; character used for copy cursor
|
CURSORED EQU VDUVARS+$29 ; character used for edit cursor
|
||||||
CURSORED EQU VDUVARS+$2A ; character used for edit cursor
|
CURSORCP EQU VDUVARS+$2A ; character used for copy cursor
|
||||||
*
|
*
|
||||||
VDUQ EQU VDUVARS+$2B ; $2B..$33
|
VDUQ EQU VDUVARS+$2B ; $2B..$33
|
||||||
VDUQLAST EQU VDUQ+1 ; Neatly becomes VDUVARS+$2C
|
VDUQLAST EQU VDUQ+1 ; Neatly becomes VDUVARS+$2C
|
||||||
VDUQPLOT EQU VDUQ+5 ; Neatly becomes VDUVARS+$30
|
VDUQPLOT EQU VDUQ+5 ; Neatly becomes VDUVARS+$30
|
||||||
*
|
*
|
||||||
VDUBORDER EQU VDUVARS+$34 ; border colour
|
VDUBORDER EQU VDUVARS+$34 ; Border colour
|
||||||
VDUMODE EQU VDUVARS+$35 ; # current MODE
|
VDUMODE EQU VDUVARS+$35 ; # current MODE
|
||||||
VDUSCREEN EQU VDUVARS+$36 ; # MODE type
|
VDUSCREEN EQU VDUVARS+$36 ; # MODE type
|
||||||
TXTFGD EQU VDUVARS+$37 ; # text foreground
|
TXTFGD EQU VDUVARS+$37 ; # Text foreground
|
||||||
TXTBGD EQU VDUVARS+$38 ; # text background
|
TXTBGD EQU VDUVARS+$38 ; # Text background
|
||||||
GFXFGD EQU VDUVARS+$39 ; # graphics foreground
|
GFXFGD EQU VDUVARS+$39 ; # Graphics foreground
|
||||||
GFXBGD EQU VDUVARS+$3A ; # graphics background
|
GFXBGD EQU VDUVARS+$3A ; # Graphics background
|
||||||
GFXPLOTFGD EQU VDUVARS+$3B ; # foreground GCOL action
|
GFXPLOTFGD EQU VDUVARS+$3B ; # Foreground GCOL action
|
||||||
GFXPLOTBGD EQU VDUVARS+$3C ; # background GCOL action
|
GFXPLOTBGD EQU VDUVARS+$3C ; # Background GCOL action
|
||||||
VDUVAR3D EQU VDUVARS+$3D
|
VDUVAR3D EQU VDUVARS+$3D
|
||||||
VDUVAR3E EQU VDUVARS+$3E
|
VDUVAR3E EQU VDUVARS+$3E
|
||||||
VDUBYTES EQU VDUVARS+$3F ; # bytes per char, 1=text only
|
VDUBYTES EQU VDUVARS+$3F ; # bytes per char, 1=text only
|
||||||
VDUCOLOURS EQU VDUVARS+$40 ; # colours-1
|
VDUCOLOURS EQU VDUVARS+$40 ; # colours-1
|
||||||
VDUPIXELS EQU VDUVARS+$41 ; # pixels per byte
|
VDUPIXELS EQU VDUVARS+$41 ; # pixels per byte
|
||||||
VDUWORKSP EQU VDUVARS+$42 ; 28 bytes of general workspace
|
VDUWORKSP EQU VDUVARS+$42 ; 28 bytes of general workspace
|
||||||
VDUWORKSZ EQU VDUVAREND-VDUWORKSP+1
|
VDUWORKSZ EQU VDUVAREND-VDUWORKSP+1
|
||||||
*
|
*
|
||||||
|
|
||||||
* Screen definitions
|
* Screen definitions
|
||||||
* 3 6 7
|
* 0 1 2 3 4 5 6 7
|
||||||
SCNTXTMAXX DB 79,39,19,79,39,19,39,39 ; Max text column
|
SCNTXTMAXX DB 79,39,19,79,39,19,39,39 ; Max text column
|
||||||
SCNTXTMAXY DB 23,23,23,23,23,23,23,23 ; Max text row
|
SCNTXTMAXY DB 23,23,23,23,23,23,23,23 ; Max text row
|
||||||
*SCNBYTES DB 1, 1, 1, 1, 1, 1, 1, 1 ; Bytes per character
|
SCNBYTES DB 1,1,8,1,1,1,1,1
|
||||||
SCNBYTES DB 1, 1, 8, 1, 1, 1, 1, 1 ; Bytes per character
|
SCNCOLOURS DB 1,1,8,1,1,1,1,1
|
||||||
SCNCOLOURS DB 15,15,15,15,15,15,15,15 ; Colours-1
|
SCNTYPE DB 1,0,128,1,0,0,0,0
|
||||||
SCNPIXELS DB 0, 0, 7, 0, 0, 0, 0, 0 ; Pixels per byte
|
|
||||||
SCNTYPE DB 1, 0,128,1, 0, 0, 0,64 ; Screen type
|
|
||||||
* b7=FastDraw
|
* b7=FastDraw
|
||||||
* b6=Teletext
|
* b6=Teletext
|
||||||
* b0=40COL/80COL
|
* b0=40COL/80COL
|
||||||
* =
|
* =
|
||||||
|
|
||||||
* Colour table
|
|
||||||
CLRTRANS DB 00,01,04,09,02,03,07,10
|
|
||||||
DB 05,08,12,13,06,14,11,15
|
|
||||||
|
|
||||||
********************************************************************
|
********************************************************************
|
||||||
* Note that we use PAGE2 80 column mode ($800-$BFF in main and aux)
|
* Note that we use PAGE2 80 column mode ($800-$BFF in main and aux)
|
||||||
* and PAGE1 HGR mode ($2000-$23ff in main only)
|
* and PAGE1 HGR mode ($2000-$23ff in main only)
|
||||||
@ -335,49 +320,33 @@ PRCHRC PHA ; Save character
|
|||||||
:RESUME PLA
|
:RESUME PLA
|
||||||
|
|
||||||
* Put character to screen
|
* Put character to screen
|
||||||
* Puts character to text screen buffer, then in graphics mode,
|
PUTCHRC EOR #$80 ; Convert character
|
||||||
* writes bitmap to graphics screen
|
TAY
|
||||||
PUTCHRC PHA
|
|
||||||
EOR #$80 ; Convert character
|
|
||||||
TAX
|
|
||||||
AND #$A0
|
AND #$A0
|
||||||
BNE PRCHR4
|
BNE PRCHR4
|
||||||
CPX #$20
|
CPY #$20
|
||||||
BCS PRCHR3 ; Not $80-$9F
|
BCS PRCHR3 ; Not $80-$9F
|
||||||
BIT VDUSCREEN
|
BIT VDUSCREEN
|
||||||
BVC PRCHR3 ; Not teletext
|
BVC PRCHR3 ; Not teletext
|
||||||
LDX #$E0 ; Convert $80-$9F to space
|
LDY #$E0 ; Convert $80-$9F to space
|
||||||
PRCHR3 TXA
|
PRCHR3 TYA
|
||||||
EOR #$40
|
EOR #$40
|
||||||
TAX
|
TAY
|
||||||
PRCHR4 JSR CHARADDR ; Find character address
|
PRCHR4 PHY
|
||||||
TXA ; Get buffer code
|
JSR CHARADDR ; Find character address
|
||||||
BIT VDUBANK
|
PLA ; Get character back
|
||||||
BPL PRCHR5 ; Not AppleGS, use short write
|
PHA ; Stash it again
|
||||||
>>> WRTMAIN ; Need this or long write fails!!
|
PHP ; Disable IRQs while
|
||||||
CLC ; Enter 65816 native mode
|
SEI ; toggling memory
|
||||||
XCE
|
BCC PRCHR6 ; Aux memory
|
||||||
SEP #$30 ; 8-bit M and X
|
STA $C004 ; Switch to main memory
|
||||||
MX %11 ; Tell Merlin about it
|
PRCHR6 STA (VDUADDR),Y ; Store it
|
||||||
STA [VDUADDR],Y
|
STA $C005 ; Back to aux memory
|
||||||
SEC ; Return to emulation mode
|
PLP ; Restore IRQs
|
||||||
XCE
|
LDY VDUBYTES
|
||||||
>>> WRTAUX ; As we were
|
DEY ; If VDUBYTE=1, text mode
|
||||||
BRA PRCHR8
|
BEQ :DONE
|
||||||
PRCHR5 PHP ; Disable IRQs while
|
JSR HCHARADDR ; Addr in VDUADDR
|
||||||
SEI ; toggling memory
|
|
||||||
BCC PRCHR6 ; Aux memory
|
|
||||||
STA $C004 ; Switch to main memory
|
|
||||||
PRCHR6 STA (VDUADDR),Y ; Store it
|
|
||||||
PRCHR7 STA $C005 ; Back to aux memory
|
|
||||||
PLP ; Restore IRQs
|
|
||||||
PRCHR8 BIT VDUSCREEN
|
|
||||||
BMI PRCHRSOFT ; Write character to graphics
|
|
||||||
PLA
|
|
||||||
RTS
|
|
||||||
|
|
||||||
* Write character to HGR screen
|
|
||||||
PRCHRSOFT JSR HCHARADDR ; Addr in VDUADDR
|
|
||||||
PHP ; Disable IRQs while
|
PHP ; Disable IRQs while
|
||||||
SEI ; toggling memory
|
SEI ; toggling memory
|
||||||
STA $C004 ; Write to main
|
STA $C004 ; Write to main
|
||||||
@ -389,76 +358,58 @@ PRCHRSOFT JSR HCHARADDR ; Addr in VDUADDR
|
|||||||
PLP ; Restore IRQs
|
PLP ; Restore IRQs
|
||||||
PLA ; Recover character
|
PLA ; Recover character
|
||||||
>>> XF2MAIN,DRAWCHAR ; Plot char on HGR screen
|
>>> XF2MAIN,DRAWCHAR ; Plot char on HGR screen
|
||||||
|
:DONE PLA ; Discard character
|
||||||
|
RTS
|
||||||
|
|
||||||
PUTCHRET >>> ENTAUX
|
PUTCHRET >>> ENTAUX
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
* OSBYTE &87 - Read character at cursor
|
|
||||||
***************************************
|
|
||||||
* Fetch character from screen at (TEXTX,TEXTY) and return MODE in Y
|
* Fetch character from screen at (TEXTX,TEXTY) and return MODE in Y
|
||||||
* Reads from text screen buffer regardless of screen type
|
* Always uses text screen (which we maintain even in graphics mode)
|
||||||
BYTE87
|
BYTE87
|
||||||
GETCHRC JSR CHARADDR ; Find character address
|
GETCHRC JSR CHARADDR ; Find character address
|
||||||
BIT VDUBANK
|
PHP ; Disable IRQs while
|
||||||
BPL GETCHR5 ; Not AppleGS, use short read
|
SEI ; toggling memory
|
||||||
CLC ; Enter 65816 native mode
|
BCC GETCHR6 ; Aux memory
|
||||||
XCE
|
STA $C002 ; Switch to main memory
|
||||||
SEP #$30 ; 8-bit M and X
|
GETCHR6 LDA (VDUADDR),Y ; Get character
|
||||||
MX %11 ; Tell Merlin about it
|
STA $C003 ; Back to aux memory
|
||||||
LDA [VDUADDR],Y
|
PLP ; Restore IRQs
|
||||||
SEC ; Enter emulation mode
|
TAY ; Convert character
|
||||||
XCE
|
|
||||||
BRA GETCHR7
|
|
||||||
GETCHR5 PHP ; Disable IRQs while
|
|
||||||
SEI ; toggling memory
|
|
||||||
BCC GETCHR6 ; Aux memory
|
|
||||||
STA $C002 ; Switch to main memory
|
|
||||||
GETCHR6 LDA (VDUADDR),Y ; Get character
|
|
||||||
STA $C003 ; Back to aux memory
|
|
||||||
PLP ; Restore IRQs
|
|
||||||
GETCHR7 TAY ; Convert character
|
|
||||||
AND #$A0
|
AND #$A0
|
||||||
BNE GETCHR8
|
BNE GETCHR7
|
||||||
TYA
|
TYA
|
||||||
EOR #$40
|
EOR #$40
|
||||||
TAY
|
TAY
|
||||||
GETCHR8 TYA
|
GETCHR7 TYA
|
||||||
EOR #$80
|
EOR #$80
|
||||||
LDY VDUMODE ; Y=MODE
|
LDY VDUMODE ; Y=MODE
|
||||||
TAX ; X=char, flag=NE
|
TAX ; X=char
|
||||||
GETCHROK RTS
|
GETCHROK RTS
|
||||||
|
|
||||||
|
* Get text cursor position
|
||||||
* OSBYTE &86 - Get text cursor position
|
|
||||||
***************************************
|
|
||||||
BYTE86 LDY VDUTEXTY ; ROW ; $86 = read cursor pos
|
BYTE86 LDY VDUTEXTY ; ROW ; $86 = read cursor pos
|
||||||
LDX VDUTEXTX ; COL
|
LDX VDUTEXTX ; COL
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
* Calculate character address
|
* Calculate character address
|
||||||
* NB: VDUBANK (VDUADDR+2) is set by VDU22
|
|
||||||
CHARADDR LDA VDUTEXTY
|
CHARADDR LDA VDUTEXTY
|
||||||
CHARADDRY ASL
|
ASL
|
||||||
TAY
|
TAX
|
||||||
LDA SCNTAB+0,Y ; LSB of row address
|
LDA SCNTAB+0,X ; LSB of row address
|
||||||
STA VDUADDR+0
|
STA VDUADDR+0
|
||||||
LDA SCNTAB+1,Y ; MSB of row address
|
LDA SCNTAB+1,X ; MSB of row address
|
||||||
STA VDUADDR+1
|
STA VDUADDR+1
|
||||||
LDA VDUTEXTX
|
LDA VDUTEXTX
|
||||||
BIT $C01F
|
BIT $C01F
|
||||||
SEC
|
SEC
|
||||||
BPL CHARADDR40 ; 40-col
|
BPL CHARADDR40 ; 40-col
|
||||||
LSR A
|
LSR A
|
||||||
CHARADDR40 TAY ; Y=offset into this row
|
CHARADDR40 TAY ; Y=offset into this row
|
||||||
LDA VDUBANK
|
|
||||||
AND #$FE
|
|
||||||
BCS CHARADDROK
|
|
||||||
ORA #$01
|
|
||||||
CHARADDROK STA VDUBANK
|
|
||||||
RTS
|
RTS
|
||||||
* (VDUADDR),Y=>character address
|
* (VDUADDR),Y=>character address
|
||||||
* VDUBANK = AppleGS screen bank
|
* CC=auxmem
|
||||||
* CC=auxmem, CS=mainmem, X=preserved
|
* CS=mainmem
|
||||||
|
|
||||||
* Calculate character address in HGR mode
|
* Calculate character address in HGR mode
|
||||||
* This is the address of the first pixel row of the char
|
* This is the address of the first pixel row of the char
|
||||||
@ -553,46 +504,20 @@ VDU31 LDY VDUQ+8
|
|||||||
|
|
||||||
|
|
||||||
* VDU 26 - Reset to default windows
|
* VDU 26 - Reset to default windows
|
||||||
VDU26 LDA #$F7
|
VDU26 LDX VDUMODE
|
||||||
JSR CLRSTATUS ; Clear 'soft window'
|
VDU26A LDA SCNTXTMAXX,X
|
||||||
VDU26A LDX #VDURESETEND-VDUVARS
|
STA TXTWINRGT
|
||||||
LDA #$00
|
LDA SCNTXTMAXY,X
|
||||||
VDU26LP STA VDUVARS,X ; Clear all windows
|
STA TXTWINBOT
|
||||||
DEX ; and all coords
|
|
||||||
BPL VDU26LP ; and origin, etc.
|
|
||||||
LDY VDUMODE
|
|
||||||
LDA SCNTXTMAXY,Y
|
|
||||||
STA TXTWINBOT ; Text window height
|
|
||||||
STA GFXWINTOP ; Graphics height
|
|
||||||
LDX #GFXWINTOP-VDUVARS
|
|
||||||
LDA SCNTXTMAXX,Y
|
|
||||||
STA TXTWINRGT ; Text window width
|
|
||||||
STA GFXWINRGT ; Graphics width
|
|
||||||
LDX #GFXWINRGT-VDUVARS
|
|
||||||
* TO DO *
|
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* VDU 24,left;bottom;right;top; - define graphics window
|
|
||||||
VDU24 RTS
|
|
||||||
|
|
||||||
* VDU 28,left,bottom,right,top - define text window
|
|
||||||
VDU28 RTS
|
|
||||||
|
|
||||||
* VDU 29,x;y; - define graphics origin
|
|
||||||
VDU29 RTS
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* Initialise VDU driver
|
* Initialise VDU driver
|
||||||
***********************
|
***********************
|
||||||
* On entry, A=MODE to start in
|
* On entry, A=MODE to start in
|
||||||
* Assumes kernel has cleared workspace
|
|
||||||
*
|
*
|
||||||
VDUINIT STA VDUQ+8
|
VDUINIT STA VDUQ+8
|
||||||
* JSR FONTIMPLODE ; Reset VDU 23 font
|
|
||||||
|
|
||||||
* VDU 22 - MODE n
|
* VDU 22 - MODE n
|
||||||
*****************
|
*****************
|
||||||
@ -604,46 +529,59 @@ VDUINIT STA VDUQ+8
|
|||||||
* MODE 0 defaults to MODE 3
|
* MODE 0 defaults to MODE 3
|
||||||
* All others default to MODE 6
|
* All others default to MODE 6
|
||||||
*
|
*
|
||||||
* Wait for VSync?
|
|
||||||
VDU22 LDA VDUQ+8
|
VDU22 LDA VDUQ+8
|
||||||
AND #$07
|
AND #$07
|
||||||
TAX ; Set up MODE
|
STA VDUMODE
|
||||||
STX VDUMODE ; Screen MODE
|
TAX ; Set up MODE
|
||||||
LDA SCNCOLOURS,X
|
LDA #'_' ; Set up default cursors
|
||||||
STA VDUCOLOURS ; Colours-1
|
STA CURSOR ; Normal cursor
|
||||||
LDA SCNBYTES,X
|
STA CURSORCP ; Copy cursor when editing
|
||||||
STA VDUBYTES ; Bytes per char
|
|
||||||
LDA SCNPIXELS,X
|
|
||||||
STA VDUPIXELS ; Pixels per byte
|
|
||||||
LDA SCNTYPE,X
|
|
||||||
STA VDUSCREEN ; Screen type
|
|
||||||
JSR NEGCALL ; Find machine type
|
|
||||||
AND #$0F
|
|
||||||
BEQ :MODEGS ; MCHID=$x0 -> Not AppleGS, bank=0
|
|
||||||
LDA #$E0 ; Not $x0 -> AppleGS, point to screen bank
|
|
||||||
LDA #$00 ;;; DISABLE GS STUFF FOR NOW
|
|
||||||
:MODEGS STA VDUBANK
|
|
||||||
LDA #$01
|
|
||||||
JSR CLRSTATUS ; Clear everything except PrinterEcho
|
|
||||||
LDA #'_' ; Set up default cursors
|
|
||||||
STA CURSOR ; Normal cursor
|
|
||||||
STA CURSORCP ; Copy cursor when editing
|
|
||||||
LDA #$A0
|
LDA #$A0
|
||||||
STA CURSORED ; Edit cursor when editing
|
STA CURSORED ; Edit cursor when editing
|
||||||
JSR VDU20 ; Default colours
|
LDA #$01
|
||||||
JSR VDU26 ; Default windows
|
JSR CLRSTATUS ; Clear everything except PrinterEcho
|
||||||
STA $C052 ; Clear MIXED
|
JSR VDU26A
|
||||||
LDA VDUSCREEN
|
*
|
||||||
BMI VDU22G ; b7=1, graphics mode
|
LDA SCNBYTES,X
|
||||||
AND #$01 ; 40col/80col bit
|
STA VDUBYTES
|
||||||
|
LDA SCNCOLOURS,X
|
||||||
|
STA VDUCOLOURS
|
||||||
|
LDA SCNTYPE,X
|
||||||
|
STA VDUSCREEN
|
||||||
|
BMI VDU22G ; b7=1, graphics mode
|
||||||
|
* TEMP
|
||||||
|
CPX #2
|
||||||
|
BEQ VDU22G ; Jump out for MODE 1
|
||||||
|
* TEMP
|
||||||
|
*
|
||||||
|
AND #$01 ; 40col/80col bit
|
||||||
TAX
|
TAX
|
||||||
STA $C00C,X ; Select 40col/80col
|
STA $C00C,X ; Select 40col/80col
|
||||||
STA $C051 ; Enable Text
|
STA $C051 ; Enable Text
|
||||||
STA $C055 ; PAGE2
|
STA $C055 ; PAGE2
|
||||||
STA $C00F ; Enable alt charset
|
STA $C052 ; Clear MIXED
|
||||||
* Fall through into CLS
|
STA $C00F ; Enable alt charset
|
||||||
|
BRA VDU22CLR
|
||||||
|
|
||||||
VDU12 STZ FXLINES
|
|
||||||
|
VDU22G STA $C050 ; Enable Graphics
|
||||||
|
STA $C057 ; Hi-Res
|
||||||
|
STA $C054 ; PAGE1
|
||||||
|
STA $C052 ; Clear MIXED
|
||||||
|
STA $C00C ; Select 40col text
|
||||||
|
JMP VDU16 ; Clear HGR screen
|
||||||
|
|
||||||
|
VDU22CLR
|
||||||
|
* JSR VDU15 ; Turn off paged scrolling
|
||||||
|
* JSR VDU20 ; Reset colours
|
||||||
|
* JSR VDU26 ; Reset windows
|
||||||
|
* ; Drop through into VDU12, clear screen
|
||||||
|
|
||||||
|
|
||||||
|
VDU12 LDY VDUBYTES
|
||||||
|
DEY ; If VDUBYTE=1, text mode
|
||||||
|
BNE VDU12SOFT ; Graphics mode
|
||||||
|
JMP CLEAR
|
||||||
|
|
||||||
* Clear the screen
|
* Clear the screen
|
||||||
CLEAR STZ VDUTEXTY ; ROW
|
CLEAR STZ VDUTEXTY ; ROW
|
||||||
@ -656,16 +594,9 @@ CLEAR STZ VDUTEXTY ; ROW
|
|||||||
BRA :L1
|
BRA :L1
|
||||||
:S3 STZ VDUTEXTY ; ROW
|
:S3 STZ VDUTEXTY ; ROW
|
||||||
STZ VDUTEXTX ; COL
|
STZ VDUTEXTX ; COL
|
||||||
BIT VDUSCREEN
|
|
||||||
BMI VDU12SOFT ; Graphics mode
|
|
||||||
RTS
|
RTS
|
||||||
VDU12SOFT JMP VDU16 ; *TEMP*
|
VDU12SOFT JMP VDU16 ; *TEMP*
|
||||||
|
|
||||||
VDU22G STA $C050 ; Enable Graphics
|
|
||||||
STA $C057 ; Hi-Res
|
|
||||||
STA $C054 ; PAGE1
|
|
||||||
STA $C00C ; Select 40col text
|
|
||||||
JMP CLEAR ; Clear HGR & text screen
|
|
||||||
|
|
||||||
* Clear screen line
|
* Clear screen line
|
||||||
CLRLINE LDA VDUTEXTY ; ROW
|
CLRLINE LDA VDUTEXTY ; ROW
|
||||||
@ -714,76 +645,59 @@ CLRLNRET >>> ENTAUX
|
|||||||
* Scroll whole screen one line
|
* Scroll whole screen one line
|
||||||
SCROLLER LDA #$00
|
SCROLLER LDA #$00
|
||||||
:L1 PHA
|
:L1 PHA
|
||||||
JSR SCR1LINE
|
JSR SCR1LINE ; Scroll text screen 1 line
|
||||||
PLA
|
PLA
|
||||||
INC
|
LDY VDUBYTES
|
||||||
|
DEY ; If VDUBYTE=1, text mode
|
||||||
|
BEQ :TEXTONLY ; Text mode, skip HGR scroll
|
||||||
|
PHA
|
||||||
|
JSR HSCR1LINE ; Scroll HGR screen 1 text line
|
||||||
|
PLA
|
||||||
|
:TEXTONLY INC
|
||||||
CMP #23
|
CMP #23
|
||||||
BNE :L1
|
BNE :L1
|
||||||
BIT VDUSTATUS
|
BIT VDUSTATUS
|
||||||
BVC :L2 ; Copy cursor not active
|
BVC :L2 ; Copy cursor not active
|
||||||
JSR COPYSWAP1
|
JSR COPYSWAP1
|
||||||
LDA #11
|
LDA #11
|
||||||
JSR OUTCHARGO
|
JSR OUTCHARGO
|
||||||
JSR COPYSWAP1
|
JSR COPYSWAP1
|
||||||
:L2 RTS
|
:L2 RTS
|
||||||
|
|
||||||
|
* Copy line A+1 to line A
|
||||||
|
SCR1LINE ASL ; Dest addr->ZP1
|
||||||
|
TAX
|
||||||
|
LDA SCNTAB,X
|
||||||
|
STA ZP1
|
||||||
|
LDA SCNTAB+1,X
|
||||||
|
STA ZP1+1
|
||||||
|
INX ; Source addr->ZP2
|
||||||
|
INX
|
||||||
|
LDA SCNTAB,X
|
||||||
|
STA ZP2
|
||||||
|
LDA SCNTAB+1,X
|
||||||
|
STA ZP2+1
|
||||||
|
LDY #$00
|
||||||
|
:L1 LDA (ZP2),Y
|
||||||
|
STA (ZP1),Y
|
||||||
|
STA $C002 ; Read main mem
|
||||||
|
>>> WRTMAIN
|
||||||
|
LDA (ZP2),Y
|
||||||
|
STA (ZP1),Y
|
||||||
|
STA $C003 ; Read aux mem
|
||||||
|
>>> WRTAUX
|
||||||
|
INY
|
||||||
|
CPY #40
|
||||||
|
BNE :L1
|
||||||
|
RTS
|
||||||
|
|
||||||
* Copy text line A+1 to line A for HGR bitmap gfx mode
|
* Copy text line A+1 to line A for HGR bitmap gfx mode
|
||||||
SCR1SOFT
|
|
||||||
HSCR1LINE >>> XF2MAIN,HGRSCR1L
|
HSCR1LINE >>> XF2MAIN,HGRSCR1L
|
||||||
HSCR1RET >>> ENTAUX
|
HSCR1RET >>> ENTAUX
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
* Copy line A+1 to line A
|
* VDU 1 - Send one character to printer
|
||||||
SCR1LINE PHA
|
VDU01 RTS
|
||||||
BIT VDUSCREEN
|
|
||||||
BPL :NOSOFT
|
|
||||||
JSR SCR1SOFT
|
|
||||||
:NOSOFT JSR CHARADDRY ; VDUADDR=>line A
|
|
||||||
LDX #2
|
|
||||||
:L1 LDA VDUADDR,X ; Copy to VDUADDR2
|
|
||||||
STA VDUADDR2,X
|
|
||||||
DEX
|
|
||||||
BPL :L1
|
|
||||||
PLA
|
|
||||||
INC A
|
|
||||||
JSR CHARADDRY ; VDUADDR=>line A+1
|
|
||||||
BIT VDUBANK
|
|
||||||
BMI SCROLLGS
|
|
||||||
LDY #39
|
|
||||||
:L2 LDA (VDUADDR),Y
|
|
||||||
STA (VDUADDR2),Y
|
|
||||||
PHP
|
|
||||||
SEI
|
|
||||||
STA $C002 ; Read main mem
|
|
||||||
STA $C004 ; Write main mem
|
|
||||||
LDA (VDUADDR),Y
|
|
||||||
STA (VDUADDR2),Y
|
|
||||||
STA $C003 ; Read aux mem
|
|
||||||
STA $C005 ; Write aux mem
|
|
||||||
PLP
|
|
||||||
DEY
|
|
||||||
BPL :L2
|
|
||||||
RTS
|
|
||||||
SCROLLGS LDX #1
|
|
||||||
:L4 LDY #39
|
|
||||||
:L5 CLC ; Enter 65816 native mode
|
|
||||||
XCE
|
|
||||||
SEP #$30 ; 8-bit M and X
|
|
||||||
MX %11 ; Tell Merlin about it
|
|
||||||
LDA [VDUADDR],Y
|
|
||||||
STA [VDUADDR2],Y
|
|
||||||
SEC ; Enter emulation mode
|
|
||||||
XCE
|
|
||||||
DEY
|
|
||||||
BPL :L5
|
|
||||||
LDA VDUBANK
|
|
||||||
EOR #$01
|
|
||||||
STA VDUBANK
|
|
||||||
STA VDUBANK2
|
|
||||||
DEX
|
|
||||||
BPL :L4
|
|
||||||
RTS
|
|
||||||
|
|
||||||
|
|
||||||
* VDU 16 - CLG, clear graphics window
|
* VDU 16 - CLG, clear graphics window
|
||||||
VDU16 >>> XF2MAIN,CLRHGR
|
VDU16 >>> XF2MAIN,CLRHGR
|
||||||
@ -795,22 +709,7 @@ VDU16RET >>> ENTAUX
|
|||||||
RTS
|
RTS
|
||||||
|
|
||||||
* VDU 17 - COLOUR n - select text or border colour
|
* VDU 17 - COLOUR n - select text or border colour
|
||||||
VDU17 LDA VDUQ+8 ; *TEMP*
|
VDU17 RTS
|
||||||
AND #15
|
|
||||||
TAY
|
|
||||||
LDX CLRTRANS,Y
|
|
||||||
BIT VDUQ+8
|
|
||||||
BPL VDU17FGD
|
|
||||||
BVC VDU17BGD
|
|
||||||
STX $C034
|
|
||||||
RTS
|
|
||||||
VDU17BGD LDA $C022
|
|
||||||
AND #$F0
|
|
||||||
STA $C022
|
|
||||||
TXA
|
|
||||||
ORA $C022
|
|
||||||
STA $C022
|
|
||||||
VDU17FGD RTS
|
|
||||||
|
|
||||||
* VDU 18 - GCOL k,a - select graphics colour and plot action
|
* VDU 18 - GCOL k,a - select graphics colour and plot action
|
||||||
VDU18 LDA VDUQ+7 ; Argument 'k'
|
VDU18 LDA VDUQ+7 ; Argument 'k'
|
||||||
@ -839,15 +738,14 @@ VDU18RET1 >>> ENTAUX
|
|||||||
VDU19 RTS
|
VDU19 RTS
|
||||||
|
|
||||||
* VDU 20 - Reset to default colours
|
* VDU 20 - Reset to default colours
|
||||||
VDU20 LDA #$00 ; *TEMP*
|
VDU20 RTS
|
||||||
STA $C034
|
|
||||||
LDA #$F0
|
|
||||||
STA $C022
|
|
||||||
RTS
|
|
||||||
|
|
||||||
* VDU 23 - Program video system and define characters
|
* VDU 23 - Program video system and define characters
|
||||||
VDU23 RTS
|
VDU23 RTS
|
||||||
|
|
||||||
|
* VDU 24,left;bottom;right;top; - define graphics window
|
||||||
|
VDU24 RTS
|
||||||
|
|
||||||
* VDU 25,k,x;y; - PLOT k,x;y; - PLOT point, line, etc.
|
* VDU 25,k,x;y; - PLOT k,x;y; - PLOT point, line, etc.
|
||||||
* x is in VDUQ+7,VDUQ+8
|
* x is in VDUQ+7,VDUQ+8
|
||||||
* y is in VDUQ+5,VDUQ+6
|
* y is in VDUQ+5,VDUQ+6
|
||||||
@ -907,6 +805,12 @@ HGRPOS LDA VDUQ+5
|
|||||||
XPIXEL DW $0000 ; Previous plot x-coord
|
XPIXEL DW $0000 ; Previous plot x-coord
|
||||||
YPIXEL DB $00 ; Previous plot y-coord
|
YPIXEL DB $00 ; Previous plot y-coord
|
||||||
|
|
||||||
|
* VDU 28,left,bottom,right,top - define text window
|
||||||
|
VDU28 RTS
|
||||||
|
|
||||||
|
* VDU 29,x;y; - define graphics origin
|
||||||
|
VDU29 RTS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -923,10 +827,6 @@ BYTEA02 LDY VDUVARS+1,X
|
|||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
|
||||||
* PRINTER DRIVER
|
|
||||||
****************
|
|
||||||
* VDU 1 - Send one character to printer
|
|
||||||
VDU01 RTS
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,8 +85,8 @@ RESET TSX
|
|||||||
LDA $C05A ; AN1 off
|
LDA $C05A ; AN1 off
|
||||||
LDA $C05D ; AN2 on
|
LDA $C05D ; AN2 on
|
||||||
LDA $C05F ; AN3 on
|
LDA $C05F ; AN3 on
|
||||||
** LDA #$20 ; PAGE2 shadow on ROM3 GS
|
LDA #$20 ; PAGE2 shadow on ROM3 GS
|
||||||
** TRB $C035
|
TRB $C035
|
||||||
>>> XF2AUX,AUXMOS
|
>>> XF2AUX,AUXMOS
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ START JSR CROUT
|
|||||||
JSR SETPRFX
|
JSR SETPRFX
|
||||||
JSR DISCONN
|
JSR DISCONN
|
||||||
|
|
||||||
** LDA #$20 ; PAGE2 shadow on ROM3 GS
|
LDA #$20 ; PAGE2 shadow on ROM3 GS
|
||||||
** TRB $C035
|
TRB $C035
|
||||||
|
|
||||||
JSR ROMMENU
|
JSR ROMMENU
|
||||||
LDA #>AUXADDR ; Address in aux
|
LDA #>AUXADDR ; Address in aux
|
||||||
|
Loading…
Reference in New Issue
Block a user