mirror of
https://github.com/cc65/cc65.git
synced 2026-04-26 13:18:31 +00:00
Made Apple II CONIO more flexible.
Originally the Apple II had a 64 char set and used the upper two bits to control inverse and blinking. The Apple //e brought then an alternate char set without blinking but more individual chars. However, it does _not_ contain 128 chars and use the upper bit to control inverse as one would assume. Rather it contains more than 128 chars - the MouseText chars. And because Apple wanted to provide as much backward compatibility as possible with the original char set, the alternate char set has a rather weird layout for chars > 128 with the inverse lowercase chars _not_ at (normal lowercase char + 128). So far the Apple II CONIO implementation mapped chars 128-255 to chars 0-127 (with the exception of \r and \n). It made use of alternate chars > 128 transparently for the user via reverse(1). The user didn't have direct access to the MouseText chars, they were only used interally for things like chline() and cvline(). Now the mapping of chars 128-255 to 0-127 is removed. Using chars > 128 gives the user direct access to the "raw" alternate chars > 128. This especially give the use direct access to the MouseText chars. But this clashes with the exsisting (and still desirable) revers(1) logic. Combining reverse(1) with chars > 128 just doesn't result in anything usable! What motivated this change? When I worked on the VT100 line drawing support for Telnet65 on the Apple //e (not using CONIO at all) I finally understood how MouseText is intended to be used to draw arbitrary grids with just three chars: A special "L" type char, the underscore and a vertical bar at the left side of the char box. I notice that with those chars it is possible to follow the CONIO approach to boxes and grids: Combining chline()/cvline() with special CH_... char constants for edges and intersections. But in order to actually do so I needed to be able to define CH_... constants that when fed into the ordinary cputc() pipeline end up as MouseText chars. The obvious approach was to allow chars > 128 to directly access MouseText chars :-) Now that the native CONIO box/grid approach works I deleted the Apple //e proprietary textframe() function that I added as replacement quite some years ago. Again: Please note that chline()/cvline() and the CH... constants don't work with reverse(1)!
This commit is contained in:
@@ -18,12 +18,10 @@ _chlinexy:
|
||||
|
||||
_chline:
|
||||
.ifdef __APPLE2ENH__
|
||||
ldx #'S' ; MouseText character
|
||||
ldy INVFLG
|
||||
cpy #$FF ; Normal character display mode?
|
||||
beq chlinedirect
|
||||
ldx #'_' | $80 ; Underscore, screen code
|
||||
.else
|
||||
ldx #'-' | $80 ; Minus, screen code
|
||||
.endif
|
||||
ldx #'-' | $80 ; Horizontal line, screen code
|
||||
|
||||
chlinedirect:
|
||||
stx tmp1
|
||||
|
||||
@@ -37,7 +37,7 @@ _cputc:
|
||||
beq left
|
||||
cmp #$0A ; Test for \n = line feed
|
||||
beq newline
|
||||
ora #$80 ; Turn on high bit
|
||||
eor #$80 ; Invert high bit
|
||||
.ifndef __APPLE2ENH__
|
||||
cmp #$E0 ; Test for lowercase
|
||||
bcc cputdirect
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
; void __fastcall__ cvline (unsigned char length);
|
||||
;
|
||||
|
||||
.export _cvlinexy, _cvline, cvlinedirect
|
||||
.export _cvlinexy, _cvline
|
||||
.import gotoxy, putchar, newline
|
||||
|
||||
.include "zeropage.inc"
|
||||
@@ -17,12 +17,11 @@ _cvlinexy:
|
||||
|
||||
_cvline:
|
||||
.ifdef __APPLE2ENH__
|
||||
ldx #'|' | $80 ; Vertical line, screen code
|
||||
ldx #$5F ; Left vertical line MouseText character
|
||||
.else
|
||||
ldx #'!' | $80 ; Vertical line, screen code
|
||||
ldx #'!' | $80 ; Exclamation mark, screen code
|
||||
.endif
|
||||
|
||||
cvlinedirect:
|
||||
stx tmp1
|
||||
cmp #$00 ; Is the length zero?
|
||||
beq done ; Jump if done
|
||||
|
||||
@@ -36,7 +36,7 @@ _mouse_def_callbacks:
|
||||
.data
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
cursor = 'B' ; MouseText character
|
||||
cursor = $42 ; Pointer MouseText character
|
||||
.else
|
||||
cursor = '+' | $40 ; Flashing crosshair
|
||||
.endif
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
;
|
||||
; Oliver Schmidt, 10.03.2004
|
||||
;
|
||||
; void __fastcall__ textframexy (unsigned char x, unsigned char y,
|
||||
; unsigned char width, unsigned char height,
|
||||
; unsigned char style);
|
||||
; void __fastcall__ textframe (unsigned char width, unsigned char height,
|
||||
; unsigned char style);
|
||||
;
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.export _textframexy, _textframe
|
||||
.import popa, pusha, _gotoxy
|
||||
.import chlinedirect, cvlinedirect
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "apple2.inc"
|
||||
|
||||
WIDTH = ptr1
|
||||
HEIGHT = ptr1+1
|
||||
XORIGIN = ptr2
|
||||
YORIGIN = ptr2+1
|
||||
|
||||
_textframexy:
|
||||
sec
|
||||
bra :+
|
||||
|
||||
_textframe:
|
||||
clc
|
||||
: ldx INVFLG
|
||||
phx ; Save character display mode
|
||||
ldx #$FF
|
||||
stx INVFLG ; Set normal character display mode
|
||||
pha ; Save index
|
||||
jsr popa ; Get height
|
||||
sta HEIGHT
|
||||
jsr popa ; Get width
|
||||
sta WIDTH
|
||||
lda CH
|
||||
ldx CV
|
||||
bcc noxy
|
||||
jsr popa ; Get y
|
||||
tax
|
||||
jsr popa ; Get x
|
||||
noxy: sta XORIGIN
|
||||
stx YORIGIN
|
||||
plx ; Restore index
|
||||
loop: lda XOFFS,x
|
||||
clc
|
||||
bpl :+ ; Relative to left edge?
|
||||
adc WIDTH
|
||||
: adc XORIGIN
|
||||
jsr pusha
|
||||
lda YOFFS,x
|
||||
clc
|
||||
bpl :+ ; Relative to top?
|
||||
adc HEIGHT
|
||||
: adc YORIGIN
|
||||
jsr _gotoxy ; Call this one, will pop params
|
||||
txa
|
||||
tay
|
||||
lsr ; Get bit 0 (vline) into carry
|
||||
lda LENGTH,x
|
||||
phx ; Save index
|
||||
ldx CHAR,y
|
||||
bcc hline
|
||||
clc
|
||||
adc HEIGHT
|
||||
jsr cvlinedirect
|
||||
bra next
|
||||
hline: adc WIDTH
|
||||
jsr chlinedirect
|
||||
next: plx ; Restore index
|
||||
inx
|
||||
txa
|
||||
and #$03 ; Mask style
|
||||
bne loop
|
||||
pla
|
||||
sta INVFLG ; Restore character display mode
|
||||
rts
|
||||
|
||||
.rodata
|
||||
|
||||
; 2 styles with 4 lines each make up 8 entries per table
|
||||
; - even entry numbers mean horizontal lines
|
||||
; - odd entry numbers mean vertical lines
|
||||
|
||||
; x offset for the line starting point
|
||||
; - a positive value means relative to the frame left edge
|
||||
; - a negative value menas relative to the frame right edge
|
||||
XOFFS: .byte 0, 0, 0, <-2, 1, 0, 1, <-2
|
||||
|
||||
; y offset for the line starting point
|
||||
; - a positive value means relative to the frame top
|
||||
; - a negative value menas relative to the frame bottom
|
||||
YOFFS: .byte 0, 1, <-2, 1, 0, 0, <-2, 0
|
||||
|
||||
; length of the line relative to the frame size
|
||||
; - a negative value for hlines means shorter than the width
|
||||
; - a negative value for vlines menas shorter than the height
|
||||
LENGTH: .byte 0, <-2, 0, <-2, <-2, 0, <-2, 0
|
||||
|
||||
; character to use for drawing the line
|
||||
; - hibit set means normal printable character
|
||||
; - hibit clear means MouseText character
|
||||
CHAR: .byte '_'|$80, '_', 'L', 'Z', 'L', 'Z', '_'|$80, '_'
|
||||
|
||||
.endif ; __APPLE2ENH__
|
||||
Reference in New Issue
Block a user