Merge pull request #4 from cc65/master

Update
This commit is contained in:
Stefan 2017-12-18 11:21:00 +01:00 committed by GitHub
commit 2fde8d35c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 1538 additions and 444 deletions

View File

@ -15,7 +15,7 @@ FNAM := $BB ; Address of filename
FNAM_BANK := $C7 ; Bank for filename
KEY_COUNT := $D0 ; Number of keys in input buffer
FKEY_COUNT := $D1 ; Characters for function key
MODE := $D7 ; 40/80 column mode flag
MODE := $D7 ; 40-/80-column mode (bit 7: 80 columns)
CURS_X := $EC ; Cursor column
CURS_Y := $EB ; Cursor row
SCREEN_PTR := $E0 ; Pointer to current char in text screen
@ -167,34 +167,46 @@ SID_Read3 := $D41C
; ---------------------------------------------------------------------------
; I/O: VDC (128 only)
VDC_INDEX := $D600
VDC_DATA := $D601
VDC_INDEX := $D600 ; register address port
VDC_DATA := $D601 ; data port
; Registers
VDC_DATA_HI = 18 ; video RAM address (big endian)
VDC_DATA_LO = 19
VDC_CSET = 28
VDC_RAM_RW = 31 ; RAM port
; ---------------------------------------------------------------------------
; I/O: CIAs
; I/O: Complex Interface Adapters
CIA1 := $DC00
CIA1_PRA := $DC00
CIA1_PRB := $DC01
CIA1_DDRA := $DC02
CIA1_DDRB := $DC03
CIA1_TOD10 := $DC08
CIA1_TODSEC := $DC09
CIA1_TODMIN := $DC0A
CIA1_TODHR := $DC0B
CIA1_ICR := $DC0D
CIA1_CRA := $DC0E
CIA1_CRB := $DC0F
CIA1_PRA := $DC00 ; Port A
CIA1_PRB := $DC01 ; Port B
CIA1_DDRA := $DC02 ; Data direction register for port A
CIA1_DDRB := $DC03 ; Data direction register for port B
CIA1_TA := $DC04 ; 16-bit timer A
CIA1_TB := $DC06 ; 16-bit timer B
CIA1_TOD10 := $DC08 ; Time-of-day tenths of a second
CIA1_TODSEC := $DC09 ; Time-of-day seconds
CIA1_TODMIN := $DC0A ; Time-of-day minutes
CIA1_TODHR := $DC0B ; Time-of-day hours
CIA1_SDR := $DC0C ; Serial data register
CIA1_ICR := $DC0D ; Interrupt control register
CIA1_CRA := $DC0E ; Control register for timer A
CIA1_CRB := $DC0F ; Control register for timer B
CIA2 := $DD00
CIA2_PRA := $DD00
CIA2_PRB := $DD01
CIA2_DDRA := $DD02
CIA2_DDRB := $DD03
CIA2_TA := $DD04
CIA2_TB := $DD06
CIA2_TOD10 := $DD08
CIA2_TODSEC := $DD09
CIA2_TODMIN := $DD0A
CIA2_TODHR := $DD0B
CIA2_SDR := $DD0C
CIA2_ICR := $DD0D
CIA2_CRA := $DD0E
CIA2_CRB := $DD0F

View File

@ -165,30 +165,36 @@ VDC_INDEX := $D600
VDC_DATA := $D601
; ---------------------------------------------------------------------------
; I/O: CIAs
; I/O: Complex Interface Adapters
CIA1 := $DC00
CIA1_PRA := $DC00
CIA1_PRB := $DC01
CIA1_DDRA := $DC02
CIA1_DDRB := $DC03
CIA1_TOD10 := $DC08
CIA1_TODSEC := $DC09
CIA1_TODMIN := $DC0A
CIA1_TODHR := $DC0B
CIA1_ICR := $DC0D
CIA1_CRA := $DC0E
CIA1_CRB := $DC0F
CIA1_PRA := $DC00 ; Port A
CIA1_PRB := $DC01 ; Port B
CIA1_DDRA := $DC02 ; Data direction register for port A
CIA1_DDRB := $DC03 ; Data direction register for port B
CIA1_TA := $DC04 ; 16-bit timer A
CIA1_TB := $DC06 ; 16-bit timer B
CIA1_TOD10 := $DC08 ; Time-of-day tenths of a second
CIA1_TODSEC := $DC09 ; Time-of-day seconds
CIA1_TODMIN := $DC0A ; Time-of-day minutes
CIA1_TODHR := $DC0B ; Time-of-day hours
CIA1_SDR := $DC0C ; Serial data register
CIA1_ICR := $DC0D ; Interrupt control register
CIA1_CRA := $DC0E ; Control register for timer A
CIA1_CRB := $DC0F ; Control register for timer B
CIA2 := $DD00
CIA2_PRA := $DD00
CIA2_PRB := $DD01
CIA2_DDRA := $DD02
CIA2_DDRB := $DD03
CIA2_TA := $DD04
CIA2_TB := $DD06
CIA2_TOD10 := $DD08
CIA2_TODSEC := $DD09
CIA2_TODMIN := $DD0A
CIA2_TODHR := $DD0B
CIA2_SDR := $DD0C
CIA2_ICR := $DD0D
CIA2_CRA := $DD0E
CIA2_CRB := $DD0F

View File

@ -55,7 +55,7 @@
;------------------------------------------------------------------------------
; The JOY API version, stored in JOY_HDR::VERSION
JOY_API_VERSION = $03
JOY_API_VERSION = $04
;------------------------------------------------------------------------------
; Variables

View File

@ -241,12 +241,11 @@ OPC_BIT_abx = $3C
; OPC_NOP = $44 ; doublet
; OPC_NOP = $4B ; doublet
OPC_EOR_izp = $52
OPC_EOR_izp = $52
; OPC_NOP = $53 ; doublet
; OPC_NOP = $54 ; doublet
; OPC_NOP = $5A ; doublet
; OPC_NOP = $5B ; doublet
OPC_EOR_abx = $5C
; OPC_NOP = $62 ; doublet
; OPC_NOP = $63 ; doublet

View File

@ -7,7 +7,7 @@ MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = $0FFF, size = $0002;
HEADER: file = %O, start = $1001, size = $000C;
MAIN: file = %O, start = $100D, size = $6FF3 - __STACKSIZE__;
MAIN: file = %O, start = $100D, size = $2FF3 - __STACKSIZE__;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;

View File

@ -4,7 +4,7 @@
<title>cc65 function reference
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
<url url="mailto:greg.king5@verizon.net" name="Greg King">
<date>2017-11-21
<date>2017-12-09
<abstract>
cc65 is a C compiler for 6502 based systems. This function reference describes
@ -182,6 +182,7 @@ function.
<!-- <item><ref id="cbm_save" name="cbm_save"> -->
<!-- <item><ref id="cbm_write" name="cbm_write"> -->
<!-- <item><ref id="get_tv" name="get_tv"> -->
<item><ref id="waitvsync" name="waitvsync">
<item><ref id="kbrepeat" name="kbrepeat">
</itemize>
@ -237,6 +238,10 @@ function.
<item><ref id="chline" name="chline">
<item><ref id="chlinexy" name="chlinexy">
<item><ref id="clrscr" name="clrscr">
<item><ref id="cpeekc" name="cpeekc">
<item><ref id="cpeekcolor" name="cpeekcolor">
<item><ref id="cpeekrevers" name="cpeekrevers">
<item><ref id="cpeeks" name="cpeeks">
<item><ref id="cprintf" name="cprintf">
<item><ref id="cputc" name="cputc">
<item><ref id="cputcxy" name="cputcxy">
@ -360,7 +365,7 @@ function.
<sect1><tt/geos.h/<label id="geos.h"><p>
(incomplete)
<url url="geos.html" name="GEOS API">.
<sect1><tt/joystick.h/<label id="joystick.h"><p>
@ -2518,6 +2523,121 @@ be used in presence of a prototype.
</quote>
<sect1>cpeekc<label id="cpeekc"><p>
<quote>
<descrip>
<tag/Function/Get a character from the display memory.
<tag/Header/<tt/<ref id="conio.h" name="conio.h">/
<tag/Declaration/<tt/char cpeekc (void);/
<tag/Description/The function gets the character that's at the current location
of the cursor in the display screen RAM. That character is converted, if
needed, into the encoding that can be passed to <tt/cputc()/.
<tag/Notes/<itemize>
<item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
done to make it obvious that peeking doesn't move the cursor in any way. Your
program must place the cursor where it wants to peek before it calls any of
those functions.
</itemize>
<tag/Availability/cc65
<tag/See also/
<ref id="cpeekcolor" name="cpeekcolor">,
<ref id="cpeekrevers" name="cpeekrevers">,
<ref id="cpeeks" name="cpeeks">,
<ref id="cputc" name="cputc">
<tag/Example/None.
</descrip>
</quote>
<sect1>cpeekcolor<label id="cpeekcolor"><p>
<quote>
<descrip>
<tag/Function/Get a color from the display memory.
<tag/Header/<tt/<ref id="conio.h" name="conio.h">/
<tag/Declaration/<tt/unsigned char cpeekcolor (void);/
<tag/Description/The function gets the color number that's at the current
location of the cursor in the display screen RAM. That number can be passed to
<tt/textcolor()/.
<tag/Notes/<itemize>
<item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
done to make it obvious that peeking doesn't move the cursor in any way. Your
program must place the cursor where it wants to peek before it calls any of
those functions.
</itemize>
<tag/Availability/cc65
<tag/See also/
<ref id="cpeekc" name="cpeekc">,
<ref id="cpeekrevers" name="cpeekrevers">,
<ref id="cpeeks" name="cpeeks">,
<ref id="cputc" name="cputc">,
<ref id="textcolor" name="textcolor">
<tag/Example/None.
</descrip>
</quote>
<sect1>cpeekrevers<label id="cpeekrevers"><p>
<quote>
<descrip>
<tag/Function/Get a reverse-character attribute from the display memory.
<tag/Header/<tt/<ref id="conio.h" name="conio.h">/
<tag/Declaration/<tt/unsigned char cpeekrevers (void);/
<tag/Description/The function gets the "reverse-mode" attribute of the
character that's at the current location of the cursor in the display screen
RAM. It returns a boolean value (0/1) that can be passed to <tt/revers()/.
<tag/Notes/<itemize>
<item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
done to make it obvious that peeking doesn't move the cursor in any way. Your
program must place the cursor where it wants to peek before it calls any of
those functions.
</itemize>
<tag/Availability/cc65
<tag/See also/
<ref id="cpeekc" name="cpeekc">,
<ref id="cpeekcolor" name="cpeekcolor">,
<ref id="cpeeks" name="cpeeks">,
<ref id="cputc" name="cputc">,
<ref id="revers" name="revers">
<tag/Example/None.
</descrip>
</quote>
<sect1>cpeeks<label id="cpeeks"><p>
<quote>
<descrip>
<tag/Function/Get a string from the display memory.
<tag/Header/<tt/<ref id="conio.h" name="conio.h">/
<tag/Declaration/<tt/void __fastcall__ cpeeks (char* s, unsigned length);/
<tag/Description/The function gets a fixed-length string ('\0'-terminated) of
characters that start at the current location of the cursor in the display
screen RAM. Those characters are converted, if needed, into the encoding that
can be passed to <tt/cputs()/. The first argument must point to a RAM area
that's large enough to hold "length + 1" bytes.
<tag/Notes/<itemize>
<item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
done to make it obvious that peeking doesn't move the cursor in any way. Your
program must place the cursor where it wants to peek before it calls any of
those functions.
<item>The function is available as only a fastcall function;
so, it may be used only in the presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/
<ref id="cpeekc" name="cpeekc">,
<ref id="cpeekcolor" name="cpeekcolor">,
<ref id="cpeekrevers" name="cpeekrevers">,
<ref id="cputc" name="cputc">,
<ref id="cputs" name="cputs">
<tag/Example/None.
</descrip>
</quote>
<sect1>creat<label id="creat"><p>
<quote>
@ -6757,6 +6877,7 @@ used in presence of a prototype.
<descrip>
<tag/Function/Wait until the start of the next frame.
<tag/Header/
<tt/<ref id="cbm.h" name="cbm.h">/,
<tt/<ref id="gamate.h" name="gamate.h">/,
<tt/<ref id="nes.h" name="nes.h">/,
<tt/<ref id="pce.h" name="pce.h">/

