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)!
<item>_dos_type
<item><ref id="get_ostype" name="get_ostype">
<item>rebootafterexit
-<item>textframe
-<item>textframexy
<item><ref id="videomode" name="videomode">
</itemize>
/* Color defines */
-#define COLOR_BLACK 0x00
-#define COLOR_WHITE 0x01
+#define COLOR_BLACK 0x00
+#define COLOR_WHITE 0x01
/* TGI color defines */
-#define TGI_COLOR_BLACK 0x00
-#define TGI_COLOR_GREEN 0x01
-#define TGI_COLOR_VIOLET 0x02
-#define TGI_COLOR_WHITE 0x03
-#define TGI_COLOR_BLACK2 0x04
-#define TGI_COLOR_ORANGE 0x05
-#define TGI_COLOR_BLUE 0x06
-#define TGI_COLOR_WHITE2 0x07
-
-#define TGI_COLOR_MAGENTA TGI_COLOR_BLACK2
-#define TGI_COLOR_DARKBLUE TGI_COLOR_WHITE2
-#define TGI_COLOR_DARKGREEN 0x08
-#define TGI_COLOR_GRAY 0x09
-#define TGI_COLOR_CYAN 0x0A
-#define TGI_COLOR_BROWN 0x0B
-#define TGI_COLOR_GRAY2 0x0C
-#define TGI_COLOR_PINK 0x0D
-#define TGI_COLOR_YELLOW 0x0E
-#define TGI_COLOR_AQUA 0x0F
+#define TGI_COLOR_BLACK 0x00
+#define TGI_COLOR_GREEN 0x01
+#define TGI_COLOR_VIOLET 0x02
+#define TGI_COLOR_WHITE 0x03
+#define TGI_COLOR_BLACK2 0x04
+#define TGI_COLOR_ORANGE 0x05
+#define TGI_COLOR_BLUE 0x06
+#define TGI_COLOR_WHITE2 0x07
+
+#define TGI_COLOR_MAGENTA TGI_COLOR_BLACK2
+#define TGI_COLOR_DARKBLUE TGI_COLOR_WHITE2
+#define TGI_COLOR_DARKGREEN 0x08
+#define TGI_COLOR_GRAY 0x09
+#define TGI_COLOR_CYAN 0x0A
+#define TGI_COLOR_BROWN 0x0B
+#define TGI_COLOR_GRAY2 0x0C
+#define TGI_COLOR_PINK 0x0D
+#define TGI_COLOR_YELLOW 0x0E
+#define TGI_COLOR_AQUA 0x0F
/* Characters codes */
-#define CH_ENTER 0x0D
-#define CH_ESC 0x1B
-#define CH_CURS_LEFT 0x08
-#define CH_CURS_RIGHT 0x15
-
-#define CH_ULCORNER '+'
-#define CH_URCORNER '+'
-#define CH_LLCORNER '+'
-#define CH_LRCORNER '+'
-#define CH_TTEE '+'
-#define CH_BTEE '+'
-#define CH_LTEE '+'
-#define CH_RTEE '+'
-#define CH_CROSS '+'
+#define CH_ENTER 0x0D
+#define CH_ESC 0x1B
+#define CH_CURS_LEFT 0x08
+#define CH_CURS_RIGHT 0x15
+
+#if !defined(__APPLE2ENH__)
+#define CH_HLINE '-'
+#define CH_VLINE '!'
+#define CH_ULCORNER '+'
+#define CH_URCORNER '+'
+#define CH_LLCORNER '+'
+#define CH_LRCORNER '+'
+#define CH_TTEE '+'
+#define CH_BTEE '+'
+#define CH_LTEE '+'
+#define CH_RTEE '+'
+#define CH_CROSS '+'
+#endif
/* Masks for joy_read */
#define JOY_UP_MASK 0x10
#define JOY_BTN_2_MASK 0x80
/* Return codes for get_ostype */
-#define APPLE_UNKNOWN 0x00
-#define APPLE_II 0x10 /* Apple ][ */
-#define APPLE_IIPLUS 0x11 /* Apple ][+ */
-#define APPLE_IIIEM 0x20 /* Apple /// (emulation) */
-#define APPLE_IIE 0x30 /* Apple //e */
-#define APPLE_IIEENH 0x31 /* Apple //e (enhanced) */
-#define APPLE_IIECARD 0x40 /* Apple //e Option Card */
-#define APPLE_IIC 0x50 /* Apple //c */
-#define APPLE_IIC35 0x51 /* Apple //c (3.5 ROM) */
-#define APPLE_IICEXP 0x53 /* Apple //c (Mem. Exp.) */
-#define APPLE_IICREV 0x54 /* Apple //c (Rev. Mem. Exp.) */
-#define APPLE_IICPLUS 0x55 /* Apple //c Plus */
-#define APPLE_IIGS 0x80 /* Apple IIgs */
-#define APPLE_IIGS1 0x81 /* Apple IIgs (ROM 1) */
-#define APPLE_IIGS3 0x83 /* Apple IIgs (ROM 3) */
+#define APPLE_UNKNOWN 0x00
+#define APPLE_II 0x10 /* Apple ][ */
+#define APPLE_IIPLUS 0x11 /* Apple ][+ */
+#define APPLE_IIIEM 0x20 /* Apple /// (emulation) */
+#define APPLE_IIE 0x30 /* Apple //e */
+#define APPLE_IIEENH 0x31 /* Apple //e (enhanced) */
+#define APPLE_IIECARD 0x40 /* Apple //e Option Card */
+#define APPLE_IIC 0x50 /* Apple //c */
+#define APPLE_IIC35 0x51 /* Apple //c (3.5 ROM) */
+#define APPLE_IICEXP 0x53 /* Apple //c (Mem. Exp.) */
+#define APPLE_IICREV 0x54 /* Apple //c (Rev. Mem. Exp.) */
+#define APPLE_IICPLUS 0x55 /* Apple //c Plus */
+#define APPLE_IIGS 0x80 /* Apple IIgs */
+#define APPLE_IIGS1 0x81 /* Apple IIgs (ROM 1) */
+#define APPLE_IIGS3 0x83 /* Apple IIgs (ROM 3) */
extern unsigned char _dos_type;
/* Valid _dos_type values:
** to be overlaid by macros with the same names, saving the function call
** overhead.
*/
-#define _textcolor(color) COLOR_WHITE
-#define _bgcolor(color) COLOR_BLACK
-#define _bordercolor(color) COLOR_BLACK
+#define _textcolor(color) COLOR_WHITE
+#define _bgcolor(color) COLOR_BLACK
+#define _bordercolor(color) COLOR_BLACK
/* Characters codes */
-#define CH_DEL 0x7F
-#define CH_CURS_UP 0x0B
-#define CH_CURS_DOWN 0x0A
+#define CH_DEL 0x7F
+#define CH_CURS_UP 0x0B
+#define CH_CURS_DOWN 0x0A
+
+#define CH_HLINE 0x5F
+#define CH_VLINE 0xDF
+#define CH_ULCORNER 0x5F
+#define CH_URCORNER 0x20
+#define CH_LLCORNER 0xD4
+#define CH_LRCORNER 0xDF
+#define CH_TTEE 0x5F
+#define CH_BTEE 0xD4
+#define CH_LTEE 0xD4
+#define CH_RTEE 0xDF
+#define CH_CROSS 0xD4
/* These are defined to be OpenApple + NumberKey */
#define CH_F1 0xB1
#define CH_F9 0xB9
#define CH_F10 0xB0
-/* Styles for textframe */
-#define TEXTFRAME_WIDE 0x00
-#define TEXTFRAME_TALL 0x04
-
/* Video modes */
-#define VIDEOMODE_40x24 0x0011
-#define VIDEOMODE_80x24 0x0012
-#define VIDEOMODE_40COL VIDEOMODE_40x24
-#define VIDEOMODE_80COL VIDEOMODE_80x24
+#define VIDEOMODE_40x24 0x0011
+#define VIDEOMODE_80x24 0x0012
+#define VIDEOMODE_40COL VIDEOMODE_40x24
+#define VIDEOMODE_80COL VIDEOMODE_80x24
-void __fastcall__ textframe (unsigned char width, unsigned char height,
- unsigned char style);
-/* Output a frame on the text screen with the given width and height
-** starting at the current cursor position and using the given style.
-*/
-
-void __fastcall__ textframexy (unsigned char x, unsigned char y,
- unsigned char width, unsigned char height,
- unsigned char style);
-/* Same as "gotoxy (x, y); textframe (width, height, style);" */
-
unsigned __fastcall__ videomode (unsigned mode);
/* Set the video mode, return the old mode. Call with one of the VIDEOMODE_xx
** constants.
_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
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
; void __fastcall__ cvline (unsigned char length);
;
- .export _cvlinexy, _cvline, cvlinedirect
+ .export _cvlinexy, _cvline
.import gotoxy, putchar, newline
.include "zeropage.inc"
_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
.data
.ifdef __APPLE2ENH__
-cursor = 'B' ; MouseText character
+cursor = $42 ; Pointer MouseText character
.else
cursor = '+' | $40 ; Flashing crosshair
.endif
+++ /dev/null
-;
-; 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__