diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 247689b8a..589fbb75d 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -104,8 +104,6 @@ function. _dos_type rebootafterexit -textframe -textframexy diff --git a/include/apple2.h b/include/apple2.h index f217ad04c..f205fdcb9 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -52,45 +52,49 @@ /* 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_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_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_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 '+' +#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 @@ -101,21 +105,21 @@ #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: @@ -200,9 +204,9 @@ void rebootafterexit (void); ** 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 diff --git a/include/apple2enh.h b/include/apple2enh.h index 77328b5ed..3dd8cffc0 100644 --- a/include/apple2enh.h +++ b/include/apple2enh.h @@ -53,9 +53,21 @@ /* 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 @@ -69,15 +81,11 @@ #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 @@ -103,17 +111,6 @@ extern void a2e_lo_tgi[]; -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. diff --git a/libsrc/apple2/chline.s b/libsrc/apple2/chline.s index ca1ee707c..be157ca9e 100644 --- a/libsrc/apple2/chline.s +++ b/libsrc/apple2/chline.s @@ -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 diff --git a/libsrc/apple2/cputc.s b/libsrc/apple2/cputc.s index 6f610fe92..348fa4af9 100644 --- a/libsrc/apple2/cputc.s +++ b/libsrc/apple2/cputc.s @@ -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 diff --git a/libsrc/apple2/cvline.s b/libsrc/apple2/cvline.s index c8ae1e269..86bbf11f4 100644 --- a/libsrc/apple2/cvline.s +++ b/libsrc/apple2/cvline.s @@ -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 diff --git a/libsrc/apple2/mcbdefault.s b/libsrc/apple2/mcbdefault.s index cada4173a..c24c5df56 100644 --- a/libsrc/apple2/mcbdefault.s +++ b/libsrc/apple2/mcbdefault.s @@ -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 diff --git a/libsrc/apple2/textframe.s b/libsrc/apple2/textframe.s deleted file mode 100644 index 55ac235b8..000000000 --- a/libsrc/apple2/textframe.s +++ /dev/null @@ -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__