View File

@ -2,21 +2,21 @@
<article>
<title>Tiny Graphics Interface
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2017-11-23
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">,<newline>
<url url="mailto:greg.king5@verizon.net" name="Greg King">
<date>2017-11-30
<abstract>
The cc65 library provides functions for platform independent graphics.
Include the tgi.h header file to get the necessary definitions.
</abstract>
<!-- Table of contents -->
<tt/tgi.h/<label id="tgi.h"><p>
<toc>
<!-- Begin the document -->
<sect>tgi_arc<label id="tgi_arc"><p>
<sect>tgi.h<label id="tgi.h">
<sect1>tgi_arc<label id="tgi_arc"><p>
<quote>
<descrip>
@ -50,7 +50,7 @@ tgi_arc (50, 50, 40, 20, 0, 180);
</quote>
<sect>tgi_bar<label id="tgi_bar"><p>
<sect1>tgi_bar<label id="tgi_bar"><p>
<quote>
<descrip>
@ -74,7 +74,7 @@ tgi_bar(10, 10, 100, 60);
</quote>
<sect>tgi_circle<label id="tgi_circle"><p>
<sect1>tgi_circle<label id="tgi_circle"><p>
<quote>
<descrip>
@ -101,7 +101,7 @@ tgi_circle(50, 40, 40);
</quote>
<sect>tgi_clear<label id="tgi_clear"><p>
<sect1>tgi_clear<label id="tgi_clear"><p>
<quote>
<descrip>
@ -116,7 +116,7 @@ tgi_circle(50, 40, 40);
</quote>
<sect>tgi_done<label id="tgi_done"><p>
<sect1>tgi_done<label id="tgi_done"><p>
<quote>
<descrip>
@ -133,7 +133,7 @@ Will NOT uninstall or unload the driver!
</quote>
<sect>tgi_ellipse<label id="tgi_ellipse"><p>
<sect1>tgi_ellipse<label id="tgi_ellipse"><p>
<quote>
<descrip>
@ -161,7 +161,7 @@ tgi_ellipse (50, 40, 40, 20);
</quote>
<sect>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p>
<sect1>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p>
<quote>
<descrip>
@ -182,7 +182,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_getaspectratio<label id="tgi_getaspectratio"><p>
<sect1>tgi_getaspectratio<label id="tgi_getaspectratio"><p>
<quote> <descrip> <tag/Function/Return the pixel aspect ratio.
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
@ -212,7 +212,7 @@ original aspect ratio.
</quote>
<sect>tgi_getcolor<label id="tgi_getcolor"><p>
<sect1>tgi_getcolor<label id="tgi_getcolor"><p>
<quote>
<descrip>
@ -234,7 +234,7 @@ color = tgi_getcolor();
</quote>
<sect>tgi_getcolorcount<label id="tgi_getcolorcount"><p>
<sect1>tgi_getcolorcount<label id="tgi_getcolorcount"><p>
<quote>
<descrip>
@ -254,7 +254,7 @@ if (tgi_getcolorcount() == 2) {
</quote>
<sect>tgi_getdefpalette<label id="tgi_getdefpalette"><p>
<sect1>tgi_getdefpalette<label id="tgi_getdefpalette"><p>
<quote>
<descrip>
@ -271,7 +271,7 @@ palette to work correctly.
</quote>
<sect>tgi_geterror<label id="tgi_geterror"><p>
<sect1>tgi_geterror<label id="tgi_geterror"><p>
<quote>
<descrip>
@ -288,7 +288,7 @@ This will also clear the error.
</quote>
<sect>tgi_geterrormsg<label id="tgi_geterrormsg"><p>
<sect1>tgi_geterrormsg<label id="tgi_geterrormsg"><p>
<quote>
<descrip>
@ -307,7 +307,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p>
<sect1>tgi_getmaxcolor<label id="tgi_getmaxcolor"><p>
<quote>
<descrip>
@ -322,7 +322,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_getmaxx<label id="tgi_getmaxx"><p>
<sect1>tgi_getmaxx<label id="tgi_getmaxx"><p>
<quote>
<descrip>
@ -337,7 +337,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_getmaxy<label id="tgi_getmaxy"><p>
<sect1>tgi_getmaxy<label id="tgi_getmaxy"><p>
<quote>
<descrip>
@ -352,7 +352,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_getpagecount<label id="tgi_getpagecount"><p>
<sect1>tgi_getpagecount<label id="tgi_getpagecount"><p>
<quote>
<descrip>
@ -369,7 +369,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_getpalette<label id="tgi_getpalette"><p>
<sect1>tgi_getpalette<label id="tgi_getpalette"><p>
<quote>
<descrip>
@ -384,7 +384,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_getpixel<label id="tgi_getpixel"><p>
<sect1>tgi_getpixel<label id="tgi_getpixel"><p>
<quote>
<descrip>
@ -403,7 +403,47 @@ be used in presence of a prototype.
</quote>
<sect>tgi_getxres<label id="tgi_getxres"><p>
<sect1>tgi_gettextheight<label id="tgi_gettextheight"><p>
<quote>
<descrip>
<tag/Function/Calculate the height of the text in pixels according to
the current text style.
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextheight (const char* s);/
<tag/Description/Calculate the height of the text in pixels according to
the current text style.
<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/Other tgi functions.
<tag/Example/None.
</descrip>
</quote>
<sect1>tgi_gettextwidth<label id="tgi_gettextwidth"><p>
<quote>
<descrip>
<tag/Function/Calculate the width of the text in pixels according to the current text style.
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextwidth (const char* s);/
<tag/Description/Calculate the width of the text in pixels according to the current text style.
<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/Other tgi functions.
<tag/Example/None.
</descrip>
</quote>
<sect1>tgi_getxres<label id="tgi_getxres"><p>
<quote>
<descrip>
@ -419,7 +459,7 @@ This is same as tgi_maxx()+1.
</quote>
<sect>tgi_getyres<label id="tgi_getyres"><p>
<sect1>tgi_getyres<label id="tgi_getyres"><p>
<quote>
<descrip>
@ -435,7 +475,7 @@ This is same as tgi_maxy()+1.
</quote>
<sect>tgi_gotoxy<label id="tgi_gotoxy"><p>
<sect1>tgi_gotoxy<label id="tgi_gotoxy"><p>
<quote>
<descrip>
@ -454,7 +494,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_init<label id="tgi_init"><p>
<sect1>tgi_init<label id="tgi_init"><p>
<quote>
<descrip>
@ -479,7 +519,7 @@ tgi_init(); //Set up the default palette and clear the screen.
</quote>
<sect>tgi_install<label id="tgi_install"><p>
<sect1>tgi_install<label id="tgi_install"><p>
<quote>
<descrip>
@ -506,7 +546,7 @@ tgi_init(); //Set up the default palette and clear the screen.
</quote>
<sect>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p>
<sect1>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p>
<quote>
<descrip>
@ -530,7 +570,7 @@ used in presence of a prototype.
</quote>
<sect>tgi_ioctl<label id="tgi_ioctl"><p>
<sect1>tgi_ioctl<label id="tgi_ioctl"><p>
<quote>
<descrip>
@ -565,7 +605,7 @@ if (!tgi_busy()) {
</quote>
<sect>tgi_line<label id="tgi_line"><p>
<sect1>tgi_line<label id="tgi_line"><p>
<quote>
<descrip>
@ -586,7 +626,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_lineto<label id="tgi_lineto"><p>
<sect1>tgi_lineto<label id="tgi_lineto"><p>
<quote>
<descrip>
@ -607,7 +647,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_load_driver<label id="tgi_load_driver"><p>
<sect1>tgi_load_driver<label id="tgi_load_driver"><p>
<quote>
<descrip>
@ -628,7 +668,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p>
<sect1>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p>
<quote>
<descrip>
@ -652,7 +692,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_outtext<label id="tgi_outtext"><p>
<sect1>tgi_outtext<label id="tgi_outtext"><p>
<quote>
<descrip>
@ -673,7 +713,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_outtextxy<label id="tgi_outtextxy"><p>
<sect1>tgi_outtextxy<label id="tgi_outtextxy"><p>
<quote>
<descrip>
@ -694,7 +734,7 @@ be used in presence of a prototype.
</quote>
<sect>tgi_pieslice<label id="tgi_pieslice"><p>
<sect1>tgi_pieslice<label id="tgi_pieslice"><p>
<quote>
<descrip>
@ -728,7 +768,7 @@ tgi_pieslice (50, 50, 40, 20, 0, 180);
</quote>
<sect>tgi_setaspectratio<label id="tgi_setaspectratio"><p>
<sect1>tgi_setaspectratio<label id="tgi_setaspectratio"><p>
<quote> <descrip> <tag/Function/Set the pixel aspect ratio.
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
@ -760,7 +800,7 @@ only in the presence of a prototype.
</quote>
<sect>tgi_setcolor<label id="tgi_setcolor"><p>
<sect1>tgi_setcolor<label id="tgi_setcolor"><p>
<quote>
<descrip>
@ -783,7 +823,8 @@ tgi_bar(10,10,20,20);
</descrip>
</quote>
<sect>tgi_setdrawpage<label id="tgi_setdrawpage"><p>
<sect1>tgi_setdrawpage<label id="tgi_setdrawpage"><p>
<quote>
<descrip>
@ -812,7 +853,8 @@ tgi_setviewpage(0); // Show page 0
</descrip>
</quote>
<sect>tgi_setpalette<label id="tgi_setpalette"><p>
<sect1>tgi_setpalette<label id="tgi_setpalette"><p>
<quote>
<descrip>
@ -832,7 +874,8 @@ be used in presence of a prototype.
</descrip>
</quote>
<sect>tgi_setpixel<label id="tgi_setpixel"><p>
<sect1>tgi_setpixel<label id="tgi_setpixel"><p>
<quote>
<descrip>
@ -850,7 +893,50 @@ be used in presence of a prototype.
</descrip>
</quote>
<sect>tgi_setviewpage<label id="tgi_setviewpage"><p>
<sect1>tgi_settextscale<label id="tgi_settextscale"><p>
<quote>
<descrip>
<tag/Function/Set the scaling for text output.
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/void __fastcall__ tgi_settextscale (unsigned width, unsigned height);/
<tag/Description/
Set the scaling for text output. The scaling factors for width and height
are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/
<ref id="tgi_settextstyle" name="tgi_settextstyle">
<tag/Example/None.
</descrip>
</quote>
<sect1>tgi_settextstyle<label id="tgi_settextstyle"><p>
<quote>
<descrip>
<tag/Function/Set the style for text output.
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/void __fastcall__ tgi_settextstyle (unsigned char magx, unsigned char magy, unsigned char dir, unsigned char font);/
<tag/Description/Set the style for text output.
<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/
<ref id="tgi_settextscale" name="tgi_settextscale">
<tag/Example/None.
</descrip>
</quote>
<sect1>tgi_setviewpage<label id="tgi_setviewpage"><p>
<quote>
<descrip>
@ -879,85 +965,8 @@ tgi_setviewpage(0); // Show page 0
</descrip>
</quote>
<sect>tgi_gettextheight<label id="tgi_gettextheight"><p>
<quote>
<descrip>
<tag/Function/Calculate the height of the text in pixels according to
the current text style.
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextheight (const char* s);/
<tag/Description/Calculate the height of the text in pixels according to
the current text style.
<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/Other tgi functions.
<tag/Example/None.
</descrip>
</quote>
<sect>tgi_settextscale<label id="tgi_settextscale"><p>
<quote>
<descrip>
<tag/Function/Set the scaling for text output.
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/void __fastcall__ tgi_settextscale (unsigned width, unsigned height);/
<tag/Description/
Set the scaling for text output. The scaling factors for width and height
are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/
<ref id="tgi_settextstyle" name="tgi_settextstyle">
<tag/Example/None.
</descrip>
</quote>
<sect>tgi_settextstyle<label id="tgi_settextstyle"><p>
<quote>
<descrip>
<tag/Function/Set the style for text output.
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/void __fastcall__ tgi_settextstyle (unsigned char magx, unsigned char magy, unsigned char dir, unsigned char font);/
<tag/Description/Set the style for text output.
<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/
<ref id="tgi_settextscale" name="tgi_settextscale">
<tag/Example/None.
</descrip>
</quote>
<sect>tgi_gettextwidth<label id="tgi_gettextwidth"><p>
<quote>
<descrip>
<tag/Function/Calculate the width of the text in pixels according to the current text style.
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextwidth (const char* s);/
<tag/Description/Calculate the width of the text in pixels according to the current text style.
<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/Other tgi functions.
<tag/Example/None.
</descrip>
</quote>
<sect>tgi_uninstall<label id="tgi_uninstall"><p>
<sect1>tgi_uninstall<label id="tgi_uninstall"><p>
<quote>
<descrip>
@ -973,7 +982,8 @@ Will call tgi_done if necessary.
</descrip>
</quote>
<sect>tgi_unload<label id="tgi_unload"><p>
<sect1>tgi_unload<label id="tgi_unload"><p>
<quote>
<descrip>

View File

@ -144,11 +144,9 @@ void __fastcall__ pokewsys (unsigned addr, unsigned val);
#define _textcolor(color) COLOR_WHITE
#define _bgcolor(color) COLOR_BLACK
#define _bordercolor(color) COLOR_BLACK
#define _cpeekcolor(color) COLOR_WHITE
/* End of cbm610.h */
#endif

View File

@ -148,6 +148,23 @@ int cscanf (const char* format, ...);
int __fastcall__ vcscanf (const char* format, va_list ap);
/* Like vscanf(), but uses direct keyboard input */
char cpeekc (void);
/* Return the character from the current cursor position */
unsigned char cpeekcolor (void);
/* Return the color from the current cursor position */
unsigned char cpeekrevers (void);
/* Return the reverse attribute from the current cursor position.
** If the character is reversed, then return 1; return 0 otherwise.
*/
void __fastcall__ cpeeks (char* s, unsigned int length);
/* Return a string of the characters that start at the current cursor position.
** Put the string into the buffer to which "s" points. The string will have
** "length" characters, then will be '\0'-terminated.
*/
unsigned char __fastcall__ cursor (unsigned char onoff);
/* If onoff is 1, a cursor is displayed when waiting for keyboard input. If
** onoff is 0, the cursor is hidden when waiting for keyboard input. The
@ -224,6 +241,9 @@ void __fastcall__ cputhex16 (unsigned val);
#if defined(_bordercolor)
# define bordercolor(x) _bordercolor(x)
#endif
#if defined(_cpeekcolor)
# define cpeekcolor(x) _cpeekcolor(x)
#endif

View File

@ -105,6 +105,7 @@ extern void pet_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
#define _textcolor(color) COLOR_WHITE
#define _bgcolor(color) COLOR_BLACK
#define _bordercolor(color) COLOR_BLACK
#define _cpeekcolor(color) COLOR_WHITE

View File

@ -15,35 +15,35 @@ L1: jmp PING1
.endproc
.proc _atmos_shoot
lda $31
bit $31
bvs L1 ; Atmos?
jmp SHOOT
L1: jmp SHOOT1
.endproc
.proc _atmos_explode
lda $31
bit $31
bvs L1 ; Atmos?
jmp EXPLODE
L1: jmp EXPLODE1
.endproc
.proc _atmos_zap
lda $31
bit $31
bvs L1 ; Atmos?
jmp ZAP
L1: jmp ZAP1
.endproc
.proc _atmos_tick
lda $31
bit $31
bvs L1 ; Atmos?
jmp TICK
L1: jmp TICK1
.endproc
.proc _atmos_tock
lda $31
bit $31
bvs L1 ; Atmos?
jmp TOCK
L1: jmp TOCK1

70
libsrc/c128/cpeekc.s Normal file
View File

@ -0,0 +1,70 @@
;
; 2016-02-28, Groepaz
; 2017-06-26, Greg King
;
; char cpeekc (void);
;
.export _cpeekc
.import plot, popa
.include "zeropage.inc"
.include "c128.inc"
_cpeekc:
lda MODE
bmi @c80
ldy CURS_X
lda (SCREEN_PTR),y ; get char
@return:
and #<~$80 ; remove reverse flag
; Convert the screen code into a PetSCII code.
; $00 - $1F: +$40
; $20 - $3F
; $40 - $5f: +$20
; $60 - $7F: +$40
cmp #$20
bcs @sk1 ;(bge)
ora #$40
rts
@sk1: cmp #$40
bcc @end ;(blt)
cmp #$60
bcc @sk2 ;(blt)
;sec
adc #$20 - $01
@sk2: ;clc ; both above cmp and adc clear carry flag
adc #$20
@end: rts
@c80:
lda SCREEN_PTR
ldy SCREEN_PTR+1
clc
adc CURS_X
bcc @s
iny
; get byte from VDC mem
@s: ldx #VDC_DATA_LO
stx VDC_INDEX
@L0: bit VDC_INDEX
bpl @L0
sta VDC_DATA
dex
stx VDC_INDEX
sty VDC_DATA
ldx #VDC_RAM_RW
stx VDC_INDEX
@L1: bit VDC_INDEX
bpl @L1 ; wait for blanking
lda VDC_DATA
jmp @return

56
libsrc/c128/cpeekcolor.s Normal file
View File

@ -0,0 +1,56 @@
;
; 2016-02-28, Groepaz
; 2017-06-26, Greg King
;
; unsigned char cpeekcolor (void);
;
.export _cpeekcolor
.include "c128.inc"
_cpeekcolor:
bit MODE
bmi @c80
ldy CURS_X
lda (CRAM_PTR),y ; get color
and #$0F
ldx #>$0000
rts
@c80: lda CRAM_PTR
ldy CRAM_PTR+1
clc
adc CURS_X
bcc @s
iny
; get byte from VDC mem
@s: ldx #VDC_DATA_LO
stx VDC_INDEX
@L0: bit VDC_INDEX
bpl @L0
sta VDC_DATA
dex
stx VDC_INDEX
sty VDC_DATA
ldx #VDC_RAM_RW
stx VDC_INDEX
@L1: bit VDC_INDEX
bpl @L1 ; wait for blanking
lda VDC_DATA
and #$0F
; translate VDC->VIC colour
vdctovic:
ldy #$0F + 1
@L2: dey
cmp $CE5C,y
bne @L2
tya
ldx #>$0000
rts

51
libsrc/c128/cpeekrevers.s Normal file
View File

@ -0,0 +1,51 @@
;
; 2016-02-28, Groepaz
; 2017-06-26, Greg King
;
; unsigned char cpeekrevers (void);
;
.export _cpeekrevers
.include "zeropage.inc"
.include "c128.inc"
_cpeekrevers:
lda MODE
bmi @c80
ldy CURS_X
lda (SCREEN_PTR),y ; get char
@return:
and #$80 ; get reverse flag
asl a
tax ; ldx #>$0000
rol a ; return boolean value
rts
@c80:
lda SCREEN_PTR
ldy SCREEN_PTR+1
clc
adc CURS_X
bcc @s
iny
; get byte from VDC mem
@s: ldx #VDC_DATA_LO
stx VDC_INDEX
@L0: bit VDC_INDEX
bpl @L0
sta VDC_DATA
dex
stx VDC_INDEX
sty VDC_DATA
ldx #VDC_RAM_RW
stx VDC_INDEX
@L1: bit VDC_INDEX
bpl @L1 ; wait for blanking
lda VDC_DATA
jmp @return

159
libsrc/c128/cpeeks.s Normal file
View File

@ -0,0 +1,159 @@
;
; 2017-07-05, Greg King
; 2017-12-12, Groepaz
;
; void cpeeks (char* s, unsigned length);
;
.export _cpeeks
.import popax
.importzp ptr1, ptr2, ptr3, tmp1, tmp2
.macpack generic
; FIXME c128 needs special version that handles the 80-column VDC.
.include "c128.inc"
_cpeeks:
eor #<$FFFF ; counting a word upward is faster
sta ptr3 ; so, we use -(length + 1)
txa
eor #>$FFFF
sta ptr3+1
lda MODE
bmi c80
lda SCREEN_PTR
ldx SCREEN_PTR+1
sta ptr2
stx ptr2+1
ldy CURS_X
sty tmp2
jsr popax
sta tmp1 ; (will be a .Y index)
stx ptr1+1
ldx #<$0000
stx ptr1
bze L3 ; branch always
L4: ldy tmp2
lda (ptr2),y ; get char
iny
bnz L2
inc ptr2+1
L2: sty tmp2
and #<~$80 ; remove reverse bit
; Convert the screen code into a PetSCII code.
; $00 - $1F: +$40
; $20 - $3F
; $40 - $5f: +$20
; $60 - $7F: +$40
cmp #$20
blt @sk1 ;(bcc)
cmp #$40
blt L5
cmp #$60
blt @sk2 ;(bcc)
clc
@sk1: adc #$20
@sk2: ;clc ; both above cmp and adc clear carry flag
adc #$20
L5: ldy tmp1
sta (ptr1),y
iny
bnz L1
inc ptr1+1
L1: sty tmp1
L3: inc ptr3 ; count length
bnz L4
inc ptr3+1
bnz L4
txa ; terminate the string
ldy tmp1
sta (ptr1),y
rts
;-----------------------------------------------------------
c80:
lda SCREEN_PTR
clc
adc CURS_X
sta ptr2
lda SCREEN_PTR+1
adc #0
sta ptr2+1
jsr popax
sta tmp1 ; (will be a .Y index)
stx ptr1+1
ldx #<$0000
stx ptr1
bze L3a ; branch always
L4a:
lda ptr2
ldy ptr2+1
inc ptr2
bne @s
inc ptr2+1
@s:
; get byte from VDC mem
ldx #VDC_DATA_LO
stx VDC_INDEX
@L0: bit VDC_INDEX
bpl @L0
sta VDC_DATA
dex
stx VDC_INDEX
sty VDC_DATA
ldx #VDC_RAM_RW
stx VDC_INDEX
@L1: bit VDC_INDEX
bpl @L1 ; wait for blanking
lda VDC_DATA
and #<~$80 ; remove reverse bit
; Convert the screen code into a PetSCII code.
; $00 - $1F: +$40
; $20 - $3F
; $40 - $5f: +$20
; $60 - $7F: +$40
cmp #$20
blt @sk1 ;(bcc)
cmp #$40
blt L5a
cmp #$60
blt @sk2 ;(bcc)
clc
@sk1: adc #$20
@sk2: ;clc ; both above cmp and adc clear carry flag
adc #$20
L5a: ldy tmp1
sta (ptr1),y
iny
bnz L1a
inc ptr1+1
L1a: sty tmp1
L3a: inc ptr3 ; count length
bnz L4a
inc ptr3+1
bnz L4a
lda #0 ; terminate the string
ldy tmp1
sta (ptr1),y
rts

53
libsrc/cbm/cpeekc.s Normal file
View File

@ -0,0 +1,53 @@
;
; 2016-02-28, Groepaz
; 2017-06-22, Greg King
;
; char cpeekc (void);
;
.export _cpeekc
; Get a system-specific file.
; Note: The cbm610, and c128 targets need special
; versions that handle RAM banking and the 80-column VDC.
.if .def(__C16__)
.include "plus4.inc" ; both C16 and Plus4
.elseif .def(__C64__)
.include "c64.inc"
.elseif .def(__CBM510__)
.import CURS_X: zp, SCREEN_PTR: zp
.include "cbm510.inc"
.elseif .def(__PET__)
.include "pet.inc"
.elseif .def(__VIC20__)
.include "vic20.inc"
.endif
_cpeekc:
ldy CURS_X
lda (SCREEN_PTR),y ; get screen code
ldx #>$0000
and #<~$80 ; remove reverse bit
; Convert the screen code into a PetSCII code.
; $00 - $1F: +$40
; $20 - $3F
; $40 - $5f: +$20
; $60 - $7F: +$40
cmp #$20
bcs @sk1 ;(bge)
ora #$40
rts
@sk1: cmp #$40
bcc @end ;(blt)
cmp #$60
bcc @sk2 ;(blt)
;sec
adc #$20 - $01
@sk2: ;clc ; both above cmp and adc clear carry flag
adc #$20
@end: rts

28
libsrc/cbm/cpeekcolor.s Normal file
View File

@ -0,0 +1,28 @@
;
; 2016-02-28, Groepaz
; 2017-06-22, Greg King
;
; unsigned char cpeekcolor (void);
;
.export _cpeekcolor
; Get a system-specific file.
; Note: The cbm510, cbm610, c128, and Pet targets need special
; versions that handle RAM banking, the 80-column VDC, and monochrome.
.if .def(__C16__)
.include "plus4.inc" ; both C16 and Plus4
.elseif .def(__C64__)
.include "c64.inc"
.elseif .def(__VIC20__)
.include "vic20.inc"
.endif
_cpeekcolor:
ldy CURS_X
lda (CRAM_PTR),y ; get color
and #$0F
ldx #>$0000
rts

35
libsrc/cbm/cpeekrevers.s Normal file
View File

@ -0,0 +1,35 @@
;
; 2016-02-28, Groepaz
; 2017-06-15, Greg King
;
; unsigned char cpeekrevers (void);
;
.export _cpeekrevers
; Get a system-specific file.
; Note: The cbm610, and c128 targets need special
; versions that handle RAM banking and the 80-column VDC.
.if .def(__C16__)
.include "plus4.inc" ; both C16 and Plus4
.elseif .def(__C64__)
.include "c64.inc"
.elseif .def(__CBM510__)
.import CURS_X: zp, SCREEN_PTR: zp
.include "cbm510.inc"
.elseif .def(__PET__)
.include "pet.inc"
.elseif .def(__VIC20__)
.include "vic20.inc"
.endif
_cpeekrevers:
ldy CURS_X
lda (SCREEN_PTR),y ; get screen code
and #$80 ; get reverse bit
asl a
tax ; ldx #>$0000
rol a ; return boolean value
rts

93
libsrc/cbm/cpeeks.s Normal file
View File

@ -0,0 +1,93 @@
;
; 2017-07-05, Greg King
;
; void cpeeks (char* s, unsigned length);
;
.export _cpeeks
.import popax
.importzp ptr1, ptr2, ptr3, tmp1, tmp2
.macpack generic
; Get a system-specific file.
; Note: The cbm610, and c128 targets need special
; versions that handle RAM banking and the 80-column VDC.
.if .def(__C16__)
.include "plus4.inc" ; both C16 and Plus4
.elseif .def(__C64__)
.include "c64.inc"
.elseif .def(__CBM510__)
.import CURS_X: zp, SCREEN_PTR: zp
.include "cbm510.inc"
.elseif .def(__PET__)
.include "pet.inc"
.elseif .def(__VIC20__)
.include "vic20.inc"
.endif
_cpeeks:
eor #<$FFFF ; counting a word upward is faster
sta ptr3 ; so, we use -(length + 1)
txa
eor #>$FFFF
sta ptr3+1
lda SCREEN_PTR
ldx SCREEN_PTR+1
sta ptr2
stx ptr2+1
ldy CURS_X
sty tmp2
jsr popax
sta tmp1 ; (will be a .Y index)
stx ptr1+1
ldx #<$0000
stx ptr1
bze L3 ; branch always
L4: ldy tmp2
lda (ptr2),y ; get char
iny
bnz L2
inc ptr2+1
L2: sty tmp2
and #<~$80 ; remove reverse bit
; Convert the screen code into a PetSCII code.
; $00 - $1F: +$40
; $20 - $3F
; $40 - $5f: +$20
; $60 - $7F: +$40
cmp #$20
blt @sk1 ;(bcc)
cmp #$40
blt L5
cmp #$60
blt @sk2 ;(bcc)
clc
@sk1: adc #$20
@sk2: ;clc ; both above cmp and adc clear carry flag
adc #$20
L5: ldy tmp1
sta (ptr1),y
iny
bnz L1
inc ptr1+1
L1: sty tmp1
L3: inc ptr3 ; count length
bnz L4
inc ptr3+1
bnz L4
txa ; terminate the string
ldy tmp1
sta (ptr1),y
rts

View File

@ -0,0 +1,24 @@
;
; 2016-02-28, Groepaz
; 2017-06-19, Greg King
;
; unsigned char cpeekcolor (void);
;
.export _cpeekcolor
.import CURS_X: zp, CRAM_PTR: zp
.include "cbm510.inc"
_cpeekcolor:
ldx IndReg
lda #$0F
sta IndReg
ldy CURS_X
lda (CRAM_PTR),y ; get color
stx IndReg
and #$0F
ldx #>$0000
rts

View File

@ -0,0 +1,16 @@
;
; 2016-06, Christian Groessler
; 2017-07-05, Greg King
;
; unsigned char doesclrscrafterexit (void);
;
; Returns 0/1 if, after program termination, the screen isn't/is cleared.
;
.import return1
; cc65's CBM510 programs switch to a display screen in the program RAM bank;
; then, they switch back to the system bank when they exit.
; The screen is cleared.
.export _doesclrscrafterexit := return1

45
libsrc/cbm610/cpeekc.s Normal file
View File

@ -0,0 +1,45 @@
;
; 2016-02-28, Groepaz
; 2017-06-19, Greg King
;
; char cpeekc (void);
;
.export _cpeekc
.import CURS_X: zp, CharPtr: zp
.include "cbm610.inc"
_cpeekc:
ldx IndReg
ldy #$0F
sty IndReg
ldy CURS_X
lda (CharPtr),y ; get char from system bank
stx IndReg
ldx #>$0000
and #<~$80 ; remove reverse bit
; Convert the screen code into a PetSCII code.
; $00 - $1F: +$40
; $20 - $3F
; $40 - $5f: +$20
; $60 - $7F: +$40
cmp #$20
bcs @sk1 ;(bge)
ora #$40
rts
@sk1: cmp #$40
bcc @end ;(blt)
cmp #$60
bcc @sk2 ;(blt)
;sec
adc #$20 - $01
@sk2: ;clc ; both above cmp and adc clear carry flag
adc #$20
@end: rts

View File

@ -0,0 +1,8 @@
;
; 2017-06-03, Greg King
;
; unsigned char cpeekcolor (void);
;
.import return1
.export _cpeekcolor := return1 ; always COLOR_WHITE

View File

@ -0,0 +1,29 @@
;
; 2016-02-28, Groepaz
; 2017-06-19, Greg King
;
; unsigned char cpeekrevers (void);
;
.export _cpeekrevers
.import plot
.import CURS_X: zp, CharPtr: zp
.include "cbm610.inc"
_cpeekrevers:
ldx IndReg
ldy #$0F
sty IndReg
ldy CURS_X
lda (CharPtr),y ; get char from system bank
stx IndReg
ldx #>$0000
and #$80 ; get reverse bit
asl a
tax ; ldx #>$0000
rol a ; return boolean value
rts

82
libsrc/cbm610/cpeeks.s Normal file
View File

@ -0,0 +1,82 @@
;
; 2017-07-05, Greg King
;
; void cpeeks (char* s, unsigned length);
;
.export _cpeeks
.import popax
.importzp ptr1, ptr2, ptr3, tmp1, tmp2
.importzp CURS_X, CharPtr
.include "cbm610.inc"
.macpack generic
_cpeeks:
eor #<$FFFF ; counting a word upward is faster
sta ptr3 ; so, we use -(length + 1)
txa
eor #>$FFFF
sta ptr3+1
lda CharPtr
ldx CharPtr+1
sta ptr2
stx ptr2+1
ldy CURS_X
sty tmp2
jsr popax
sta tmp1 ; (will be a .Y index)
stx ptr1+1
ldx IndReg
ldy #<$0000
sty ptr1
bze L3 ; branch always
L4: ldy #$0F
sty IndReg
ldy tmp2
lda (ptr2),y ; get char from system bank
stx IndReg
iny
bnz L2
inc ptr2+1
L2: sty tmp2
and #<~$80 ; remove reverse bit
; Convert the screen code into a PetSCII code.
; $00 - $1F: +$40
; $20 - $3F
; $40 - $5f: +$20
; $60 - $7F: +$40
cmp #$20
blt @sk1 ;(bcc)
cmp #$40
blt L5
cmp #$60
blt @sk2 ;(bcc)
clc
@sk1: adc #$20
@sk2: ;clc ; both above cmp and adc clear carry flag
adc #$20
L5: ldy tmp1
sta (ptr1),y
iny
bnz L1
inc ptr1+1
L1: sty tmp1
L3: inc ptr3 ; count length
bnz L4
inc ptr3+1
bnz L4
lda #$00 ; terminate the string
ldy tmp1
sta (ptr1),y
rts

View File

@ -1,289 +1,159 @@
;
; Ullrich von Bassewitz, 2003-10-10
;
; Character specification table.
;
; Ullrich von Bassewitz, 02.06.1998
; 2003-05-02, Greg King
;
; Copied from cbm/ctype.s
; The following 256-byte-wide table specifies attributes for the isxxx type
; of functions. Doing it by a table means some overhead in space, but it
.include "ctype.inc"
; The tables are readonly, put them into the rodata segment
.rodata
; The following 256 byte wide table specifies attributes for the isxxx type
; of functions. Doing it by a table means some overhead in space, but it
; has major advantages:
;
; * It is fast. If it weren't for the slow parameter-passing of cc65,
; one even could define C-language macroes for the isxxx functions
; (as it usually is done, on other platforms).
; * It is fast. If it weren't for the slow parameter passing of cc65, one
; could even define macros for the isxxx functions (this is usually
; done on other platforms).
;
; * It is highly portable. The only unportable part is the table itself;
; * It is highly portable. The only unportable part is the table itself,
; all real code goes into the common library.
;
; * We save some code in the isxxx functions.
; This table is taken from Craig S. Bruce's technical docs. for the ACE OS.
.include "ctype.inc"
; The table is read-only, put it into the RODATA segment.
.rodata
__ctype:
.byte CT_CTRL ; 0/00 ___rvs_@___
.byte CT_CTRL ; 1/01 ___rvs_a___
.byte CT_CTRL ; 2/02 ___rvs_b___
.byte CT_CTRL ; 3/03 ___rvs_c___
.byte CT_CTRL ; 4/04 ___rvs_d___
.byte CT_CTRL ; 5/05 ___rvs_e___
.byte CT_CTRL ; 6/06 ___rvs_f___
.byte CT_CTRL ; 7/07 _BEL/rvs_g_
.byte CT_CTRL ; 8/08 ___rvs_h___
.byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB ; 9/09 _TAB/rvs_i_
.byte CT_CTRL | CT_OTHER_WS ; 10/0a _BOL/rvs_j_
.byte CT_CTRL ; 11/0b ___rvs_k___
.byte CT_CTRL ; 12/0c ___rvs_l___
.byte CT_CTRL | CT_OTHER_WS ; 13/0d _CR_/rvs_m_
.byte CT_CTRL ; 14/0e ___rvs_n___
.byte CT_CTRL ; 15/0f ___rvs_o___
.byte CT_CTRL ; 16/10 ___rvs_p___
.byte CT_CTRL | CT_OTHER_WS ; 17/11 _VT_/rvs_q_
.byte CT_CTRL ; 18/12 ___rvs_r___
.byte CT_CTRL | CT_OTHER_WS ; 19/13 HOME/rvs_s_
.byte CT_CTRL | CT_OTHER_WS ; 20/14 _BS_/rvs_t_
.byte CT_CTRL ; 21/15 ___rvs_u___
.byte CT_CTRL ; 22/16 ___rvs_v___
.byte CT_CTRL ; 23/17 ___rvs_w___
.byte CT_CTRL ; 24/18 ___rvs_x___
.byte CT_CTRL ; 25/19 ___rvs_y___
.byte CT_CTRL ; 26/1a ___rvs_z___
.byte CT_CTRL ; 27/1b ___rvs_[___
.byte CT_CTRL ; 28/1c ___rvs_\___
.byte CT_CTRL | CT_OTHER_WS ; 29/1d cursr-right
.byte CT_CTRL ; 30/1e ___rvs_^___
.byte CT_CTRL ; 31/1f _rvs_under_
.byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___
.byte $00 ; 33/21 _____!_____
.byte $00 ; 34/22 _____"_____
.byte $00 ; 35/23 _____#_____
.byte $00 ; 36/24 _____$_____
.byte $00 ; 37/25 _____%_____
.byte $00 ; 38/26 _____&_____
.byte $00 ; 39/27 _____'_____
.byte $00 ; 40/28 _____(_____
.byte $00 ; 41/29 _____)_____
.byte $00 ; 42/2a _____*_____
.byte $00 ; 43/2b _____+_____
.byte $00 ; 44/2c _____,_____
.byte $00 ; 45/2d _____-_____
.byte $00 ; 46/2e _____._____
.byte $00 ; 47/2f _____/_____
.byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____
.byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____
.byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____
.byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____
.byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____
.byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____
.byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____
.byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____
.byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____
.byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____
.byte $00 ; 58/3a _____:_____
.byte $00 ; 59/3b _____;_____
.byte $00 ; 60/3c _____<_____
.byte $00 ; 61/3d _____=_____
.byte $00 ; 62/3e _____>_____
.byte $00 ; 63/3f _____?_____
.byte CT_CTRL ; 0/00 ___ctrl_@___
.byte CT_CTRL ; 1/01 ___ctrl_A___
.byte CT_CTRL ; 2/02 ___ctrl_B___
.byte CT_CTRL ; 3/03 ___ctrl_C___
.byte CT_CTRL ; 4/04 ___ctrl_D___
.byte CT_CTRL ; 5/05 ___ctrl_E___
.byte CT_CTRL ; 6/06 ___ctrl_F___
.byte CT_CTRL ; 7/07 ___ctrl_G___
.byte CT_CTRL ; 8/08 ___ctrl_H___
.byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB
; 9/09 ___ctrl_I___
.byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___
.byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___
.byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___
.byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___
.byte CT_CTRL ; 14/0e ___ctrl_N___
.byte CT_CTRL ; 15/0f ___ctrl_O___
.byte CT_CTRL ; 16/10 ___ctrl_P___
.byte CT_CTRL ; 17/11 ___ctrl_Q___
.byte CT_CTRL ; 18/12 ___ctrl_R___
.byte CT_CTRL ; 19/13 ___ctrl_S___
.byte CT_CTRL ; 20/14 ___ctrl_T___
.byte CT_CTRL ; 21/15 ___ctrl_U___
.byte CT_CTRL ; 22/16 ___ctrl_V___
.byte CT_CTRL ; 23/17 ___ctrl_W___
.byte CT_CTRL ; 24/18 ___ctrl_X___
.byte CT_CTRL ; 25/19 ___ctrl_Y___
.byte CT_CTRL ; 26/1a ___ctrl_Z___
.byte CT_CTRL ; 27/1b ___ctrl_[___
.byte CT_CTRL ; 28/1c ___ctrl_\___
.byte CT_CTRL ; 29/1d ___ctrl_]___
.byte CT_CTRL ; 30/1e ___ctrl_^___
.byte CT_CTRL ; 31/1f ___ctrl_____
.byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___
.byte CT_NONE ; 33/21 _____!_____
.byte CT_NONE ; 34/22 _____"_____
.byte CT_NONE ; 35/23 _____#_____
.byte CT_NONE ; 36/24 _____$_____
.byte CT_NONE ; 37/25 _____%_____
.byte CT_NONE ; 38/26 _____&_____
.byte CT_NONE ; 39/27 _____'_____
.byte CT_NONE ; 40/28 _____(_____
.byte CT_NONE ; 41/29 _____)_____
.byte CT_NONE ; 42/2a _____*_____
.byte CT_NONE ; 43/2b _____+_____
.byte CT_NONE ; 44/2c _____,_____
.byte CT_NONE ; 45/2d _____-_____
.byte CT_NONE ; 46/2e _____._____
.byte CT_NONE ; 47/2f _____/_____
.byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____
.byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____
.byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____
.byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____
.byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____
.byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____
.byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____
.byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____
.byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____
.byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____
.byte CT_NONE ; 58/3a _____:_____
.byte CT_NONE ; 59/3b _____;_____
.byte CT_NONE ; 60/3c _____<_____
.byte CT_NONE ; 61/3d _____=_____
.byte CT_NONE ; 62/3e _____>_____
.byte CT_NONE ; 63/3f _____?_____
.byte $00 ; 64/40 _____@_____
.byte CT_LOWER | CT_XDIGIT ; 65/41 _____a_____
.byte CT_LOWER | CT_XDIGIT ; 66/42 _____b_____
.byte CT_LOWER | CT_XDIGIT ; 67/43 _____c_____
.byte CT_LOWER | CT_XDIGIT ; 68/44 _____d_____
.byte CT_LOWER | CT_XDIGIT ; 69/45 _____e_____
.byte CT_LOWER | CT_XDIGIT ; 70/46 _____f_____
.byte CT_LOWER ; 71/47 _____g_____
.byte CT_LOWER ; 72/48 _____h_____
.byte CT_LOWER ; 73/49 _____i_____
.byte CT_LOWER ; 74/4a _____j_____
.byte CT_LOWER ; 75/4b _____k_____
.byte CT_LOWER ; 76/4c _____l_____
.byte CT_LOWER ; 77/4d _____m_____
.byte CT_LOWER ; 78/4e _____n_____
.byte CT_LOWER ; 79/4f _____o_____
.byte CT_LOWER ; 80/50 _____p_____
.byte CT_LOWER ; 81/51 _____q_____
.byte CT_LOWER ; 82/52 _____r_____
.byte CT_LOWER ; 83/53 _____s_____
.byte CT_LOWER ; 84/54 _____t_____
.byte CT_LOWER ; 85/55 _____u_____
.byte CT_LOWER ; 86/56 _____v_____
.byte CT_LOWER ; 87/57 _____w_____
.byte CT_LOWER ; 88/58 _____x_____
.byte CT_LOWER ; 89/59 _____y_____
.byte CT_LOWER ; 90/5a _____z_____
.byte $00 ; 91/5b _____[_____
.byte $00 ; 92/5c _____\_____
.byte $00 ; 93/5d _____]_____
.byte $00 ; 94/5e _____^_____
.byte $00 ; 95/5f _UNDERLINE_
.byte $00 ; 96/60 _A`_grave__
.byte $00 ; 97/61 _A'_acute__
.byte $00 ; 98/62 _A^_circum_
.byte $00 ; 99/63 _A~_tilde__
.byte $00 ; 100/64 _A"_dieres_
.byte $00 ; 101/65 _A__ring___
.byte $00 ; 102/66 _AE________
.byte $00 ; 103/67 _C,cedilla_
.byte $00 ; 104/68 _E`_grave__
.byte $00 ; 105/69 _E'_acute__
.byte $00 ; 106/6a _E^_circum_
.byte $00 ; 107/6b _E"_dieres_
.byte $00 ; 108/6c _I`_grave__
.byte $00 ; 109/6d _I'_acute__
.byte $00 ; 110/6e _I^_circum_
.byte $00 ; 111/6f _I"_dieres_
.byte $00 ; 112/70 _D-_Eth_lr_
.byte $00 ; 113/71 _N~_tilde__
.byte $00 ; 114/72 _O`_grave__
.byte $00 ; 115/73 _O'_acute__
.byte $00 ; 116/74 _O^_circum_
.byte $00 ; 117/75 _O~_tilde__
.byte $00 ; 118/76 _O"_dieres_
.byte $00 ; 119/77 __multiply_
.byte $00 ; 120/78 _O/_slash__
.byte $00 ; 121/79 _U`_grave__
.byte $00 ; 122/7a _U'_acute__
.byte $00 ; 123/7b _U^_circum_
.byte $00 ; 124/7c _U"_dieres_
.byte $00 ; 125/7d _Y'_acute__
.byte $00 ; 126/7e _cap_thorn_
.byte $00 ; 127/7f _Es-sed_B__
.byte CT_NONE ; 64/40 _____@_____
.byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____
.byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____
.byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____
.byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____
.byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____
.byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____
.byte CT_UPPER ; 71/47 _____G_____
.byte CT_UPPER ; 72/48 _____H_____
.byte CT_UPPER ; 73/49 _____I_____
.byte CT_UPPER ; 74/4a _____J_____
.byte CT_UPPER ; 75/4b _____K_____
.byte CT_UPPER ; 76/4c _____L_____
.byte CT_UPPER ; 77/4d _____M_____
.byte CT_UPPER ; 78/4e _____N_____
.byte CT_UPPER ; 79/4f _____O_____
.byte CT_UPPER ; 80/50 _____P_____
.byte CT_UPPER ; 81/51 _____Q_____
.byte CT_UPPER ; 82/52 _____R_____
.byte CT_UPPER ; 83/53 _____S_____
.byte CT_UPPER ; 84/54 _____T_____
.byte CT_UPPER ; 85/55 _____U_____
.byte CT_UPPER ; 86/56 _____V_____
.byte CT_UPPER ; 87/57 _____W_____
.byte CT_UPPER ; 88/58 _____X_____
.byte CT_UPPER ; 89/59 _____Y_____
.byte CT_UPPER ; 90/5a _____Z_____
.byte CT_NONE ; 91/5b _____[_____
.byte CT_NONE ; 92/5c _____\_____
.byte CT_NONE ; 93/5d _____]_____
.byte CT_NONE ; 94/5e _____^_____
.byte CT_NONE ; 95/5f _UNDERLINE_
.byte CT_NONE ; 96/60 ___grave___
.byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____
.byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____
.byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____
.byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____
.byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____
.byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____
.byte CT_LOWER ; 103/67 _____g_____
.byte CT_LOWER ; 104/68 _____h_____
.byte CT_LOWER ; 105/69 _____i_____
.byte CT_LOWER ; 106/6a _____j_____
.byte CT_LOWER ; 107/6b _____k_____
.byte CT_LOWER ; 108/6c _____l_____
.byte CT_LOWER ; 109/6d _____m_____
.byte CT_LOWER ; 110/6e _____n_____
.byte CT_LOWER ; 111/6f _____o_____
.byte CT_LOWER ; 112/70 _____p_____
.byte CT_LOWER ; 113/71 _____q_____
.byte CT_LOWER ; 114/72 _____r_____
.byte CT_LOWER ; 115/73 _____s_____
.byte CT_LOWER ; 116/74 _____t_____
.byte CT_LOWER ; 117/75 _____u_____
.byte CT_LOWER ; 118/76 _____v_____
.byte CT_LOWER ; 119/77 _____w_____
.byte CT_LOWER ; 120/78 _____x_____
.byte CT_LOWER ; 121/79 _____y_____
.byte CT_LOWER ; 122/7a _____z_____
.byte CT_NONE ; 123/7b _____{_____
.byte CT_NONE ; 124/7c _____|_____
.byte CT_NONE ; 125/7d _____}_____
.byte CT_NONE ; 126/7e _____~_____
.byte CT_OTHER_WS ; 127/7f ____DEL____
.byte CT_CTRL ; 128/80 __bullet___
.byte CT_CTRL ; 129/81 __v_line___
.byte CT_CTRL ; 130/82 __h_line___
.byte CT_CTRL ; 131/83 ___cross___
.byte CT_CTRL ; 132/84 _tl_corner_
.byte CT_CTRL ; 133/85 _tr_corner_
.byte CT_CTRL ; 134/86 _bl_corner_
.byte CT_CTRL ; 135/87 _br_corner_
.byte CT_CTRL ; 136/88 ___l_tee___
.byte CT_CTRL ; 137/89 ___r_tee___
.byte CT_CTRL ; 138/8a ___t_tee___
.byte CT_CTRL ; 139/8b ___b_tee___
.byte CT_CTRL ; 140/8c ___heart___
.byte CT_CTRL | CT_OTHER_WS ; 141/8d _CR/diamond
.byte CT_CTRL ; 142/8e ___club____
.byte CT_CTRL ; 143/8f ___spade___
.byte CT_CTRL ; 144/90 _s_circle__
.byte CT_CTRL | CT_OTHER_WS ; 145/91 _cursor-up_
.byte CT_CTRL ; 146/92 ___pound___
.byte CT_CTRL | CT_OTHER_WS ; 147/93 _CLS/check_
.byte CT_CTRL | CT_OTHER_WS ; 148/94 __INSert___
.byte CT_CTRL ; 149/95 ____+/-____
.byte CT_CTRL ; 150/96 __divide___
.byte CT_CTRL ; 151/97 __degree___
.byte CT_CTRL ; 152/98 _c_checker_
.byte CT_CTRL ; 153/99 _f_checker_
.byte CT_CTRL ; 154/9a _solid_sq__
.byte CT_CTRL ; 155/9b __cr_char__
.byte CT_CTRL ; 156/9c _up_arrow__
.byte CT_CTRL | CT_OTHER_WS ; 157/9d cursor-left
.byte CT_CTRL ; 158/9e _left_arro_
.byte CT_CTRL ; 159/9f _right_arr_
.byte CT_SPACE | CT_SPACE_TAB ; 160/a0 _req space_
.byte $00 ; 161/a1 _!_invertd_
.byte $00 ; 162/a2 ___cent____
.byte $00 ; 163/a3 ___pound___
.byte $00 ; 164/a4 __currency_
.byte $00 ; 165/a5 ____yen____
.byte $00 ; 166/a6 _|_broken__
.byte $00 ; 167/a7 __section__
.byte $00 ; 168/a8 __umulaut__
.byte $00 ; 169/a9 _copyright_
.byte $00 ; 170/aa __fem_ord__
.byte $00 ; 171/ab _l_ang_quo_
.byte $00 ; 172/ac ____not____
.byte $00 ; 173/ad _syl_hyphn_
.byte $00 ; 174/ae _registerd_
.byte $00 ; 175/af _overline__
.byte $00 ; 176/b0 __degrees__
.byte $00 ; 177/b1 ____+/-____
.byte $00 ; 178/b2 _2_supersc_
.byte $00 ; 179/b3 _3_supersc_
.byte $00 ; 180/b4 ___acute___
.byte $00 ; 181/b5 ____mu_____
.byte $00 ; 182/b6 _paragraph_
.byte $00 ; 183/b7 __mid_dot__
.byte $00 ; 184/b8 __cedilla__
.byte $00 ; 185/b9 _1_supersc_
.byte $00 ; 186/ba __mas_ord__
.byte $00 ; 187/bb _r_ang_quo_
.byte $00 ; 188/bc ____1/4____
.byte $00 ; 189/bd ____1/2____
.byte $00 ; 190/be ____3/4____
.byte $00 ; 191/bf _?_invertd_
.byte $00 ; 192/c0 _____`_____
.byte CT_UPPER | CT_XDIGIT ; 193/c1 _____A_____
.byte CT_UPPER | CT_XDIGIT ; 194/c2 _____B_____
.byte CT_UPPER | CT_XDIGIT ; 195/c3 _____C_____
.byte CT_UPPER | CT_XDIGIT ; 196/c4 _____D_____
.byte CT_UPPER | CT_XDIGIT ; 197/c5 _____E_____
.byte CT_UPPER | CT_XDIGIT ; 198/c6 _____F_____
.byte CT_UPPER ; 199/c7 _____G_____
.byte CT_UPPER ; 200/c8 _____H_____
.byte CT_UPPER ; 201/c9 _____I_____
.byte CT_UPPER ; 202/ca _____J_____
.byte CT_UPPER ; 203/cb _____K_____
.byte CT_UPPER ; 204/cc _____L_____
.byte CT_UPPER ; 205/cd _____M_____
.byte CT_UPPER ; 206/ce _____N_____
.byte CT_UPPER ; 207/cf _____O_____
.byte CT_UPPER ; 208/d0 _____P_____
.byte CT_UPPER ; 209/d1 _____Q_____
.byte CT_UPPER ; 210/d2 _____R_____
.byte CT_UPPER ; 211/d3 _____S_____
.byte CT_UPPER ; 212/d4 _____T_____
.byte CT_UPPER ; 213/d5 _____U_____
.byte CT_UPPER ; 214/d6 _____V_____
.byte CT_UPPER ; 215/d7 _____W_____
.byte CT_UPPER ; 216/d8 _____X_____
.byte CT_UPPER ; 217/d9 _____Y_____
.byte CT_UPPER ; 218/da _____Z_____
.byte $00 ; 219/db _____{_____
.byte $00 ; 220/dc _____|_____
.byte $00 ; 221/dd _____}_____
.byte $00 ; 222/de _____~_____
.byte $00 ; 223/df ___HOUSE___
.byte $00 ; 224/e0 _a`_grave__
.byte $00 ; 225/e1 _a'_acute__
.byte $00 ; 226/e2 _a^_circum_
.byte $00 ; 227/e3 _a~_tilde__
.byte $00 ; 228/e4 _a"_dieres_
.byte $00 ; 229/e5 _a__ring___
.byte $00 ; 230/e6 _ae________
.byte $00 ; 231/e7 _c,cedilla_
.byte $00 ; 232/e8 _e`_grave__
.byte $00 ; 233/e9 _e'_acute__
.byte $00 ; 234/ea _e^_circum_
.byte $00 ; 235/eb _e"_dieres_
.byte $00 ; 236/ec _i`_grave__
.byte $00 ; 237/ed _i'_acute__
.byte $00 ; 238/ee _i^_circum_
.byte $00 ; 239/ef _i"_dieres_
.byte $00 ; 240/f0 _o^x_Eth_s_
.byte $00 ; 241/f1 _n~_tilda__
.byte $00 ; 242/f2 _o`_grave__
.byte $00 ; 243/f3 _o'_acute__
.byte $00 ; 244/f4 _o^_circum_
.byte $00 ; 245/f5 _o~_tilde__
.byte $00 ; 246/f6 _o"_dieres_
.byte $00 ; 247/f7 __divide___
.byte $00 ; 248/f8 _o/_slash__
.byte $00 ; 249/f9 _u`_grave__
.byte $00 ; 250/fa _u'_acute__
.byte $00 ; 251/fb _u^_circum_
.byte $00 ; 252/fc _u"_dieres_
.byte $00 ; 253/fd _y'_acute__
.byte $00 ; 254/fe _sm_thorn__
.byte $00 ; 255/ff _y"_dieres_
.res 128, CT_NONE ; 128-255

8
libsrc/pet/cpeekcolor.s Normal file
View File

@ -0,0 +1,8 @@
;
; 2017-06-03, Greg King
;
; unsigned char cpeekcolor (void);
;
.import return1
.export _cpeekcolor := return1 ; always COLOR_WHITE

View File

@ -17,6 +17,7 @@
#include <string.h> /* for memset */
#include <time.h>
#include <conio.h>
#include <cbm.h>
@ -60,9 +61,9 @@
#ifdef DOVSYNC
# define waitvsync() while ((signed char)VIC.ctrl1 >= 0)
# define WAITVSYNC() waitvsync()
#else
# define waitvsync()
# define WAITVSYNC()
#endif
@ -203,12 +204,12 @@ int main (void)
while (!kbhit()) {
/* Build page 1, then make it visible */
fire (SCREEN1);
waitvsync ();
WAITVSYNC ();
outb (&VIC.addr, PAGE1);
/* Build page 2, then make it visible */
fire (SCREEN2);
waitvsync ();
WAITVSYNC ();
outb (&VIC.addr, PAGE2);
/* Count frames */

View File

@ -55,7 +55,7 @@ endif
ifdef GIT_SHA
$(info GIT_SHA: $(GIT_SHA))
else
GIT_SHA := $(shell git rev-parse --short HEAD 2>$(NULLDEV))
GIT_SHA := $(shell git rev-parse --short HEAD 2>$(NULLDEV) || svnversion 2>$(NULLDEV))
ifneq ($(words $(GIT_SHA)),1)
GIT_SHA := N/A
$(info GIT_SHA: N/A)

299
testcode/lib/cpeek-test.c Normal file
View File

@ -0,0 +1,299 @@
/* Test that the cpeek...() functions are the inverses of cputc(),
** revers(), and textcolor() for the full range of character codes.
**
** 2017-07-15, Greg King
** 2017-12-12, Groepaz
*/
#include <conio.h>
#include <cc65.h>
/* Standard location of the screen */
#if defined(__C128__) || defined(__C64__)
/* only 40-column screen */
# define SCREEN_RAM ((unsigned char*)0x0400)
#elif defined(__C16__) /* Plus4 also */
# define SCREEN_RAM ((unsigned char*)0x0C00)
#elif defined(__CBM510__)
# define SCREEN_RAM ((unsigned char*)0xF000)
# define COLOR_RAM ((unsigned char*)0xd400)
#elif defined(__CBM610__)
# define SCREEN_RAM ((unsigned char*)0xD000)
#elif defined(__PET__)
# define SCREEN_RAM ((unsigned char*)0x8000)
#elif defined(__VIC20__)
# define SCREEN_RAM ((unsigned char*)0x1000)
#else
# error This program cannot test that target.
# define SCREEN_RAM ((unsigned char*)0)
#endif
static unsigned char width;
/* Move the cursor backward one char with
** the recognition of a row change.
*/
static void chBack (void)
{
unsigned char y = wherey ();
unsigned char x = wherex ();
if (x == 0) {
x = width;
--y;
}
--x;
gotoxy (x, y);
}
/* Move the cursor forward one char with
** the recognition of a row change.
*/
static void chForth (void)
{
unsigned char y = wherey ();
unsigned char x = wherex ();
if (++x >= width) {
x = 0;
++y;
}
gotoxy (x, y);
}
/* A hack to get an unmodified byte from the
** screen memory at the current cursor position.
*/
static unsigned char peekChWithoutTranslation (void)
{
#if defined(__CBM610__)
return peekbsys ((unsigned)&SCREEN_RAM[wherey () * width + wherex ()]);
#else
return SCREEN_RAM[wherey () * width + wherex ()];
#endif
}
/* as above, but for color ram */
static unsigned char peekColWithoutTranslation (void)
{
#if defined(__CBM610__) || defined (__PET__)
return COLOR_WHITE;
#elif defined(__C128__) || defined(__C64__) || defined(__VIC20__) || defined(__CBM510__)
return COLOR_RAM[wherey () * width + wherex ()] & 0x0f;
#else
return COLOR_RAM[wherey () * width + wherex ()];
#endif
}
/* A test which outputs the given char, reads it back from
** screen memory, outputs the returned char at the next position,
** then compares the two screen memory bytes for identity.
**
** Note: cpeekc() must be tested indirectly because some platforms "fold" their
** character code-set into a smaller screen code-set. Therefore, cpeekc() might
** return an equivalent, but not equal, character to the one that was cputc().
*/
static unsigned char testCPeekC (char ch)
{
unsigned char ch2_a, ch2_b, ch2_c;
/* Test the given char-code, but not the
** special characters NEWLINE and RETURN
** (they don't put anything on the screen).
*/
if (('\n' == ch) || ('\r' == ch)
) {
return 1;
}
/* Output the char to the screen. */
cputc (ch);
/* Move the cursor pos. to the previous output. */
chBack ();
/* Get back the written char without any translation. */
ch2_b = peekChWithoutTranslation ();
/* Get back the written char,
** including the translation, screen-code -> text.
*/
ch2_a = cpeekc ();
/* Move the cursor to the following writing position. */
chForth ();
/* Output again the char which was read back by cpeekc(). */
cputc (ch2_a);
/* Move the cursor pos. to the second output. */
chBack ();
/* Get back the second written char without any translation;
** and, compare it to the first untranslated char.
*/
ch2_c = peekChWithoutTranslation ();
if ((ch2_c != ch2_b)
#if defined(__C128__)
/* VDC memory is not accessable */
&& (width == 40)
#endif
){
/* The test was NOT succesful.
** Output a diagnostic; and, return FAILURE.
*/
revers(0);
cprintf ("\r\nError on char: %#x was %#x instead.", ch, ch2_a);
cprintf ("\r\nRaw screen codes: %#x, %#x.", ch2_b, ch2_c);
cprintf ("\r\nscreen width: %#d", width);
return 0;
}
/* The test was succesful.
** Move the cursor to the following writing position.
*/
chForth ();
return 1;
}
static unsigned char testCPeekCol (char ch)
{
unsigned char ch2_a, ch2_b, ch2_c;
/* Output the char to the screen. */
textcolor (ch);
cputc ('*');
/* Move the cursor pos. to the previous output. */
chBack ();
/* Get back the written char without any translation. */
ch2_b = peekColWithoutTranslation ();
/* Get back the written char,
** including the translation, screen-code -> text.
*/
ch2_a = cpeekcolor ();
/* Move the cursor to the following writing position. */
chForth ();
/* Output again the char which was read back by cpeekc(). */
textcolor (ch2_a);
cputc ('x');
/* Move the cursor pos. to the second output. */
chBack ();
/* Get back the second written char without any translation;
** and, compare it to the first untranslated char.
*/
ch2_c = peekColWithoutTranslation ();
if ((ch2_c != ch2_b)
#if defined(__C128__)
/* VDC memory is not accessable */
&& (width == 40)
#endif
){
/* The test was NOT succesful.
** Output a diagnostic; and, return FAILURE.
*/
revers(0);
cprintf ("\r\nError on color: %#x was %#x instead.", ch, ch2_a);
cprintf ("\r\nRaw color codes: %#x, %#x.", ch2_b, ch2_c);
return 0;
}
/* The test was succesful.
** Move the cursor to the following writing position.
*/
chForth ();
return 1;
}
/* The main code initiates the screen for the tests, and sets the reverse flag.
** Then, it calls testCPeekC() for every char within 0..255.
** Then, it calls testCPeekCol() for each color
** Returns zero for success, one for failure.
*/
int main (void)
{
unsigned char i, c1, c2;
char s[10];
int ret = 0;
clrscr ();
revers (1);
textcolor(1);
bgcolor(0);
screensize (&width, &i);
#if defined(__VIC20__)
/* The VIC-20's screen is too small to hold the full test. */
i = 2;
#else
i = 0;
#endif
do {
if (!testCPeekC (i)) {
ret = 1;
goto exiterror;
}
} while (++i != 0); /* will wrap around when finished */
#if defined(__VIC20__)
cgetc();
#endif
/* test colors */
#if defined(__VIC20__)
clrscr ();
#endif
revers (0);
textcolor(1);
#if defined (__CBM610__) || defined (__PET__)
cprintf("\n\rno COLOR_RAM\n\r");
#elif defined (__C128__)
if (width == 40) {
cprintf("\n\rCOLOR_RAM at $%04x\n\r", COLOR_RAM);
} else {
cprintf("\n\rno COLOR_RAM\n\r");
}
#else
cprintf("\n\rCOLOR_RAM at $%04x\n\r", COLOR_RAM);
#endif
do {
if (!testCPeekCol (i)) {
ret = 1;
goto exiterror;
}
} while (++i != 16); /* max 16 colors */
/* test revers */
textcolor(1); cputc('\n'); cputc('\r');
revers(0); cputc('x'); chBack (); c1 = cpeekrevers(); chForth();
revers(1); cputc('X'); chBack (); c2 = cpeekrevers(); chForth();
cputc('\n'); cputc('\r');
revers(c1); cputc('o');
revers(c2); cputc('O');
/* test cpeeks() */
revers(0);
cprintf("\n\rtest1234"); gotox(0); cpeeks(s, 8); cputs("\n");
cputs(s);
exiterror:
if (doesclrscrafterexit()) {
cgetc();
}
return ret;
}