From: ol.sc
Date: Sat, 12 Dec 2009 23:06:58 +0000 (+0000)
Subject: Added ioctl for mixing graphics with 4 lines of text.
X-Git-Tag: V2.13.1~12
X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fd8252062287617ce1954506fcc91ac6199ad2f6;p=cc65
Added ioctl for mixing graphics with 4 lines of text.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4521 b7a2c559-68d2-44c3-8de9-860c34a00d81
---
diff --git a/libsrc/apple2/apple2-280-192-8.s b/libsrc/apple2/apple2-280-192-8.s
index ae17d77fc..d140639b8 100644
--- a/libsrc/apple2/apple2-280-192-8.s
+++ b/libsrc/apple2/apple2-280-192-8.s
@@ -81,7 +81,7 @@ Y2 := ptr4
.word 280 ; X resolution
.word 192 ; Y resolution
.byte 8 ; Number of drawing colors
- .byte 2 ; Number of screens available
+pages: .byte 2 ; Number of screens available
.byte 7 ; System font X size
.byte 8 ; System font Y size
.word $100 ; Aspect ratio
@@ -118,10 +118,6 @@ Y2 := ptr4
ERROR: .res 1 ; Error code
- .ifdef __APPLE2ENH__
-Set80: .res 1 ; Set 80 column store
- .endif
-
; ------------------------------------------------------------------------
.rodata
@@ -139,6 +135,28 @@ FONT:
.code
+; INSTALL routine. Is called after the driver is loaded into memory. May
+; initialize anything that has to be done just once. Is probably empty
+; most of the time.
+; Must set an error code: NO
+INSTALL:
+ .ifdef __APPLE2ENH__
+ ; No page switching if 80 column store is enabled
+ lda #$02
+ bit RD80COL
+ bpl :+
+ lda #$01
+: sta pages
+ .endif
+
+ ; Fall through
+
+; UNINSTALL routine. Is called before the driver is removed from memory. May
+; clean up anything done by INSTALL but is probably empty most of the time.
+; Must set an error code: NO
+UNINSTALL:
+ rts
+
; INIT: Changes an already installed device from text mode to graphics mode.
; Note that INIT/DONE may be called multiple times while the driver
; is loaded, while INSTALL is only called once, so any code that is needed
@@ -149,16 +167,10 @@ FONT:
; active, so there is no need to protect against that.
; Must set an error code: YES
INIT:
- .ifdef __APPLE2ENH__
- ; Save and clear 80 column store
- lda RD80COL
- sta Set80
- sta CLR80COL
- .endif
-
; Switch into graphics mode
- bit HIRES
bit MIXCLR
+ bit LOWSCR
+ bit HIRES
bit TXTCLR
; Beagle Bros Shape Mechanic fonts don't
@@ -169,20 +181,6 @@ INIT:
; Done, reset the error code
lda #TGI_ERR_OK
sta ERROR
-
- ; Fall through
-
-; INSTALL routine. Is called after the driver is loaded into memory. May
-; initialize anything that has to be done just once. Is probably empty
-; most of the time.
-; Must set an error code: NO
-INSTALL:
- ; Fall through
-
-; UNINSTALL routine. Is called before the driver is removed from memory. May
-; clean up anything done by INSTALL but is probably empty most of the time.
-; Must set an error code: NO
-UNINSTALL:
rts
; DONE: Will be called to switch the graphics device back into text mode.
@@ -194,13 +192,14 @@ DONE:
bit TXTSET
bit LOWSCR
- .ifdef __APPLE2ENH__
- ; Restore 80 column store
- lda Set80
- bpl :+
- sta SET80COL
-: bit LORES ; Limit SET80COL-HISCR to text
- .endif
+ .ifdef __APPLE2ENH__
+ ; Limit SET80COL-HISCR to text
+ bit LORES
+ .endif
+
+ ; Reset the text window top
+ lda #$00
+ sta WNDTOP
rts
; GETERROR: Return the error code in A and clear it.
@@ -210,6 +209,36 @@ GETERROR:
stx ERROR
rts
+; CONTROL: Platform/driver specific entry point.
+; Must set an error code: YES
+CONTROL:
+ ; Check val msb and code to be 0
+ ora ptr1+1
+ bne err
+
+ ; Check val lsb to be [0..1]
+ lda ptr1
+ cmp #1+1
+ bcs err
+
+ ; Set text window top
+ tax
+ beq :+
+ lda #20
+: sta WNDTOP
+
+ ; Switch 4 lines of text
+ .assert MIXCLR + 1 = MIXSET, error
+ lda MIXCLR,x ; No BIT absolute,X available
+
+ lda #TGI_ERR_OK
+ beq :+ ; Branch always
+
+ ; Done, set the error code
+err: lda #TGI_ERR_INV_ARG
+: sta ERROR
+ rts
+
; CLEAR: Clears the screen.
; Must set an error code: NO
CLEAR:
@@ -249,11 +278,6 @@ SETCOLOR:
bit $C080 ; Switch in LC bank 2 for R/O
rts
-; CONTROL: Platform/driver specific entry point.
-; Must set an error code: YES
-CONTROL:
- ; Fall through
-
; SETPALETTE: Set the palette (not available with all drivers/hardware).
; A pointer to the palette is passed in ptr1. Must set an error if palettes
; are not supported