From 351a5ab20a658c46b14f4c14e91aae263308da4e Mon Sep 17 00:00:00 2001 From: jede Date: Fri, 20 Oct 2017 21:03:30 +0200 Subject: [PATCH] Now setPixel works in TGI. --- asminc/telestrat.inc | 50 ++++++++++++++-- include/telestrat.h | 70 ++++++++++++++++++++++ libsrc/telestrat/tgi/telestrat-228-200-3.s | 24 +++++++- libsrc/telestrat/tgi/telestrat-240-200-2.s | 23 +++++-- 4 files changed, 156 insertions(+), 11 deletions(-) diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index b52e8ae37..7b6e52283 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -54,11 +54,43 @@ HRS3 := $51 HRS4 := $53 HRS5 := $55 - +HRSFB := $57 + +; RS232T +; b0-b3 : speed +; 1111 => 19200 bps (please note that telestrat can't handle this speed with stopping all IRQ except ACIA's one) +; 1100 => 9600 bps (default from telemon) +; 1110 => 4800 bps +; 1010 => 2400 bps +; 1000 => 1200 bps +; 0111 => 600 bps +; 0110 => 300 bps +; 0101 => 150 bps +; 0010 => 75 bps + +; b4 : 0 external clock, 1 internal clock +; b6-b5 : 00 8 bits +; 01 7 bits +; 10 6 bits +; 11 5 bits +; b7 : 0 a stop + +RS232T := $59 + +; RS232C +; b0-b3 : 0 +; b4 : 1 if echo +; b5 : 1 if parity +; b7-b6 : 00 in/out parity odd +; : 01 on/out parity even +; : 10 parity sent, answer not tested +; : 11 SPACE SENT, reception not tested + +RS232C := $5A ; --------------------------------------------------------------------------- ; Low memory -IRQVec := $02fb ; "fast" interrupt vector +IRQVec := $02FB ; "fast" interrupt vector @@ -84,7 +116,7 @@ PRA2 .byte ; Port Register A without handshaking .endstruct -.struct VIA2 ; Versatile Interface Adapter +.struct VIA2 ; Versatile Interface Adapter .res $0320 PRB .byte ; Port Register B PRA .byte ; Port Register A @@ -116,7 +148,7 @@ SCREEN := $BB80 ; --------------------------------------------------------------------------- ; ROM entries -; primitives telemon 2.4 +; telemon primitives (2.4 & 3.x) XRD0 = $08 XRDW0 = $0C XWR0 = $10 @@ -140,10 +172,19 @@ XMUSIC = $45 XZAP = $46 XSHOOT = $47 XSOUT = $67 ; Send A register to RS232, available in telemon 2.4 & 3.x +XHRSSE = $8C ; Put in X and Y +XDRAWA = $8D ; Draw a line +XDRAWR = $8E ; Draw a line XCIRCL = $8F XCURSE = $90 +XCURMO = $91 XPAPER = $92 XINK = $93 +XBOX = $94 +XABOX = $95 +XFILL = $96 +XCHAR = $97 +XSCHAR = $98 ; Draw a string XEXPLO = $9C XPING = $9D @@ -158,6 +199,7 @@ SCRX := $220 SCRY := $224 ADSCRL := $218 ADSCRH := $21C +HRSPAT := $2AA ; Hires pattern : it's used to draw pattern for a line or a circle IRQVECTOR := $2FA diff --git a/include/telestrat.h b/include/telestrat.h index 5a090647b..1865f19a0 100644 --- a/include/telestrat.h +++ b/include/telestrat.h @@ -30,6 +30,76 @@ + +/* Color defines */ +#define COLOR_BLACK 0x00 +#define COLOR_RED 0x01 +#define COLOR_GREEN 0x02 +#define COLOR_YELLOW 0x03 +#define COLOR_BLUE 0x04 +#define COLOR_MAGENTA 0x05 +#define COLOR_CYAN 0x06 +#define COLOR_WHITE 0x07 + +/* TGI color defines */ +/* White and red are swapped, so that the pallete +** driver is compatible with black-and-white drivers. +*/ +#define TGI_COLOR_BLACK COLOR_BLACK +#define TGI_COLOR_WHITE 1 +#define TGI_COLOR_GREEN COLOR_GREEN +#define TGI_COLOR_YELLOW COLOR_YELLOW +#define TGI_COLOR_BLUE COLOR_BLUE +#define TGI_COLOR_MAGENTA COLOR_MAGENTA +#define TGI_COLOR_CYAN COLOR_CYAN +#define TGI_COLOR_RED 7 + + +extern void telestrat_228_200_3_tgi[]; +extern void telestrat_240_200_2_tgi[]; /* Referred to by tgi_static_stddrv[] */ + +/* Define hardware */ +#include <_6522.h> +#define VIA (*(struct __6522*)0x300) + + + +/* These are defined to be FUNCT + NumberKey */ +#define CH_F1 0xB1 +#define CH_F2 0xB2 +#define CH_F3 0xB3 +#define CH_F4 0xB4 +#define CH_F5 0xB5 +#define CH_F6 0xB6 +#define CH_F7 0xB7 +#define CH_F8 0xB8 +#define CH_F9 0xB9 +#define CH_F10 0xB0 + + + +/* Character codes */ +#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_CURS_UP 11 +#define CH_CURS_DOWN 10 +#define CH_CURS_LEFT 8 +#define CH_CURS_RIGHT 9 +#define CH_DEL 127 +#define CH_ENTER 13 +#define CH_STOP 3 +#define CH_LIRA 95 +#define CH_ESC 27 + + + void oups(); void ping(); void zap(); diff --git a/libsrc/telestrat/tgi/telestrat-228-200-3.s b/libsrc/telestrat/tgi/telestrat-228-200-3.s index 1e42f2ede..e20c2c877 100644 --- a/libsrc/telestrat/tgi/telestrat-228-200-3.s +++ b/libsrc/telestrat/tgi/telestrat-228-200-3.s @@ -55,6 +55,7 @@ YSIZE = 8 ; System font height .addr GETPIXEL .addr LINE .addr BAR + .addr CIRCLE .addr TEXTSTYLE .addr OUTTEXT .addr 0 ; IRQ entry is unused @@ -107,10 +108,13 @@ INIT: ; Switch into graphics mode. BRK_TELEMON(XHIRES) - rts - + ; Done, reset the error code. + lda #TGI_ERR_OK + sta ERROR + rts + ; ------------------------------------------------------------------------ ; GETERROR: Return the error code in A, and clear it. @@ -251,7 +255,17 @@ GETDEFPALETTE: ; SETPIXEL: - ; not done yet + + lda X1 + sta HRS1 + lda Y1 + sta HRS2 + + lda #$80 + sta HRSFB + + BRK_TELEMON(XCURSE) + rts ; ------------------------------------------------------------------------ @@ -274,6 +288,10 @@ LINE: ; not done yet rts +CIRCLE: + ; not done yet + rts + ; ------------------------------------------------------------------------ ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where ; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4, using the current drawing color. diff --git a/libsrc/telestrat/tgi/telestrat-240-200-2.s b/libsrc/telestrat/tgi/telestrat-240-200-2.s index 3dc90525a..fcc1ce3f2 100644 --- a/libsrc/telestrat/tgi/telestrat-240-200-2.s +++ b/libsrc/telestrat/tgi/telestrat-240-200-2.s @@ -125,7 +125,7 @@ INIT: ; Switch into graphics mode BRK_TELEMON(XHIRES) - rts + ; Done, reset the error code lda #TGI_ERR_OK @@ -248,7 +248,17 @@ GETDEFPALETTE: ; SETPIXEL: - ; not done yet + + lda X1 + sta HRS1 + lda Y1 + sta HRS2 + + lda #$80 ; curset on + sta HRSFB + + BRK_TELEMON(XCURSE) + rts ; ------------------------------------------------------------------------ @@ -268,8 +278,13 @@ GETPIXEL: ; LINE: - ; not done yet - rts + ; not done yet + rts + +CIRCLE: + ; not done yet + rts + ; ------------------------------------------------------------------------ ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where ; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4 using the current drawing color. -- 2.39.5