This commit was generated by cvs2svn to compensate for changes in r2,

which included commits to RCS files with non-trunk default branches.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2000-05-28 13:40:48 +00:00
parent 579491e8a4
commit 53dd513176
847 changed files with 91345 additions and 0 deletions

88
include/6502.h Normal file
View File

@@ -0,0 +1,88 @@
/*
* 6502.h
*
* Ullrich von Bassewitz, 20.09.1998
*/
#ifndef _6502_H
#define _6502_H
/* Possible returns of getcpu() */
#define CPU_6502 0
#define CPU_65C02 1
#define CPU_65816 2
unsigned char getcpu (void);
/* Detect the CPU the program is running on */
/* Macros for CPU instructions */
#define BRK() __asm__ ("\tbrk")
#define CLI() __asm__ ("\tcli")
#define SEI() __asm__ ("\tsei")
#define JAM() __asm__ ("\t.byte\t$02")
/* Struct that holds the registers for the sys function */
struct regs {
unsigned char a; /* A register value */
unsigned char x; /* X register value */
unsigned char y; /* Y register value */
unsigned char flags; /* Flags value */
unsigned pc; /* Program counter */
};
/* Defines for the flags in the regs structure */
#define F_NEG 0x80 /* N flag */
#define F_OVF 0x40 /* V flag */
#define F_BRK 0x10 /* B flag */
#define F_DEC 0x08 /* D flag */
#define F_IEN 0x04 /* I flag */
#define F_ZERO 0x02 /* Z flag */
#define F_CARRY 0x01 /* C flag */
/* Function to call any machine language subroutine. All registers in the
* regs structure are passed into the routine and the results are passed
* out. Some of the flags are ignored on input. The called routine must
* end with an RTS.
*/
void __fastcall__ _sys (struct regs* r);
/* Set and reset the break vector. The given user function is called if
* a break occurs. The values of the registers may be read from the brk_...
* variables. The value in brk_pc will point to the address that contains
* the brk instruction.
* The set_brk function will install an exit handler that will reset the
* vector if the program ends.
*/
extern unsigned char brk_a; /* A register value */
extern unsigned char brk_x; /* X register value */
extern unsigned char brk_y; /* Y register value */
extern unsigned char brk_sr; /* Status register */
extern unsigned brk_pc; /* PC value */
typedef void (*brk_handler) (void);
/* Type of the break handler */
void __fastcall__ set_brk (brk_handler f);
/* Set the break vector to the given address, return the old address */
void reset_brk (void);
/* Reset the break vector to the original value */
/* End of 6502.h */
#endif

38
include/_6525.h Normal file
View File

@@ -0,0 +1,38 @@
/*
* _6525.h
*
* Ullrich von Bassewitz, 22.09.1998
*
* Internal include file, do not use directly.
*
*/
#ifndef __6525_H
#define __6525_H
/* Define a structure with the 6525 register offsets. The shadow registers
* (if port C is unused) are currently not implemented, we would need a
* union to do that, however that would introduce an additional name.
*/
struct __6525 {
unsigned char pra; /* Port register A */
unsigned char prb; /* Port register B */
unsigned char prc; /* Port register C */
unsigned char ddra; /* Data direction register A */
unsigned char ddrb; /* Data direction register B */
unsigned char ddrc; /* Data direction register C */
unsigned char cr; /* Control register */
unsigned char air; /* Active interrupt register */
};
/* End of _6525.h */
#endif

43
include/_6526.h Normal file
View File

@@ -0,0 +1,43 @@
/*
* _6526.h
*
* Ullrich von Bassewitz, 22.09.1998
*
* Internal include file, do not use directly.
*
*/
#ifndef __6526_H
#define __6526_H
/* Define a structure with the 6526 register offsets */
struct __6526 {
unsigned char pra; /* Port register A */
unsigned char prb; /* Port register B */
unsigned char ddra; /* Data direction register A */
unsigned char ddrb; /* Data direction register B */
unsigned char ta_lo; /* Timer A, low byte */
unsigned char ta_hi; /* Timer A, high byte */
unsigned char tb_lo; /* Timer B, low byte */
unsigned char tb_hi; /* Timer B, high byte */
unsigned char tod_10; /* TOD, 1/10 sec. */
unsigned char tod_sec; /* TOD, seconds */
unsigned char tod_min; /* TOD, minutes */
unsigned char tod_hour; /* TOD, hours */
unsigned char sdr; /* Serial data register */
unsigned char icr; /* Interrupt control register */
unsigned char cra; /* Control register A */
unsigned char crb; /* Control register B */
};
/* End of _6526.h */
#endif

29
include/_6545.h Normal file
View File

@@ -0,0 +1,29 @@
/*
* _6545.h
*
* Ullrich von Bassewitz, 22.09.1998
*
* Internal include file, do not use directly.
*
*/
#ifndef __6545_H
#define __6545_H
/* Define a structure with the 6545 register offsets */
struct __6545 {
unsigned char ctrl; /* Control register */
unsigned char data; /* Data register */
};
/* End of _6545.h */
#endif

31
include/_6551.h Normal file
View File

@@ -0,0 +1,31 @@
/*
* _6551.h
*
* Ullrich von Bassewitz, 22.09.1998
*
* Internal include file, do not use directly.
*
*/
#ifndef __6551_H
#define __6551_H
/* Define a structure with the 6551 register offsets */
struct __6551 {
unsigned char data; /* Data register */
unsigned char status; /* Status register */
unsigned char cmd; /* Command register */
unsigned char ctrl; /* Control register */
};
/* End of _6551.h */
#endif

37
include/_antic.h Normal file
View File

@@ -0,0 +1,37 @@
/*
* _antic.h
*
* Freddy Offenga, 4/9/2000
*
* Internal include file, do not use directly.
*
*/
#ifndef __ANTIC_H
#define __ANTIC_H
/* Define a structure with the antic register offsets */
struct __antic {
unsigned char dmactl; /* direct memory access control */
unsigned char chactl; /* character mode control */
unsigned char dlistl; /* display list pointer low-byte */
unsigned char dlisth; /* display list pointer high-byte */
unsigned char hscrol; /* horizontal scroll enable */
unsigned char vscrol; /* vertical scroll enable */
unsigned char unuse0; /* unused */
unsigned char pmbase; /* msb of p/m base address */
unsigned char unuse1; /* unused */
unsigned char chbase; /* character base address */
unsigned char wsync; /* wait for horizontal synchronization */
unsigned char vcount; /* vertical line counter */
unsigned char penh; /* light pen horizontal position */
unsigned char penv; /* light pen vertical position */
unsigned char nmien; /* non-maskable interrupt enable */
unsigned char nmires; /* nmi reset/status */
};
/* End of _antic.h */
#endif

78
include/_gtia.h Normal file
View File

@@ -0,0 +1,78 @@
/*
* _gtia.h
*
* Freddy Offenga, 4/9/2000
*
* Internal include file, do not use directly.
*
*/
#ifndef __GTIA_H
#define __GTIA_H
/* Define a structure with the gtia register offsets */
struct __gtia_write {
unsigned char hposp0; /* horizontal position player 0 */
unsigned char hposp1; /* horizontal position player 1 */
unsigned char hposp2; /* horizontal position player 2 */
unsigned char hposp3; /* horizontal position player 3 */
unsigned char hposm0; /* horizontal position missile 0 */
unsigned char hposm1; /* horizontal position missile 1 */
unsigned char hposm2; /* horizontal position missile 2 */
unsigned char hposm3; /* horizontal position missile 3 */
unsigned char sizep0; /* size of player 0 */
unsigned char sizep1; /* size of player 1 */
unsigned char sizep2; /* size of player 2 */
unsigned char sizep3; /* size of player 3 */
unsigned char sizem; /* size of missiles */
unsigned char grafp0; /* graphics shape player 0 */
unsigned char grafp1; /* graphics shape player 1 */
unsigned char grafp2; /* graphics shape player 2 */
unsigned char grafp3; /* graphics shape player 3 */
unsigned char grafm; /* graphics shape missiles */
unsigned char colpm0; /* color player and missile 0 */
unsigned char colpm1; /* color player and missile 1 */
unsigned char colpm2; /* color player and missile 2 */
unsigned char colpm3; /* color player and missile 3 */
unsigned char colpf0; /* color playfield 0 */
unsigned char colpf1; /* color playfield 1 */
unsigned char colpf2; /* color playfield 2 */
unsigned char colpf3; /* color playfield 3 */
unsigned char colbk; /* color background */
unsigned char prior; /* priority selection */
unsigned char vdelay; /* vertical delay */
unsigned char gractl; /* stick/paddle latch, p/m control */
unsigned char hitclr; /* clear p/m collision */
unsigned char consol; /* console buttons */
};
/* Define a structure with the gtia register offsets */
struct __gtia_read {
unsigned char m0pf; /* missile 0 to playfield collision */
unsigned char m1pf; /* missile 1 to playfield collision */
unsigned char m2pf; /* missile 2 to playfield collision */
unsigned char m3pf; /* missile 3 to playfield collision */
unsigned char p0pf; /* player 0 to playfield collision */
unsigned char p1pf; /* player 1 to playfield collision */
unsigned char p2pf; /* player 2 to playfield collision */
unsigned char p3pf; /* player 3 to playfield collision */
unsigned char m0pl; /* missile 0 to player collision */
unsigned char m1pl; /* missile 1 to player collision */
unsigned char m2pl; /* missile 2 to player collision */
unsigned char m3pl; /* missile 3 to player collision */
unsigned char p0pl; /* player 0 to player collision */
unsigned char p1pl; /* player 1 to player collision */
unsigned char p2pl; /* player 2 to player collision */
unsigned char p3pl; /* player 3 to player collision */
unsigned char trig0; /* joystick trigger 0 */
unsigned char trig1; /* joystick trigger 1 */
unsigned char trig2; /* joystick trigger 2 */
unsigned char trig3; /* joystick trigger 3 */
unsigned char pal; /* pal/ntsc flag */
};
/* End of _gtia.h */
#endif

44
include/_pbi.h Normal file
View File

@@ -0,0 +1,44 @@
/*
* _pbi.h
*
* Freddy Offenga, 4/25/2000
*
* Internal include file, do not use directly.
* Atari parallel bus definitions
*
*/
#ifndef __PBI_H
#define __PBI_H
/* parallel bus interface area */
#define PBI ((unsigned char*)0xD100)
/* parallel device IRQ status */
#define PDVI ((unsigned char*)0xD1FF)
/* parallel device select */
#define PDVS ((unsigned char*)0xD1FF)
/* parallel bus interface RAM area */
#define PBIRAM ((unsigned char*)0xD600)
/* parallel device ID 1 */
#define PDID1 ((unsigned char*)0xD803)
/* parallel device I/O vector */
#define PDIDV ((unsigned char*)0xD805)
/* parallel device IRQ vector */
#define PDIRQV ((unsigned char*)0xD808)
/* parallel device ID 2 */
#define PDID2 ((unsigned char*)0xD80B)
/* parallel device vector table */
#define PDVV ((unsigned char*)0xD80D)
/* End of _pbi.h */
#endif

25
include/_pia.h Normal file
View File

@@ -0,0 +1,25 @@
/*
* _pia.h
*
* Freddy Offenga, 4/9/2000
*
* Internal include file, do not use directly.
*
*/
#ifndef __PIA_H
#define __PIA_H
/* Define a structure with the pia register offsets */
struct __pia {
unsigned char porta; /* port A data r/w */
unsigned char portb; /* port B data r/w */
unsigned char pactl; /* port A control */
unsigned char pbctl; /* port B control */
};
/* End of _pia.h */
#endif

55
include/_pokey.h Normal file
View File

@@ -0,0 +1,55 @@
/*
* _pokey.h
*
* Freddy Offenga, 4/9/2000
*
* Internal include file, do not use directly.
*
*/
#ifndef __POKEY_H
#define __POKEY_H
/* Define a structure with the pokey register offsets */
struct __pokey_write {
unsigned char audf1; /* audio channel #1 frequency */
unsigned char audc1; /* audio channel #1 control */
unsigned char audf2; /* audio channel #2 frequency */
unsigned char audc2; /* audio channel #2 control */
unsigned char audf3; /* audio channel #3 frequency */
unsigned char audc3; /* audio channel #3 control */
unsigned char audf4; /* audio channel #4 frequency */
unsigned char audc4; /* audio channel #4 control */
unsigned char audctl; /* audio control */
unsigned char stimer; /* start pokey timers */
unsigned char skrest; /* reset serial port status reg. */
unsigned char potgo; /* start paddle scan sequence */
unsigned char unuse1; /* unused */
unsigned char serout; /* serial port data output */
unsigned char irqen; /* interrupt request enable */
unsigned char skctl; /* serial port control */
};
struct __pokey_read {
unsigned char pot0; /* paddle 0 value */
unsigned char pot1; /* paddle 1 value */
unsigned char pot2; /* paddle 2 value */
unsigned char pot3; /* paddle 3 value */
unsigned char pot4; /* paddle 4 value */
unsigned char pot5; /* paddle 5 value */
unsigned char pot6; /* paddle 6 value */
unsigned char pot7; /* paddle 7 value */
unsigned char allpot; /* eight paddle port status */
unsigned char kbcode; /* keyboard code */
unsigned char random; /* random number generator */
unsigned char unuse2; /* unused */
unsigned char unuse3; /* unused */
unsigned char serin; /* serial port input */
unsigned char irqst; /* interrupt request status */
unsigned char skstat; /* serial port status */
};
/* End of _pokey.h */
#endif

43
include/_sid.h Normal file
View File

@@ -0,0 +1,43 @@
/*
* _sid.h
*
* Ullrich von Bassewitz, 22.09.1998
*
* Internal include file, do not use directly.
*
*/
#ifndef __SID_H
#define __SID_H
/* Define a structure with the sid register offsets */
struct __sid_voice {
unsigned freq; /* Frequency */
unsigned pw; /* Pulse width */
unsigned char ctrl; /* Control register */
unsigned char ad; /* Attack/decay */
unsigned char sr; /* Sustain/release */
};
struct __sid {
struct __sid_voice v1; /* Voice 1 */
struct __sid_voice v2; /* Voice 2 */
struct __sid_voice v3; /* Voice 3 */
unsigned flt_freq; /* Filter frequency */
unsigned char flt_ctrl; /* Filter control register */
unsigned char amp; /* Amplitude */
unsigned char ad1; /* A/D converter 1 */
unsigned char noise; /* Noise generator */
unsigned char read3; /* Value of voice 3 */
};
/* End of _sid.h */
#endif

29
include/_vdc.h Normal file
View File

@@ -0,0 +1,29 @@
/*
* _vdc.h
*
* Ullrich von Bassewitz, 22.09.1998
*
* Internal include file, do not use directly.
*
*/
#ifndef __VDC_H
#define __VDC_H
/* Define a structure with the vdc register offsets */
struct __vdc {
unsigned char ctrl; /* Control register */
unsigned char data; /* Data register */
};
/* End of _vdc.h */
#endif

78
include/_vic.h Normal file
View File

@@ -0,0 +1,78 @@
/*
* _vic.h
*
* Ullrich von Bassewitz, 12.08.1998
*
* Internal include file, do not use directly.
*
*/
#ifndef __VIC_H
#define __VIC_H
/* Define a structure with the vic register offsets */
struct __vic {
unsigned char spr0_x; /* Sprite 0, X coordinate */
unsigned char spr0_y; /* Sprite 0, Y coordinate */
unsigned char spr1_x; /* Sprite 1, X coordinate */
unsigned char spr1_y; /* Sprite 1, Y coordinate */
unsigned char spr2_x; /* Sprite 2, X coordinate */
unsigned char spr2_y; /* Sprite 2, Y coordinate */
unsigned char spr3_x; /* Sprite 3, X coordinate */
unsigned char spr3_y; /* Sprite 3, Y coordinate */
unsigned char spr4_x; /* Sprite 4, X coordinate */
unsigned char spr4_y; /* Sprite 4, Y coordinate */
unsigned char spr5_x; /* Sprite 5, X coordinate */
unsigned char spr5_y; /* Sprite 5, Y coordinate */
unsigned char spr6_x; /* Sprite 6, X coordinate */
unsigned char spr6_y; /* Sprite 6, Y coordinate */
unsigned char spr7_x; /* Sprite 7, X coordinate */
unsigned char spr7_y; /* Sprite 7, Y coordinate */
unsigned char spr_hi_x; /* High bits of X coordinate */
unsigned char ctrl1; /* Control register 1 */
unsigned char rasterline; /* Current raster line */
unsigned char strobe_x; /* Light pen, X position */
unsigned char strobe_y; /* Light pen, Y position */
unsigned char spr_ena; /* Enable sprites */
unsigned char ctrl2; /* Control register 2 */
unsigned char spr_exp_x; /* Expand sprites in X dir */
unsigned char addr; /* Address of chargen and video ram */
unsigned char irr; /* Interrupt request register */
unsigned char imr; /* Interrupt mask register */
unsigned char spr_bg_prio; /* Priority to background */
unsigned char spr_mcolor; /* Sprite multicolor bits */
unsigned char spr_exp_y; /* Expand sprites in Y dir */
unsigned char spr_coll; /* Sprite/sprite collision reg */
unsigned char spr_bg_coll; /* Sprite/background collision reg */
unsigned char bordercolor; /* Border color */
unsigned char bgcolor0; /* Background color 0 */
unsigned char bgcolor1; /* Background color 1 */
unsigned char bgcolor2; /* Background color 2 */
unsigned char bgcolor3; /* Background color 3 */
unsigned char spr_mcolor0; /* Color 0 for multicolor sprites */
unsigned char spr_mcolor1; /* Color 1 for multicolor sprites */
unsigned char spr0_color; /* Color sprite 0 */
unsigned char spr1_color; /* Color sprite 1 */
unsigned char spr2_color; /* Color sprite 2 */
unsigned char spr3_color; /* Color sprite 3 */
unsigned char spr4_color; /* Color sprite 4 */
unsigned char spr5_color; /* Color sprite 5 */
unsigned char spr6_color; /* Color sprite 6 */
unsigned char spr7_color; /* Color sprite 7 */
/* The following ones are only valid in the C128: */
unsigned char x_kbd; /* Additional keyboard lines */
unsigned char clock; /* Clock switch bit */
};
/* End of _vic.h */
#endif

86
include/ace.h Normal file
View File

@@ -0,0 +1,86 @@
/*
* ace.h
*
* Ullrich von Bassewitz, 06.06.1998
*
*/
#ifndef _ACE_H
#define _ACE_H
#ifndef _STDDEF_H
#include <stddef.h>
#endif
struct aceDirentBuf {
unsigned long ad_size; /* Size in bytes */
unsigned char ad_date [8]; /* YY:YY:MM:DD:HH:MM:SS:TW */
char ad_type [4]; /* File type as ASCIIZ string */
unsigned char ad_flags; /* File flags */
unsigned char ad_usage; /* More flags */
unsigned char ad_namelen; /* Length of name */
char ad_name [17]; /* Name itself, ASCIIZ */
};
int aceDirOpen (char* dir);
int aceDirClose (int handle);
int aceDirRead (int handle, struct aceDirentBuf* buf);
/* Type of an ACE key. Key in low byte, shift mask in high byte */
typedef unsigned int aceKey;
/* #defines for the shift mask returned by aceConGetKey */
#define aceSH_KEY 0x00FF /* Mask key itself */
#define aceSH_MASK 0xFF00 /* Mask shift mask */
#define aceSH_EXT 0x2000 /* Extended key */
#define aceSH_CAPS 0x1000 /* Caps lock key */
#define aceSH_ALT 0x0800 /* Alternate key */
#define aceSH_CTRL 0x0400 /* Ctrl key */
#define aceSH_CBM 0x0200 /* Commodore key */
#define aceSH_SHIFT 0x0100 /* Shift key */
/* #defines for the options in aceConSetOpt/aceConGetOpt */
#define aceOP_PUTMASK 1 /* Console put mask */
#define aceOP_CHARCOLOR 2 /* Character color */
#define aceOP_CHARATTR 3 /* Character attribute */
#define aceOP_FILLCOLOR 4 /* Fill color */
#define aceOP_FILLATTR 5 /* Fill attribute */
#define aceOP_CRSCOLOR 6 /* Cursor color */
#define aceOP_CRSWRAP 7 /* Force cursor wrap */
#define aceOP_SHSCROLL 8 /* Shift keys for scrolling */
#define aceOP_MOUSCALE 9 /* Mouse scaling */
#define aceOP_RPTDELAY 10 /* Key repeat delay */
#define aceOP_RPTRATE 11 /* Key repeat rate */
/* Console functions */
void aceConWrite (char* buf, size_t count);
void aceConPutLit (int c);
void aceConPos (unsigned x, unsigned y);
void aceConGetPos (unsigned* x, unsigned* y);
unsigned aceConGetX (void);
unsigned aceConGetY (void);
char* aceConInput (char* buf, unsigned initial);
int aceConStopKey (void);
aceKey aceConGetKey (void);
int aceConKeyAvail (aceKey* key);
void aceConKeyMat (char* matrix);
void aceConSetOpt (unsigned char opt, unsigned char val);
int aceConGetOpt (unsigned char opt);
/* Misc stuff */
int aceMiscIoPeek (unsigned addr);
void aceMiscIoPoke (unsigned addr, unsigned char val);
/* End of ace.h */
#endif

58
include/apple2.h Normal file
View File

@@ -0,0 +1,58 @@
/*
* apple2.h
*
* Written by Kevin Ruland.
*/
#ifndef _APPLE2_H
#define _APPLE2_H
/* Color Defines
* Since Apple2 does not support color text these defines are only
* used to get the library to compile correctly. They should not be used
* in user code
*/
#define COLOR_BLACK 0x00
#define COLOR_WHITE 0x01
/* Characters codes */
#define CH_DEL 0x7F
#define CH_ESC 0x1B
#define CH_CURS_UP 0x0B
#define CH_CURS_DOWN 0x0A
/* These are defined to be OpenApple + 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
#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 '+'
/* End of apple2.h */
#endif

29
include/assert.h Normal file
View File

@@ -0,0 +1,29 @@
/*
* assert.h
*
* Ullrich von Bassewitz, 06.06.1998
*
*/
#ifndef _ASSERT_H
#define _ASSERT_H
#undef assert
#ifdef NDEBUG
# define assert(expr)
#else
extern void _afailed (const char*, unsigned);
# define assert(expr) if ((expr) == 0) _afailed (__FILE__, __LINE__)
#endif
/* End of assert.h */
#endif

75
include/atari.h Normal file
View File

@@ -0,0 +1,75 @@
/*
* atari.h
*
* Contributing authors:
* Mark Keates
* Freddy Offenga
* Christian Groessler
*/
#ifndef _ATARI_H
#define _ATARI_H
/* Color Defines */
#define COLOR_BLACK 0x00
#define COLOR_WHITE 0x0E
/* Characters codes */
#define CH_DEL 0xFE
#define CH_ESC 0x1B
#define CH_CURS_UP 28
#define CH_CURS_DOWN 29
#define CH_CURS_LEFT 30
#define CH_CURS_RIGHT 31
#define CH_TAB 0x7F /* tabulator */
#define CH_EOL 0x0B /* end-of-line marker */
#define CH_CLR 0x7D /* clear screen */
#define CH_BEL 0xFD /* bell */
#define CH_RUBOUT 0x7E /* back space (rubout) */
#define CH_DELLINE 0x9C /* delete line */
#define CH_INSLINE 0x9D /* insert line */
/* These are defined to be Atari + NumberKey */
#define CH_F1 177
#define CH_F2 178
#define CH_F3 179
#define CH_F4 180
#define CH_F5 181
#define CH_F6 182
#define CH_F7 183
#define CH_F8 184
#define CH_F9 185
#define CH_F10 176
#define CH_ULCORNER 0x11
#define CH_URCORNER 0x05
#define CH_LLCORNER 0x1A
#define CH_LRCORNER 0x03
#define CH_TTEE 0x17
#define CH_BTEE 0x18
#define CH_LTEE 0x01
#define CH_RTEE 0x04
#define CH_CROSS 0x19
#define CH_HLINE 0x12
#define CH_VLINE 0x16
/* Define hardware */
#include <_gtia.h>
#define GTIA (*(struct __gtia_write*)0xD000)
#define GTIA (*(struct __gtia_read*)0xD000)
#include <_pbi.h>
#include <_pokey.h>
#define POKEY (*(struct __pokey_write*)0xD200)
#define POKEY (*(struct __pokey_read*)0xD200)
#include <_pia.h>
#define PIA (*(struct __pia*)0xD300)
#include <_antic.h>
#define ANTIC (*(struct __antic*)0xD400)
/* End of atari.h */
#endif

68
include/c128.h Normal file
View File

@@ -0,0 +1,68 @@
/*
* c128.h
*
* Ullrich von Bassewitz, 12.08.1998
*/
#ifndef _C128_H
#define _C128_H
/* Additional key defines */
#define CH_F1 133
#define CH_F2 137
#define CH_F3 134
#define CH_F4 138
#define CH_F5 135
#define CH_F6 139
#define CH_F7 136
#define CH_F8 140
/* Color defines */
#define COLOR_BLACK 0x00
#define COLOR_WHITE 0x01
#define COLOR_RED 0x02
#define COLOR_CYAN 0x03
#define COLOR_VIOLET 0x04
#define COLOR_GREEN 0x05
#define COLOR_BLUE 0x06
#define COLOR_YELLOW 0x07
#define COLOR_ORANGE 0x08
#define COLOR_BROWN 0x09
#define COLOR_LIGHTRED 0x0A
#define COLOR_GRAY1 0x0B
#define COLOR_GRAY2 0x0C
#define COLOR_LIGHTGREEN 0x0D
#define COLOR_LIGHTBLUE 0x0E
#define COLOR_GRAY3 0x0F
/* Define hardware */
#include <_vic.h>
#define VIC (*(struct __vic*)0xD000)
#include <_sid.h>
#define SID (*(struct __sid*)0xD400)
#include <_6526.h>
#define CIA1 (*(struct __6526*)0xDC00)
#define CIA2 (*(struct __6526*)0xDD00)
/* Define special memory areas */
#define COLOR_RAM ((unsigned char*)0xD800)
/* End of c128.h */
#endif

68
include/c64.h Normal file
View File

@@ -0,0 +1,68 @@
/*
* c64.h
*
* Ullrich von Bassewitz, 12.08.1998
*/
#ifndef _C64_H
#define _C64_H
/* Additional key defines */
#define CH_F1 133
#define CH_F2 137
#define CH_F3 134
#define CH_F4 138
#define CH_F5 135
#define CH_F6 139
#define CH_F7 136
#define CH_F8 140
/* Color defines */
#define COLOR_BLACK 0x00
#define COLOR_WHITE 0x01
#define COLOR_RED 0x02
#define COLOR_CYAN 0x03
#define COLOR_VIOLET 0x04
#define COLOR_GREEN 0x05
#define COLOR_BLUE 0x06
#define COLOR_YELLOW 0x07
#define COLOR_ORANGE 0x08
#define COLOR_BROWN 0x09
#define COLOR_LIGHTRED 0x0A
#define COLOR_GRAY1 0x0B
#define COLOR_GRAY2 0x0C
#define COLOR_LIGHTGREEN 0x0D
#define COLOR_LIGHTBLUE 0x0E
#define COLOR_GRAY3 0x0F
/* Define hardware */
#include <_vic.h>
#define VIC (*(struct __vic*)0xD000)
#include <_sid.h>
#define SID (*(struct __sid*)0xD400)
#include <_6526.h>
#define CIA1 (*(struct __6526*)0xDC00)
#define CIA2 (*(struct __6526*)0xDD00)
/* Define special memory areas */
#define COLOR_RAM ((unsigned char*)0xD800)
/* End of c64.h */
#endif

74
include/cbm.h Normal file
View File

@@ -0,0 +1,74 @@
/*
* cbm.h
*
* Ullrich von Bassewitz, 07.08.1998
*/
#ifndef _CBM_H
#define _CBM_H
/* Load the system specific files here, if needed */
#ifdef __C64__
#ifndef _C64_H
#include <c64.h>
#endif
#endif
#ifdef __C128__
#ifndef _C128_H
#include <c128.h>
#endif
#endif
#ifdef __PLUS4__
#ifndef _PLUS4_H
#include <plus4.h>
#endif
#endif
#ifdef __CBM610__
#ifndef _CBM610_H
#include <cbm610.h>
#endif
#endif
#ifdef __PET__
#ifndef _PET_H
#include <pet.h>
#endif
#endif
/* Characters codes (CBM charset) */
#define CH_HLINE 96
#define CH_VLINE 125
#define CH_ULCORNER 176
#define CH_URCORNER 174
#define CH_LLCORNER 173
#define CH_LRCORNER 189
#define CH_TTEE 178
#define CH_RTEE 179
#define CH_BTEE 177
#define CH_LTEE 171
#define CH_CROSS 123
#define CH_CURS_UP 145
#define CH_CURS_DOWN 17
#define CH_CURS_LEFT 157
#define CH_CURS_RIGHT 29
#define CH_PI 126
#define CH_DEL 20
#define CH_INS 148
#define CH_ESC 95
/* End of cbm.h */
#endif

73
include/cbm610.h Normal file
View File

@@ -0,0 +1,73 @@
/*
* cbm610.h
*
* Ullrich von Bassewitz, 12.08.1998
*/
#ifndef _CBM610_H
#define _CBM610_H
/* Additional key defines */
#define CH_F1 224
#define CH_F2 225
#define CH_F3 226
#define CH_F4 227
#define CH_F5 228
#define CH_F6 229
#define CH_F7 230
#define CH_F8 231
#define CH_F9 232
#define CH_F10 233
#define CH_F11 234
#define CH_F12 235
#define CH_F13 236
#define CH_F14 237
#define CH_F15 238
#define CH_F16 239
#define CH_F17 240
#define CH_F18 241
#define CH_F19 242
#define CH_F20 243
/* Color defines */
#define COLOR_BLACK 0x00
#define COLOR_WHITE 0x01
/* Special routines to write bytes and words in the system bank */
void __fastcall__ pokebsys (unsigned addr, unsigned char val);
void __fastcall__ pokewsys (unsigned addr, unsigned val);
/* Define hardware */
#include <_6545.h>
#define CRTC (*(struct __6545)0xD800)
#include <_sid.h>
#define SID (*(struct __sid*)0xDA00)
#include <_6526.h>
#define CIA (*(struct __cia*)0xDC00)
#include <_6551.h>
#define ACIA (*(struct __6551*)0xDD00)
#include <_6525.h>
#define TPI1 (*(struct __6525*)0xDE00)
#define TPI2 (*(struct __6525*)0xDF00)
/* End of cbm610.h */
#endif

158
include/conio.h Normal file
View File

@@ -0,0 +1,158 @@
/*
* conio.h
*
* Ullrich von Bassewitz, 06.08.1998
*
*
* This is the direct console interface for cc65. I do not like the function
* names very much, but the first version started as a rewrite of Borlands
* conio, and, even if the interface has changed, the names did not.
*
* The interface does direct screen I/O, so it is fast enough for most
* programs. I did not implement text windows, since many applications do
* not need them and should not pay for the additional overhead. It should
* be easy to add text windows on a higher level if needed,
*
* Most routines do not check the parameters. This may be unfortunate but is
* also related to speed. The coordinates are always 0/0 based.
*
*/
#ifndef _CONIO_H
#define _CONIO_H
#ifndef _STDARG_H
# include <stdarg.h>
#endif
/* Read the CBM file if we're compiling for a CBM machine */
#ifdef __CBM__
# ifndef _CBM_H
# include <cbm.h>
# endif
#endif
#ifdef __APPLE2__
# ifndef _APPLE2_H
# include <apple2.h>
# endif
#endif
#ifdef __ATARI__
# ifndef _ATARI_H
# include <atari.h>
# endif
#endif
/*****************************************************************************/
/* Functions */
/*****************************************************************************/
void clrscr (void);
/* Clear the whole screen and put the cursor into the top left corner */
unsigned char kbhit (void);
/* Return true if there's a key waiting, return false if not */
void __fastcall__ gotox (unsigned char x);
/* Set the cursor to the specified X position, leave the Y position untouched */
void __fastcall__ gotoy (unsigned char y);
/* Set the cursor to the specified Y position, leave the X position untouched */
void __fastcall__ gotoxy (unsigned char x, unsigned char y);
/* Set the cursor to the specified position */
unsigned char wherex (void);
/* Return the X position of the cursor */
unsigned char wherey (void);
/* Return the Y position of the cursor */
void __fastcall__ cputc (char c);
/* Output one character at the current cursor position */
void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
/* Same as "gotoxy (x, y); cputc (c);" */
void __fastcall__ cputs (const char* s);
/* Output a NUL terminated string at the current cursor position */
void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);
/* Same as "gotoxy (x, y); puts (s);" */
int cprintf (const char* format, ...);
/* Like printf, but uses direct screen I/O */
int vcprintf (const char* format, va_list ap);
/* Like vprintf, but uses direct screen I/O */
char cgetc (void);
/* Return a character from the keyboard. If there is no character available,
* the functions waits until the user does press a key. If cursor is set to
* 1 (see below), a blinking cursor is displayed while waiting.
*/
unsigned char __fastcall__ cursor (unsigned char onoff);
/* If onoff is 1, a cursor is display when waiting for keyboard input. If
* onoff is 0, the cursor is hidden when waiting for keyboard input. The
* function returns the old cursor setting.
*/
unsigned char __fastcall__ revers (unsigned char onoff);
/* Enable/disable reverse character display. This may not be supported by
* the output device. Return the old setting.
*/
unsigned char __fastcall__ textcolor (unsigned char color);
/* Set the color for text output. The old color setting is returned. */
unsigned char __fastcall__ bgcolor (unsigned char color);
/* Set the color for the background. The old color setting is returned. */
unsigned char __fastcall__ bordercolor (unsigned char color);
/* Set the color for the border. The old color setting is returned. */
void __fastcall__ chline (unsigned char length);
/* Output a horizontal line with the given length starting at the current
* cursor position.
*/
void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);
/* Same as "gotoxy (x, y); chline (length);" */
void __fastcall__ cvline (unsigned char length);
/* Output a vertical line with the given length at the current cursor
* position.
*/
void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);
/* Same as "gotoxy (x, y); cvline (length);" */
void __fastcall__ cclear (unsigned char length);
/* Clear part of a line (write length spaces). */
void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);
/* Same as "gotoxy (x, y); cclear (length);" */
void __fastcall__ screensize (unsigned char* x, unsigned char* y);
/* Return the current screen size. */
void __fastcall__ cputhex8 (unsigned char val);
void __fastcall__ cputhex16 (unsigned val);
/* These shouldn't be here... */
/* End of conio.h */
#endif

70
include/ctype.h Normal file
View File

@@ -0,0 +1,70 @@
/*
* ctype.h
*
* Ullrich von Bassewitz, 03.06.1998
*
*/
#ifndef _CTYPE_H
#define _CTYPE_H
int __fastcall__ isalnum (int c);
int __fastcall__ isalpha (int c);
int __fastcall__ iscntrl (int c);
int __fastcall__ isdigit (int c);
int __fastcall__ isgraph (int c);
int __fastcall__ islower (int c);
int __fastcall__ isprint (int c);
int __fastcall__ ispunct (int c);
int __fastcall__ isspace (int c);
int __fastcall__ isupper (int c);
int __fastcall__ isxdigit (int c);
#ifndef __STRICT_ANSI__
int __fastcall__ isblank (int c); /* cc65 (and GNU) extension */
#endif
int __fastcall__ toupper (int c); /* Always external */
int __fastcall__ tolower (int c); /* Always external */
/* When inlining of known function is enabled, overload most of the above
* functions by macros. The function prototypes are again available after
* #undef'ing the macros.
*/
#ifdef __OPT_s__
extern unsigned char _ctype[256];
#define isalnum(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$07"), __AX__)
#define isalpha(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$03"), __AX__)
#define iscntrl(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$10"), __AX__)
#define isdigit(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$04"), __AX__)
#define isgraph(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\teor\t#$30\n\tand\t#$30"), __AX__)
#define islower(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$01"), __AX__)
#define isprint(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\teor\t#$10\n\tand\t#$10"), __AX__)
#define ispunct(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\teor\t#$37\n\tand\t#$37"), __AX__)
#define isspace(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$60"), __AX__)
#define isupper(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$02"), __AX__)
#define isxdigit(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$08"), __AX__)
#ifndef __STRICT_ANSI__
/* cc65 and GNU extension */
#define isblank(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$80"), __AX__)
#endif
#endif
/* End of ctype.h */
#endif

96
include/dbg.h Normal file
View File

@@ -0,0 +1,96 @@
/*
* dbg.h
*
* Ullrich von Bassewitz, 08.08.1998
*
*
* This is the interface to the cc65 debugger. Since many of the functions
* used for the debugger are quite usable even in another context, they
* are declared here.
*
* To use the debugger, just call DbgStart in your application. This will
* clear the screen and startup the debugger with the program counter
* pointing to the next instruction after the call to DbgStart. Once DbgStart
* has been executed, the debugger will also catch any BRK opcode. Use the
* BREAK function declared below to insert additional breakpoints into your
* code.
*
* There are currently a lot of things that cannot be debugged, graphical
* applications are an example. The debugger does not save your screen
* contents, so even your text screen gets destroyed. However, you can
* debug the C and runtime library, even if the debugger is using this
* stuff itself.
*
* Note: When using the debugger, there are some other identifiers with
* external linkage, that start with Dbg. Avoid those names if you use the
* module.
*/
#ifndef _DBG_H
#define _DBG_H
/*****************************************************************************/
/* Utuility functions */
/*****************************************************************************/
unsigned __fastcall__ DbgDisAsm (unsigned Addr, char* Buf, unsigned char Len);
/* Disassemble one instruction at address addr into the given buffer.
* The resulting line has the format, "AAAA__BB_BB_BB___OPC_OPERAND",
* where AAAA is the hexadecimal representation of addr, BB are the
* bytes (in hex) that make the instruction, OPC is the mnemonic, and
* OPERAND is an operand for the instruction.
* The buffer is filled with spaces up to the given length and terminated as
* a usual C string. NOTE: Buf must be able to hold Len+1 characters.
* The function returns the length of the disassembled instruction, so,
* to disassemble the next instruction, add the return value to addr
* and call the function again.
*/
unsigned __fastcall__ DbgDisAsmLen (unsigned Addr);
/* Disassemble one instruction, but do only return the length, do not
* create a visible representation. This function is useful when
* disassembling backwards, it is much faster than DbgDisAsm.
*/
int __fastcall__ DbgIsRAM (unsigned Addr);
/* Return true if we can read and write the given address */
char* DbgMemDump (unsigned Addr, char* Buf, unsigned char Len);
/* Create a line of a memory dump in the given buffer. The buffer contains
* the starting address (4 digits hex), then Len bytes in this format:
* "AAAA__XX_YY_ZZ_...". The passed char buffer must hold Len*3+5 bytes
* plus a terminator byte.
* The function does not work correctly if the created string is longer
* than 255 bytes.
* The return value is Buf.
*/
/*****************************************************************************/
/* High level user interface */
/*****************************************************************************/
void __fastcall__ DbgInit (unsigned unused);
/* Initialize the debugger. Use 0 as parameter. The debugger will popup on
* next brk encountered.
*/
#define BREAK() __asm__ ("\tbrk")
/* Use this to insert breakpoints into your code */
/* End of dbg.h */
#endif

54
include/errno.h Normal file
View File

@@ -0,0 +1,54 @@
/*
* errno.h
*
* Ullrich von Bassewitz, 18.08.1998
*
*/
#ifndef _ERRNO_H
#define _ERRNO_H
/* Operating system specific error codes */
extern unsigned char _oserror;
/* Mapper function, don't call directly */
void _maperrno (void);
/* This one is called under the hood. User callable. */
int __fastcall__ _osmaperrno (unsigned char oserror);
/* System error codes go here */
extern int _errno;
/* errno must be a macro, here the mapper is called */
#define errno (_maperrno(), _errno)
/* Possible error codes */
#define ENOENT 1 /* No such file or directory */
#define ENOMEM 2 /* Out of memory */
#define EACCES 3 /* Permission denied */
#define ENODEV 4 /* No such device */
#define EMFILE 5 /* Too many open files */
#define EBUSY 6 /* Device or resource busy */
#define EINVAL 7 /* Invalid argument */
#define ENOSPC 8 /* No space left on device */
#define EEXIST 9 /* File exists */
#define EAGAIN 10 /* Try again */
#define EIO 11 /* I/O error */
#define EINTR 12 /* Interrupted system call */
#define ENOSYS 13 /* Function not implemented */
#define ESPIPE 14 /* Illegal seek */
#define EUNKNOWN 15 /* Unknown OS specific error */
#endif

39
include/fcntl.h Normal file
View File

@@ -0,0 +1,39 @@
/*
* fcntl.h
*
* Ullrich von Bassewitz, 30.05.1998
*
*/
#ifndef _FCNTL_H
#define _FCNTL_H
/* Flag values for the open() call */
#define O_RDONLY 0x01
#define O_WRONLY 0x02
#define O_RDWR 0x03
#define O_CREAT 0x10
#define O_TRUNC 0x20
#define O_APPEND 0x40
/* Functions */
int open (const char* name, int flags, ...); /* May take a mode argument */
int close (int fd);
int write (int fd, const void* buf, unsigned count);
int read (int fd, void* buf, unsigned count);
int mkdir (const char* name, ...); /* May take a mode argument */
int rmdir (const char* name);
/* End of fcntl.h */
#endif

69
include/geos.h Normal file
View File

@@ -0,0 +1,69 @@
/*
Supreme GEOS header file
includes all other headers
Maciej 'YTM/Alliance' Witkowiak, 27.10.1999
*/
#ifndef _GEOS_H
#define _GEOS_H
#ifndef _GCONST_H
#include <geos/gconst.h>
#endif
#ifndef _GSTRUCT_H
#include <geos/gstruct.h>
#endif
#ifndef _GSYM_H
#include <geos/gsym.h>
#endif
#ifndef _GDISK_H
#include <geos/gdisk.h>
#endif
#ifndef _GFILE_H
#include <geos/gfile.h>
#endif
#ifndef _GPROCESS_H
#include <geos/gprocess.h>
#endif
#ifndef _GGRAPH_H
#include <geos/ggraph.h>
#endif
#ifndef _GMENU_H
#include <geos/gmenu.h>
#endif
#ifndef _GSPRITE_H
#include <geos/gsprite.h>
#endif
#ifndef _GMEMORY_H
#include <geos/gmemory.h>
#endif
#ifndef _GSYS_H
#include <geos/gsys.h>
#endif
#ifndef _GDLGBOX_H
#include <geos/gdlgbox.h>
#endif
/* End of geos.h */
#endif

63
include/geos/gconst.h Normal file
View File

@@ -0,0 +1,63 @@
/*
GEOS constants, 4-2-99, 18-3-99
small C version: 25-27.10.99
reassembled by Maciej 'YTM/Alliance' Witkowiak
*/
/* Here are constants which didn't fit into any other cathegory... */
#ifndef _GCONST_H
#define _GCONST_H
#define NULL 0
#define FALSE NULL
#define TRUE 0xff
#define MOUSE_SPRNUM 0
#define DISK_DRV_LGH 0x0d80
/* drivetypes */
#define DRV_NULL 0
#define DRV_1541 1
#define DRV_1571 2
#define DRV_1581 3
#define DRV_NETWORK 15
/* various disk constants */
#define REL_FILE_NUM 9
#define CMND_FILE_NUM 15
#define MAX_CMND_STR 32
#define DIR_1581_TRACK 40
#define DIR_ACC_CHAN 13
#define DIR_TRACK 18
#define N_TRACKS 35
#define DK_NM_ID_LEN 18
#define TRACK 9
#define SECTOR 12
#define TOTAL_BLOCKS 664
/* offset to something */
#define OFF_INDEX_PTR 1
/* values for MMU config - C128 */
#define CIOIN 0x7E
#define CRAM64K 0x7F
#define CKRNLBASIOIN 0x40
#define CKRNLIOIN 0x4E
/* alarmSetFlag */
#define ALARMMASK 4
#define CLR_SAVE 0x40
#define CONSTRAINED 0x40
#define UN_CONSTRAINED 0
#define FG_SAVE 0x80
#define FUTURE1 7
#define FUTURE2 8
#define FUTURE3 9
#define FUTURE4 10
#define USELAST 127
#define SHORTCUT 128
#endif

81
include/geos/gdisk.h Normal file
View File

@@ -0,0 +1,81 @@
/*
GEOS functions from disk driver
ported to small C on 21.12.1999
by Maciej 'YTM/Alliance' Witkowiak
*/
#ifndef _GDISK_H
#define _GDISK_H
#ifndef _GSTRUCT_H
#include <geos/gstruct.h>
#endif
char __fastcall__ ReadBuff(struct tr_se *myTrSe);
char __fastcall__ WriteBuff(struct tr_se *myTrSe);
char __fastcall__ GetBlock(struct tr_se *myTrSe, char *buffer);
char __fastcall__ PutBlock(struct tr_se *myTrSe, char *buffer);
char __fastcall__ ReadBlock(struct tr_se *myTrSe, char *buffer);
char __fastcall__ WriteBlock(struct tr_se *myTrSe, char *buffer);
char __fastcall__ VerWriteBlock(struct tr_se *myTrSe, char *buffer);
int __fastcall__ CalcBlksFree(void);
char __fastcall__ ChkDkGEOS(void);
char __fastcall__ SetGEOSDisk(void);
char __fastcall__ NewDisk(void);
char __fastcall__ OpenDisk(void);
char __fastcall__ FindBAMBit(struct tr_se *myTrSe);
char __fastcall__ BlkAlloc(struct tr_se output[], int length);
char __fastcall__ NxtBlkAlloc(struct tr_se *startTrSe,
struct tr_se output[], int length);
char __fastcall__ FreeBlock(struct tr_se *myTrSe);
struct tr_se __fastcall__ SetNextFree(struct tr_se *myTrSe);
// above needs (int) casts on both sides of '='
char __fastcall__ GetDirHead(void);
char __fastcall__ PutDirHead(void);
void __fastcall__ GetPtrCurDkNm(char *name);
void __fastcall__ EnterTurbo(void);
void __fastcall__ ExitTurbo(void);
void __fastcall__ PurgeTurbo(void);
char __fastcall__ ChangeDiskDevice(char newdev);
/* disk header offsets */
#define OFF_TO_BAM 4
#define OFF_DISK_NAME 144
#define OFF_GS_DTYPE 189
#define OFF_OP_TR_SC 171
#define OFF_GS_ID 173
/* disk errors */
#define ANY_FAULT 0xf0
#define NO_BLOCKS 1
#define INV_TRACK 2
#define INSUFF_SPACE 3
#define FULL_DIRECTORY 4
#define FILE_NOT_FOUND 5
#define BAD_BAM 6
#define UNOPENED_VLIR 7
#define INV_RECORD 8
#define OUT_OF_RECORDS 9
#define STRUCT_MISMAT 10
#define BFR_OVERFLOW 11
#define CANCEL_ERR 12
#define DEV_NOT_FOUND 13
#define INCOMPATIBLE 14
#define HDR_NOT_THERE 0x20
#define NO_SYNC 0x21
#define DBLK_NOT_THERE 0x22
#define DAT_CHKSUM_ERR 0x23
#define WR_VER_ERR 0x25
#define WR_PR_ON 0x26
#define HDR_CHKSUM_ERR 0x27
#define DSK_ID_MISMAT 0x29
#define BYTE_DEC_ERR 0x2e
#define DOS_MISMATCH 0x73
#endif

102
include/geos/gdlgbox.h Normal file
View File

@@ -0,0 +1,102 @@
/*
GEOS dialog box functions
ported to small C on 26.12.1999
by Maciej 'YTM/Alliance' Witkowiak
10.03.2000 - update
*/
#ifndef _GDLGBOX_H
#define _GDLGBOX_H
char __fastcall__ DoDlgBox(char *dboxstring);
char __fastcall__ RstrFrmDialogue(void);
/* These are custom, predefined dialog boxes, I'm sure you'll find them usable
Most of them show 2 lines of text */
char __fastcall__ DlgBoxYesNo(char *line1, char *line2);
char __fastcall__ DlgBoxOkCancel(char *line1, char *line2);
void __fastcall__ DlgBoxOk(char *line1, char *line2);
char __fastcall__ DlgBoxGetString(char *myString, char strLength,
char *line1, char *line2);
char __fastcall__ DlgBoxFileSelect(char *classtxt, char ftype,
char *fname);
/* Now the command string type */
typedef void dlgBoxStr;
/* and command string commands - macros */
#define DB_DEFPOS(pattern) (char)(DEF_DB_POS | (pattern))
#define DB_SETPOS(pattern,top,bot,left,right) \
(char)(SET_DB_POS | (pattern)), (char)(top), (char)(bot), \
(unsigned)(left), (unsigned)(right)
#define DB_ICON(i,x,y) (char)(i), (char)(x), (char)(y)
#define DB_TXTSTR(x,y,text) (char)DBTXTSTR, (char)(x), (char)(y), (text)
#define DB_VARSTR(x,y,ptr) (char)DBVARSTR, (char)(x), (char)(y), (char)(ptr)
#define DB_GETSTR(x,y,ptr,length) (char)DBGETSTRING, (char)(x), (char)(y), (char)(ptr), (char)(length)
#define DB_SYSOPV(ptr) (char)DBSYSOPV, (unsigned)(ptr)
#define DB_GRPHSTR(ptr) (char)DBGRPHSTR, (unsigned)(ptr)
#define DB_GETFILES(x,y) (char)DBGETFILES, (char)(x), (char)(y)
#define DB_OPVEC(ptr) (char)DBOPVEC, (unsigned)(ptr)
#define DB_USRICON(x,y,ptr) (char)DBUSRICON, (char)(x), (char)(y), (unsigned)(ptr)
#define DB_USRROUT(ptr) (char)DB_USR_ROUT, (unsigned)(ptr)
#define DB_END (char)NULL
/*
part of constants below is used internally, but some are useful for macros above
*/
/* icons for DB_ICON */
#define OK 1
#define CANCEL 2
#define YES 3
#define NO 4
#define OPEN 5
#define DISK 6
/* commands - internally used by command macros */
#define DBTXTSTR 11
#define DBVARSTR 12
#define DBGETSTRING 13
#define DBSYSOPV 14
#define DBGRPHSTR 15
#define DBGETFILES 16
#define DBOPVEC 17
#define DBUSRICON 18
#define DB_USR_ROUT 19
/* icons tabulation in standard window */
#define DBI_X_0 1
#define DBI_X_1 9
#define DBI_X_2 17
#define DBI_Y_0 8
#define DBI_Y_1 40
#define DBI_Y_2 72
/* standard window size defaults */
#define SET_DB_POS 0
#define DEF_DB_POS 0x80
#define DEF_DB_TOP 32
#define DEF_DB_BOT 127
#define DEF_DB_LEFT 64
#define DEF_DB_RIGHT 255
/* text tabulation in standard window */
#define TXT_LN_1_Y 16
#define TXT_LN_2_Y 32
#define TXT_LN_3_Y 48
#define TXT_LN_4_Y 64
#define TXT_LN_5_Y 80
#define TXT_LN_X 16
/* system icons size */
#define SYSDBI_HEIGHT 16
#define SYSDBI_WIDTH 6
/* dialogbox string offsets */
#define OFF_DB_FORM 0
#define OFF_DB_TOP 1
#define OFF_DB_BOT 2
#define OFF_DB_LEFT 3
#define OFF_DB_RIGHT 5
#define OFF_DB_1STCMD 7
#endif

101
include/geos/gfile.h Normal file
View File

@@ -0,0 +1,101 @@
/*
GEOS filesystem functions
ported to small C on 25.12.1999
by Maciej 'YTM/Alliance' Witkowiak
*/
#ifndef _GFILE_H
#define _GFILE_H
#ifndef _GSTRUCT_H
#include <geos/gstruct.h>
#endif
struct filehandle *__fastcall__ Get1stDirEntry(void);
struct filehandle *__fastcall__ GetNxtDirEntry(void);
char __fastcall__ FindFTypes(char *buffer, char ftype, char fmaxnum, char *classtxt);
char __fastcall__ FindFile(char *fname);
char __fastcall__ ReadFile(struct tr_se *myTrSe, char *buffer, int flength);
char __fastcall__ SaveFile(struct fileheader *myHeader);
char __fastcall__ FreeFile(struct tr_se myTable[]);
char __fastcall__ DeleteFile(char *fname);
char __fastcall__ RenameFile(char *source, char *target);
char __fastcall__ ReadByte(void);
char __fastcall__ FollowChain(struct tr_se *startTrSe, char *buffer);
char __fastcall__ GetFHdrInfo(struct filehandle *myFile);
char __fastcall__ OpenRecordFile(char *fname);
char __fastcall__ CloseRecordFile(void);
char __fastcall__ NextRecord(void);
char __fastcall__ PreviousRecord(void);
char __fastcall__ PointRecord(char);
char __fastcall__ DeleteRecord(void);
char __fastcall__ InsertRecord(void);
char __fastcall__ AppendRecord(void);
char __fastcall__ ReadRecord(char *buffer, int flength);
char __fastcall__ WriteRecord(char *buffer, int flength);
char __fastcall__ UpdateRecordFile(void);
/* GEOS filetypes */
#define NOT_GEOS 0
#define BASIC 1
#define ASSEMBLY 2
#define DATA 3
#define SYSTEM 4
#define DESK_ACC 5
#define APPLICATION 6
#define APPL_DATA 7
#define FONT 8
#define PRINTER 9
#define INPUT_DEVICE 10
#define DISK_DEVICE 11
#define SYSTEM_BOOT 12
#define TEMPORARY 13
#define AUTO_EXEC 14
#define INPUT_128 15
#define NUMFILETYPES 16
/* supported structures */
#define SEQUENTIAL 0
#define VLIR 1
/* DOS filetypes */
#define DEL 0
#define SEQ 1
#define PRG 2
#define USR 3
#define REL 4
#define CBM 5
/* directory offsets */
/* offsets in dir entry */
#define FRST_FILE_ENTRY 2
#define OFF_CFILE_TYPE 0
#define OFF_DE_TR_SC 1
#define OFF_FNAME 3
#define OFF_GHDR_PTR 19
#define OFF_GSTRUC_TYPE 21
#define OFF_GFILE_TYPE 22
#define OFF_YEAR 23
#define OFF_SIZE 28
#define OFF_NXT_FILE 32
/* offsets in file header */
#define O_GHIC_WIDTH 2
#define O_GHIC_HEIGHT 3
#define O_GHIC_PIC 4
#define O_GHCMDR_TYPE 68
#define O_GHGEOS_TYPE 69
#define O_GHSTR_TYPE 70
#define O_GHST_ADDR 71
#define O_GHEND_ADDR 73
#define O_GHST_VEC 75
#define O_GHFNAME 77
#define O_128_FLAGS 96
#define O_GH_AUTHOR 97
#define O_GHP_DISK 97
#define O_GHP_FNAME 117
#define O_GHINFO_TXT 0xa0
#endif

170
include/geos/ggraph.h Normal file
View File

@@ -0,0 +1,170 @@
/*
GEOS graphic (non icon/menu/sprite) functions
ported to small C on 29.10.1999
by Maciej 'YTM/Alliance' Witkowiak
10,11.03.2000 - updates
*/
#ifndef _GGRAPH_H
#define _GGRAPH_H
#ifndef _GSTRUCT_H
#include <geos/gstruct.h>
#endif
void __fastcall__ SetPattern(char newpattern);
void __fastcall__ HorizontalLine(char pattern, char y, int xstart, int xend);
void __fastcall__ InvertLine(char y, int xstart, int xend);
void __fastcall__ RecoverLine(char y, int xstart, int xend);
void __fastcall__ VerticalLine(char pattern, char ystart, char yend, int x);
void __fastcall__ InitDrawWindow(struct window *myRectangle);
void __fastcall__ Rectangle(void);
void __fastcall__ FrameRectangle(char pattern);
void __fastcall__ InvertRectangle(void);
void __fastcall__ ImprintRectangle(void);
void __fastcall__ RecoverRectangle(void);
void __fastcall__ DrawLine(struct window *topBotCoords);
void __fastcall__ DrawPoint(struct pixel *myPixel);
char __fastcall__ TestPoint(struct pixel *myPixel);
void __fastcall__ PutChar(char character, char y, int x);
void __fastcall__ PutString(char *myString, char y, int x);
void __fastcall__ PutDecimal(char style, int value, char y, int x);
char __fastcall__ GetCharWidth(char character);
void __fastcall__ LoadCharSet(struct fontdesc *myFont);
void __fastcall__ UseSystemFont(void);
void __fastcall__ BitmapUp(struct iconpic *myIcon);
void __fastcall__ BitmapClip(char skipl, char skipr, int skiptop,
struct iconpic *myIcon);
void __fastcall__ BitOtherClip(void *proc1, void *proc2, char skipl,
char skipr, int skiptop,
struct iconpic *myIcon);
void __fastcall__ GraphicsString(char *myGfxString);
/* VIC colour constants */
#define BLACK 0
#define WHITE 1
#define RED 2
#define CYAN 3
#define PURPLE 4
#define GREEN 5
#define BLUE 6
#define YELLOW 7
#define ORANGE 8
#define BROWN 9
#define LTRED 10
#define DKGREY 11
#define GREY 12
#define MEDGREY 12
#define LTGREEN 13
#define LTBLUE 14
#define LTGREY 15
/* VIC memory banks */
#define GRBANK0 3
#define GRBANK1 2
#define GRBANK2 1
#define GRBANK3 0
/* VIC screen sizes */
#define VIC_X_POS_OFF 24
#define VIC_Y_POS_OFF 50
#define SC_BYTE_WIDTH 40
#define SC_PIX_HEIGHT 200
#define SC_PIX_WIDTH 320
#define SC_SIZE 8000
/* VDC screen constants */
#define SCREENBYTEWIDTH 80
#define SCREENPIXELWIDTH 640
/* control characters for use as numbers, not chars */
#define EOF 0
#define BACKSPACE 8
#define FORWARDSPACE 9
#define TAB 9
#define LF 10
#define HOME 11
#define PAGE_BREAK 12
#define UPLINE 12
#define CR 13
#define ULINEON 14
#define ULINEOFF 15
#define ESC_GRAPHICS 16
#define ESC_RULER 17
#define REV_ON 18
#define REV_OFF 19
#define GOTOX 20
#define GOTOY 21
#define GOTOXY 22
#define NEWCARDSET 23
#define BOLDON 24
#define ITALICON 25
#define OUTLINEON 26
#define PLAINTEXT 27
/* control characters for use in
strings: eg: str[10]=BOLD "Hello"; */
#define CCR "\015"
#define CULINEON "\016"
#define CULINEOFF "\017"
#define CREV_ON "\022"
#define CREV_OFF "\023"
#define CBOLDON "\030"
#define CITALICON "\031"
#define COUTLINEON "\032"
#define CPLAINTEXT "\033"
/*values of currentMode */
/* bitNumbers */
#define UNDERLINE_BIT 7
#define BOLD_BIT 6
#define REVERSE_BIT 5
#define ITALIC_BIT 4
#define OUTLINE_BIT 3
#define SUPERSCRIPT_BIT 2
#define SUBSCRIPT_BIT 1
/* bitMasks */
#define SET_UNDERLINE 0x80
#define SET_BOLD 0x40
#define SET_REVERSE 0x20
#define SET_ITALIC 0x10
#define SET_OUTLINE 0x08
#define SET_SUPERSCRIPT 0x04
#define SET_SUBSCRIPT 0x02
#define SET_PLAINTEXT 0
/* values of dispBufferOn */
#define ST_WRGS_FORE 0x20
#define ST_WR_BACK 0x40
#define ST_WR_FORE 0x80
/* PutDecimal parameters */
/* leading 0s? */
#define SET_NOSURPRESS 0
#define SET_SURPRESS 0x40
/* justification */
#define SET_RIGHTJUST 0
#define SET_LEFTJUST 0x80
/* C128 x flags */
#define ADD1_W 0x2000
#define DOUBLE_B 0x80
#define DOUBLE_W 0x8000
typedef void graphicStr;
#define MOVEPENTO(x,y) (char)1, (unsigned)(x), (char)(y)
#define LINETO(x,y) (char)2, (unsigned)(x), (char)(y)
#define RECTANGLETO(x,y) (char)3, (unsigned)(x), (char)(y)
#define NEWPATTERN(p) (char)5, (char)(p)
#define FRAME_RECTO(x,y) (char)7, (unsigned)(x), (char)(y)
#define PEN_X_DELTA(x) (char)8, (unsigned)(x)
#define PEN_Y_DELTA(y) (char)9, (char)(y)
#define PEN_XY_DELTA(x,y) (char)10, (unsigned)(x), (char)(y)
#define GSTR_END (char)NULL
/* ESC_PUTSTRING can't be implemented - it needs text, not pointer to it
#define ESC_PUTSTRING(x,y,text) (char)6, (unsigned)(x), (char)(y), (text), (char)NULL
*/
#endif

33
include/geos/gmemory.h Normal file
View File

@@ -0,0 +1,33 @@
/*
GEOS memory and string functions
ported to small C on 27.10.1999
by Maciej 'YTM/Alliance' Witkowiak
*/
#ifndef _GMEMORY_H
#define _GMEMORY_H
#ifndef _GSTRUCT_H
#include <geos/gstruct.h>
#endif
void __fastcall__ CopyString(char *dest, char *source);
void __fastcall__ CmpString(char *dest, char *source);
void __fastcall__ CopyFString(char len, char *dest, char *source);
void __fastcall__ CmpFString(char len, char *dest, char *source);
int __fastcall__ CRC(char *buffer, int len);
void __fastcall__ ClearRam(char *dest, int len);
void __fastcall__ FillRam(char what, char *dest, int len);
void __fastcall__ MoveData(char *source, char *dest, int len);
void __fastcall__ InitRam(char *myInitTab);
void __fastcall__ StashRAM(char REUBank, int len, char *reuaddy, char *cpuaddy);
void __fastcall__ FetchRAM(char REUBank, int len, char *reuaddy, char *cpuaddy);
void __fastcall__ SwapRAM(char REUBank, int len, char *reuaddy, char *cpuaddy);
char __fastcall__ VerifyRAM(char REUBank, int len, char *reuaddy, char *cpuaddy);
#endif

56
include/geos/gmenu.h Normal file
View File

@@ -0,0 +1,56 @@
/*
GEOS menu and icon functions
ported to small C on 27.10.1999
by Maciej 'YTM/Alliance' Witkowiak
*/
#ifndef _GMENU_H
#define _GMENU_H
#ifndef _GSTRUCT_H
#include <geos/gstruct.h>
#endif
void __fastcall__ DoMenu(struct menu *myMenu);
void __fastcall__ ReDoMenu(void);
void __fastcall__ RecoverMenu(void);
void __fastcall__ RecoverAllMenus(void);
void __fastcall__ DoPreviousMenu(void);
void __fastcall__ GotoFirstMenu(void);
void __fastcall__ DoIcons(struct icontab *myIconTab);
/* DoMenu - menutypes */
#define MENU_ACTION 0x00
#define DYN_SUB_MENU 0x40
#define SUB_MENU 0x80
#define HORIZONTAL 0x00
#define VERTICAL 0x80
/* menu string offsets */
#define OFF_MY_TOP 0
#define OFF_MY_BOT 1
#define OFF_MX_LEFT 2
#define OFF_MX_RIGHT 4
#define OFF_NUM_M_ITEMS 6
#define OFF_1ST_M_ITEM 7
/* icon string offsets */
#define OFF_NM_ICNS 0
#define OFF_IC_XMOUSE 1
#define OFF_IC_YMOUSE 3
#define OFF_PIC_ICON 0
#define OFF_X_ICON_POS 2
#define OFF_Y_ICON_POS 3
#define OFF_WDTH_ICON 4
#define OFF_HEIGHT_ICON 5
#define OFF_SRV_RT_ICON 6
#define OFF_NX_ICON 8
/* icons, menus status flags */
#define ST_FLASH 0x80
#define ST_INVERT 0x40
#define ST_LD_AT_ADDR 0x01
#define ST_LD_DATA 0x80
#define ST_PR_DATA 0x40
#define ST_WR_PR 0x40
#endif

41
include/geos/gprocess.h Normal file
View File

@@ -0,0 +1,41 @@
/*
GEOS processes (~multitasking) functions
ported to small C on 27.10.1999
by Maciej 'YTM/Alliance' Witkowiak
*/
#ifndef _GPROCESS_H
#define _GPROCESS_H
#ifndef _GSTRUCT_H
#include <geos/gstruct.h>
#endif
void __fastcall__ InitProcesses(char number, struct process *proctab);
void __fastcall__ RestartProcess(char number);
void __fastcall__ EnableProcess(char number);
void __fastcall__ BlockProcess(char number);
void __fastcall__ UnBlockProcess(char number);
void __fastcall__ FreezeProcess(char number);
void __fastcall__ UnFreezeProcess(char number);
void __fastcall__ Sleep(int jiffies);
/* Process control variable
these probably should be removed from here, as they are
internal GEOS information which is updated by functions above
*/
/* bit numbers */
#define RUNABLE_BIT 7
#define BLOCKED_BIT 6
#define FROZEN_BIT 5
#define NOTIMER_BIT 4
/* bit masks */
#define SET_RUNABLE 0x80
#define SET_BLOCKED 0x40
#define SET_FROZEN 0x20
#define SET_NOTIMER 0x10
#endif

90
include/geos/gsprite.h Normal file
View File

@@ -0,0 +1,90 @@
/*
GEOS mouse and sprite functions
ported to small C on 27.10.1999
by Maciej 'YTM/Alliance' Witkowiak
*/
#ifndef _GSPRITE_H
#define _GSPRITE_H
void __fastcall__ StartMouseMode(void);
void __fastcall__ ClearMouseMode(void);
void __fastcall__ MouseUp(void);
void __fastcall__ MouseOff(void);
char __fastcall__ IsMseInRegion(struct window *region);
void __fastcall__ DrawSprite(char spritenum, char *spritepic);
void __fastcall__ PosSprite(char spritenum, struct pixel *position);
void __fastcall__ EnablSprite(char spritenum);
void __fastcall__ DisablSprite(char spritenum);
void __fastcall__ InitTextPrompt(char height);
void __fastcall__ PromptOn(struct pixel *position);
void __fastcall__ PromptOff(void);
char __fastcall__ GetNextChar(void);
/* keyboard constants */
#define KEY_F1 1
#define KEY_F2 2
#define KEY_F3 3
#define KEY_F4 4
#define KEY_F5 5
#define KEY_F6 6
#define KEY_NOSCRL 7
#define KEY_ENTER 11
#define KEY_F7 14
#define KEY_F8 15
#define KEY_UP 16
#define KEY_DOWN 17
#define KEY_HOME 18
#define KEY_CLEAR 19
#define KEY_LARROW 20
#define KEY_UPARROR 21
#define KEY_STOP 22
#define KEY_RUN 23
#define KEY_BPS 24
#define KEY_HELP 25
#define KEY_ALT 26
#define KEY_ESC 27
#define KEY_INSERT 28
#define KEY_DELETE 29
#define KEY_RIGHT 30
#define KEY_INVALID 31
#define KEY_LEFT BACKSPACE
/* values of faultData - pointer position vs. mouseWindow */
/* bit numbers */
#define OFFTOP_BIT 7
#define OFFBOTTOM_BIT 6
#define OFFLEFT_BIT 5
#define OFFRIGHT_BIT 4
#define OFFMENU_BIT 3
/* bit masks */
#define SET_OFFTOP 0x80
#define SET_OFFBOTTOM 0x40
#define SET_OFFLEFT 0x20
#define SET_OFFRIGHT 0x10
#define SET_OFFMENU 0x08
/* mouseOn */
/* bit numbers */
#define MOUSEON_BIT 7
#define MENUON_BIT 6
#define ICONSON_BIT 5
/* bit masks */
#define SET_MSE_ON 0x80
#define SET_MENUON 0x40
#define SET_ICONSON 0x20
/* pressFlag */
/* bit numbers */
#define KEYPRESS_BIT 7
#define INPUT_BIT 6
#define MOUSE_BIT 5
/* bit masks */
#define SET_KEYPRESS 0x80
#define SET_INPUTCHG 0x40
#define SET_MOUSE 0x20
#endif

136
include/geos/gstruct.h Normal file
View File

@@ -0,0 +1,136 @@
/*
GEOS structs
ported to small C on 25-27.10.1999
by Maciej 'YTM/Alliance' Witkowiak
*/
#ifndef _GSTRUCT_H
#define _GSTRUCT_H
struct f_date { /* date in filedesctiptor */
char f_year;
char f_month;
char f_day;
char f_hour;
char f_minute;
};
struct s_date { /* system date & time */
char s_year;
char s_month;
char s_day;
char s_hour;
char s_minutes;
char s_seconds;
};
struct tr_se { /* track and sector */
char track;
char sector;
};
struct fileheader { /* header block (like fileHeader) */
struct tr_se n_block;
char icon_desc[3];
char icon_pic[63];
char dostype;
char type;
char structure;
int load_address;
int end_address;
int exec_address;
char class_name[19];
char column_flag;
char author[64];
char note[95];
};
struct filehandle { /* filehandle in directory sectors */
char dostype; /* or in dirEntryBuf */
struct tr_se n_block;
char name[16];
struct tr_se header;
char structure;
char type;
struct f_date date;
int size;
};
struct pixel { /* describes point */
int x;
char y;
};
struct fontdesc { /* describes font */
char baseline;
char width;
char height;
char *index_tbl;
char *data_ptr;
};
struct window { /* describes screen region */
char top;
char bot;
int left;
int right;
};
struct VLIR_info { /* VLIR information */
char curRecord; /* currently only used in VLIR */
char usedRecords; /* as system info (curRecord is mainly of your interest */
char fileWritten;
int fileSize;
};
struct process { /* process info, declare table of that type */
int pointer; /* (like: struct process proctab[2]=... */
int jiffies; /* last entry HAVE TO BE {0,0} */
};
struct iconpic { /* icon/encoded bitmap description */
char *pic_ptr; /* ptr to a photo scrap (or encoded bitmap) */
char x; /* position in cards (*8 pixels) */
char y;
char width; /* in cards */
char heigth; /* in lines (pixels) */
};
struct icondef { /* icon definition for DoIcons */
char *pic_ptr; /* ptr to a photo scrap (or encoded bitmap) */
char x; /* position in cards (*8 pixels) */
char y;
char width; /* of icon (in cards) */
char heigth; /* of icon in lines (pixels) */
int proc_ptr; /* pointer to function handling that icon */
};
struct icontab {
char number; /* number of declared icons */
struct pixel mousepos; /* position of mouse after DoIcons */
struct icondef tab[]; /* table of size declared by icontab.number */
};
/* everything below is obsolete and kept for unknown reasons */
struct menuitem {
char *name;
char type;
int rest; /* may be ptr to function, or if submenu ptr to struct menu */
};
struct menu {
struct window size;
char number;
struct menuitem items[];
};
struct inittab { /* use struct inittab mytab[n] for initram */
int ptr; /* ptr to 1st byte */
char number; /* number of following bytes */
char values[]; /* warning - in table size of this is same for all! */
};
#endif

302
include/geos/gsym.h Normal file
View File

@@ -0,0 +1,302 @@
/*
GEOS constants reassembled 4-2-99
ported to small C 26.8.99, 25-26.10.99
Maciej 'YTM/Alliance' Witkowiak
ytm@friko.onet.pl
*/
#ifndef _GSYM_H
#define _GSYM_H
#ifndef _GSTRUCT_H
#include <geos/gstruct.h>
#endif
#define nameBuf char[17]
#define blockBuf char[256]
#define zpage *(char*)0x0000
#define CPU_DDR *(char*)0x00
#define CPU_DATA *(char*)0x01
#define r0 *(unsigned int*)0x02
#define r0L *(char*)0x02
#define r0H *(char*)0x03
#define r1 *(unsigned int*)0x04
#define r1L *(char*)0x04
#define r1H *(char*)0x05
#define drawWindow (*(struct window*)0x06)
#define r2 *(unsigned int*)0x06
#define r2L *(char*)0x06
#define r2H *(char*)0x07
#define r3 *(unsigned int*)0x08
#define r3L *(char*)0x08
#define r3H *(char*)0x09
#define r4 *(unsigned int*)0x0a
#define r4L *(char*)0x0a
#define r4H *(char*)0x0b
#define r5 *(unsigned int*)0x0c
#define r5L *(char*)0x0c
#define r5H *(char*)0x0d
#define r6 *(unsigned int*)0x0e
#define r6L *(char*)0x0e
#define r6H *(char*)0x0f
#define r7 *(unsigned int*)0x10
#define r7L *(char*)0x10
#define r7H *(char*)0x11
#define r8 *(unsigned int*)0x12
#define r8L *(char*)0x12
#define r8H *(char*)0x13
#define r9 *(unsigned int*)0x14
#define r9L *(char*)0x14
#define r9H *(char*)0x15
#define r10 *(unsigned int*)0x16
#define r10L *(char*)0x16
#define r10H *(char*)0x17
#define r11 *(unsigned int*)0x18
#define r11L *(char*)0x18
#define r11H *(char*)0x19
#define r12 *(unsigned int*)0x1a
#define r12L *(char*)0x1a
#define r12H *(char*)0x1b
#define r13 *(unsigned int*)0x1c
#define r13L *(char*)0x1c
#define r13H *(char*)0x1d
#define r14 *(unsigned int*)0x1e
#define r14L *(char*)0x1e
#define r14H *(char*)0x1f
#define r15 *(unsigned int*)0x20
#define r15L *(char*)0x20
#define r15H *(char*)0x21
/* WARNING - these are used by C as temporary registers! */
#define a0 *(unsigned int*)0xfb
#define a0L *(char*)0xfb
#define a0H *(char*)0xfc
#define a1 *(unsigned int*)0xfd
#define a1L *(char*)0xfd
#define a1H *(char*)0xfe
#define a2 *(unsigned int*)0x70
#define a2L *(char*)0x70
#define a2H *(char*)0x71
#define a3 *(unsigned int*)0x72
#define a3L *(char*)0x72
#define a3H *(char*)0x73
#define a4 *(unsigned int*)0x74
#define a4L *(char*)0x74
#define a4H *(char*)0x75
#define a5 *(unsigned int*)0x76
#define a5L *(char*)0x76
#define a5H *(char*)0x77
#define a6 *(unsigned int*)0x78
#define a6L *(char*)0x78
#define a6H *(char*)0x79
#define a7 *(unsigned int*)0x7a
#define a7L *(char*)0x7a
#define a7H *(char*)0x7b
#define a8 *(unsigned int*)0x7c
#define a8L *(char*)0x7c
#define a8H *(char*)0x7d
#define a9 *(unsigned int*)0x7e
#define a9L *(char*)0x7e
#define a9H *(char*)0x7f
#define curPattern *(unsigned int*)0x22
#define string *(unsigned int*)0x24
#define curFontDesc (*(struct fontdesc*)0x26)
#define currentMode *(char*)0x2e
#define dispBufferOn *(char*)0x2f
#define mouseOn *(char*)0x30
#define RAM_64K *(char*)0x30
#define msePicPtr *(unsigned int*)0x31
#define curWindow (*(struct window*)0x33)
/*#define IO_IN *(char*)0x35
#define KRNL_IO_IN *(char*)0x36
#define KRNL_BAS_IO_IN *(char*)0x37*/
#define pressFlag *(char*)0x39
#define mousePos (*(struct pixel*)0x3a)
#define returnAddress *(unsigned int*)0x3d
#define graphMode *(char*)0x3f
/*#define TURBO_DD00 *(char*)0x8e
#define TURBO_DD00_CPY *(char*)0x8f*/
#define STATUS *(char*)0x90
#define curDevice *(char*)0xba
/* Here's my own errno location, I hope this won't confilct with anything... */
#define errno *(char*)0x91
#define irqvec *(unsigned int*)0x0314
#define bkvec *(unsigned int*)0x0316
#define nmivec *(unsigned int*)0x0318
#define APP_RAM *(char*)0x0400
#define BACK_SCR_BASE *(char*)0x6000
#define PRINTBASE *(char*)0x7900
#define OS_VARS *(char*)0x8000
#define diskBlkBuf ((blockBuf)0x8000)
#define fileHeader (*(struct fileheader*)0x8100)
#define curDirHead ((blockBuf)0x8200)
#define fileTrScTab ((struct tr_se[128])0x8300)
#define dirEntryBuf (*(struct filehandle*)0x8400)
#define DrACurDkNm ((nameBuf)0x841e)
#define DrBCurDkNm ((nameBuf)0x8430)
#define dataFileName ((nameBuf)0x8442)
#define dataDiskName ((nameBuf)0x8453)
#define PrntFileName ((nameBuf)0x8465)
#define PrntDiskName ((nameBuf)0x8476)
#define curDrive *(char*)0x8489
#define diskOpenFlg *(char*)0x848a
#define isGEOS *(char*)0x848b
#define interleave *(char*)0x848c
#define NUMDRV *(char*)0x848d
#define driveType ((char[4])0x848e)
#define turboFlags ((char[4])0x8492)
#define VLIRInfo (*(struct VLIR_info*)0x8496)
#define appMain *(unsigned int*)0x849b
#define intTopVector *(unsigned int*)0x849d
#define intBotVector *(unsigned int*)0x849f
#define mouseVector *(unsigned int*)0x84a1
#define keyVector *(unsigned int*)0x84a3
#define inputVector *(unsigned int*)0x84a5
#define mouseFaultVec *(unsigned int*)0x84a7
#define otherPressVec *(unsigned int*)0x84a9
#define StringFaultVec *(unsigned int*)0x84ab
#define alarmTmtVector *(unsigned int*)0x84ad
#define BRKVector *(unsigned int*)0x84af
#define RecoverVector *(unsigned int*)0x84b1
#define selectionFlash *(char*)0x84b3
#define alphaFlag *(char*)0x84b4
#define iconSelFlg *(char*)0x84b5
#define faultData *(char*)0x84b6
#define menuNumber *(char*)0x84b7
#define mouseWindow (*(struct window*)0x84b8)
#define stringXY (*(struct pixel*)0x84be)
#define mousePicData *(char*)0x84c1
#define maxMouseSpeed *(char*)0x8501
#define minMouseSpeed *(char*)0x8502
#define mouseAccel *(char*)0x8503
#define keyData *(char*)0x8504
#define mouseData *(char*)0x8505
#define inputData *(char*)0x8506
#define mouseSpeed *(char*)0x8507
#define random *(char*)0x850a
#define saveFontTab (*(struct fontdesc*)0x850c)
#define dblClickCount *(char*)0x8515
#define system_date (*(struct s_date*)0x8516)
#define alarmSetFlag *(char*)0x851c
#define sysDBData *(char*)0x851d
#define screencolors *(char*)0x851e
#define dlgBoxRamBuf *(char*)0x851f
#define savedmoby2 *(char*)0x88bb
#define scr80polar *(char*)0x88bc
#define scr80colors *(char*)0x88bd
#define vdcClrMode *(char*)0x88be
#define driveData ((char[4])0x88bf)
#define ramExpSize *(char*)0x88c3
#define sysRAMFlg *(char*)0x88c4
#define firstBoot *(char*)0x88c5
#define curType *(char*)0x88c6
#define ramBase *(char*)0x88c7
/*Original:
#define inputDevName *(char*)0x88cb
#define memBase *(char*)0x88cf*/
#define inputDevName ((nameBuf)0x88cb)
#define DrCCurDkNm ((nameBuf)0x88dc)
#define DrDCurDkNm ((nameBuf)0x88ee)
#define dir2Head ((blockBuf)0x8900)
#define SPRITE_PICS *(char*)0x8a00
#define sprpic ((char[8][64])0x8a00)
#define COLOR_MATRIX ((char[1000])0x8c00)
#define objPointer ((char[8])0x8ff8)
#define DISK_BASE *(char*)0x9000
#define SCREEN_BASE *(char*)0xa000
#define OS_ROM *(char*)0xc000
#define OS_JUMPTAB *(char*)0xc100
#define RAMC_BASE *(char*)0xde00
#define RAMC_WINDOW *(char*)0xdf00
#define EXP_BASE *(char*)0xdf00
#define MOUSE_BASE_128 *(char*)0xfd00
#define MOUSE_JMP_128 *(char*)0xfd00
#define END_MOUSE_128 *(char*)0xfe80
#define MOUSE_BASE *(char*)0xfe80
#define MOUSE_JMP *(char*)0xfe80
#define config *(char*)0xff00
#define END_MOUSE *(char*)0xfffa
#define NMI_VECTOR *(unsigned int*)0xfffa
#define RESET_VECTOR *(unsigned int*)0xfffc
#define IRQ_VECTOR *(unsigned int*)0xfffe
#define vicbase *(char*)0xd000
#define sidbase *(char*)0xd400
#define mmu *(char*)0xd500
#define VDC *(char*)0xd600
#define ctab *(char*)0xd800
#define cia1base *(char*)0xdc00
#define cia2base *(char*)0xdd00
#define mob0xpos *(char*)0xd000
#define mob0ypos *(char*)0xd001
#define mob1xpos *(char*)0xd002
#define mob1ypos *(char*)0xd003
#define mob2xpos *(char*)0xd004
#define mob2ypos *(char*)0xd005
#define mob3xpos *(char*)0xd006
#define mob3ypos *(char*)0xd007
#define mob4xpos *(char*)0xd008
#define mob4ypos *(char*)0xd009
#define mob5xpos *(char*)0xd00a
#define mob5ypos *(char*)0xd00b
#define mob6xpos *(char*)0xd00c
#define mob6ypos *(char*)0xd00d
#define mob7xpos *(char*)0xd00e
#define mob7ypos *(char*)0xd00f
#define msbxpos *(char*)0xd010
#define grcntrl1 *(char*)0xd011
#define rasreg *(char*)0xd012
#define lpxpos *(char*)0xd013
#define lpypos *(char*)0xd014
#define mobenble *(char*)0xd015
#define grcntrl2 *(char*)0xd016
#define grmemptr *(char*)0xd018
#define grirq *(char*)0xd019
#define grirqen *(char*)0xd01a
#define moby2 *(char*)0xd017
#define mobprior *(char*)0xd01b
#define mobmcm *(char*)0xd01c
#define mobx2 *(char*)0xd01d
#define mobmobcol *(char*)0xd01e
#define mobbakcol *(char*)0xd01f
#define extclr *(char*)0xd020
#define bakclr0 *(char*)0xd021
#define bakclr1 *(char*)0xd022
#define bakclr2 *(char*)0xd023
#define bakclr3 *(char*)0xd024
#define mcmclr0 *(char*)0xd025
#define mcmclr1 *(char*)0xd026
#define mob0clr *(char*)0xd027
#define mob1clr *(char*)0xd028
#define mob2clr *(char*)0xd029
#define mob3clr *(char*)0xd02a
#define mob4clr *(char*)0xd02b
#define mob5clr *(char*)0xd02c
#define mob6clr *(char*)0xd02d
#define mob7clr *(char*)0xd02e
#define keyreg *(char*)0xd02f
#define clkreg *(char*)0xd030
#define vdcreg *(char*)0xd600
#define vdcdata *(char*)0xd601
#endif

26
include/geos/gsys.h Normal file
View File

@@ -0,0 +1,26 @@
/*
GEOS system functions
ported to small C on 27.10.1999
by Maciej 'YTM/Alliance' Witkowiak
*/
#ifndef _GSYS_H
#define _GSYS_H
void __fastcall__ FirstInit(void);
void __fastcall__ InitForIO(void);
void __fastcall__ DoneWithIO(void);
void __fastcall__ MainLoop(void);
void __fastcall__ EnterDeskTop(void);
void __fastcall__ ToBASIC(void);
void __fastcall__ Panic(void);
void __fastcall__ CallRoutine(void *myRoutine);
int __fastcall__ GetSerialNumber(void);
char __fastcall__ GetRandom(void);
void __fastcall__ SetDevice(char newdev);
#endif

34
include/iso646.h Normal file
View File

@@ -0,0 +1,34 @@
/*
* iso646.h
*
* Ullrich von Bassewitz, 11.12.1998
*
*/
#ifndef _ISO646_H
#define _ISO646_H
/* Operator tokens */
#define and &&
#define and_eq &=
#define bitand &
#define bitor |
#define compl ~
#define not !
#define not_eq !=
#define or ||
#define or_eq |=
#define xor ^
#define xor_eq ^=
/* End of iso646.h */
#endif

66
include/joystick.h Normal file
View File

@@ -0,0 +1,66 @@
/*
* joystick.h
*
* Ullrich von Bassewitz, 24.09.1998
*
* Read the joystick on systems that support it.
*
*/
#ifndef _JOYSTICK_H
#define _JOYSTICK_H
/* Define __JOYSTICK__ for systems that support a joystick */
#ifdef __C64__
# define __JOYSTICK__
#endif
#ifdef __C128__
# define __JOYSTICK__
#endif
#ifdef __PLUS4__
# define __JOYSTICK__
#endif
#ifdef __NES__
# define __JOYSTICK__
#endif
/* Argument for the function */
#define JOY_1 0
#define JOY_2 1
/* Result codes of the function. The actual code is a bitwise or
* of one or more of the following values.
*/
#ifdef __NES__
# define JOY_A 0x01
# define JOY_B 0x02
# define JOY_SELECT 0x04
# define JOY_START 0x08
# define JOY_UP 0x10
# define JOY_DOWN 0x20
# define JOY_LEFT 0x40
# define JOY_RIGHT 0x80
#else
# define JOY_UP 0x01
# define JOY_DOWN 0x02
# define JOY_LEFT 0x04
# define JOY_RIGHT 0x08
# define JOY_FIRE 0x10
#endif
unsigned __fastcall__ readjoy (unsigned char joy);
/* Read the joystick. The argument is one of JOY_1/JOY2 */
/* End of joystick.h */
#endif

46
include/limits.h Normal file
View File

@@ -0,0 +1,46 @@
/*
* limits.h
*
* Ullrich von Bassewitz, 04.06.1998
*
*/
#ifndef _LIMITS_H
#define _LIMITS_H
#define CHAR_BIT 8
#define SCHAR_MIN (-128)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
#define CHAR_MIN 0
#define CHAR_MAX 255
#define SHRT_MIN (-32768)
#define SHRT_MAX 32767
#define USHRT_MAX 65535U
#define INT_MIN (-32768)
#define INT_MAX 32767
#define UINT_MAX 65535U
#define LONG_MAX 2147483647L
#define LONG_MIN (-2147483648L)
#define ULONG_MAX 4294967295UL
/* End of limits.h */
#endif

61
include/locale.h Normal file
View File

@@ -0,0 +1,61 @@
/*
* locale.h
*
* Ullrich von Bassewitz, 11.12.1998
*
*/
#ifndef _LOCALE_H
#define _LOCALE_H
/* NULL pointer */
#ifdef NULL
# undef NULL
#endif
#define NULL 0
/* Locale information constants */
#define LC_ALL 0
#define LC_COLLATE 1
#define LC_CTYPE 2
#define LC_MONETARY 3
#define LC_NUMERIC 4
#define LC_TIME 5
/* Struct containing locale settings */
struct lconv {
char* currency_symbol;
char* decimal_point;
char* grouping;
char* int_curr_symbol;
char* mon_decimal_point;
char* mon_grouping;
char* mon_thousands_sep;
char* negative_sign;
char* positive_sign;
char* thousands_sep;
char frac_digits;
char int_frac_digits;
char n_cs_precedes;
char n_sep_by_space;
char n_sign_posn;
char p_cs_precedes;
char p_sep_by_space;
char p_sign_posn;
};
/* Function prototypes */
struct lconv* localeconv (void);
char* setlocale (int category, const char* locale);
/* End of locale.h */
#endif

88
include/mouse.h Normal file
View File

@@ -0,0 +1,88 @@
/*
* mouse.h
*
* Ullrich von Bassewitz, 24.04.1999
*/
#ifndef _MOUSE_H
#define _MOUSE_H
/* Define __MOUSE__ for systems that support a proportional mouse */
#ifdef __C64__
# define __MOUSE__
#endif
#ifdef __C128__
# define __MOUSE__
#endif
void __fastcall__ mouse_init (unsigned char port, unsigned char sprite);
/* Setup the mouse interrupt handler. If the sprite value is != zero, the
* mouse routines will manage the sprite with this number. That means, it
* is moved if the mouse is moved (provided that the mouse cursor is visible),
* and switch on and off in the show and hide functions.
* The port parameter gives the joystick port used for the mouse and is only
* needed to read the mouse button state.
* After calling this function, the mouse is invisble, the cursor is placed
* at 0/0 (upper left corner), and the bounding box is reset to cover the
* whole screen. Call mouse_show once to make the mouse cursor visible.
*/
void mouse_done (void);
/* Disable the mouse, remove the interrupt handler. This function MUST be
* called before terminating the program, otherwise odd things may happen.
* If in doubt, install an exit handler (using atexit) that calls this
* function.
*/
void mouse_hide (void);
/* Hide the mouse. This function doesn't do anything visible if no sprite is
* used. The function manages a counter and may be called more than once.
* For each call to mouse_hide there must be a call to mouse_show to make
* the mouse visible again.
*/
void mouse_show (void);
/* Show the mouse. This function doesn't do anything visible if no sprite is
* used. See mouse_hide for more information.
*/
void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
/* Set the bounding box for the mouse pointer movement. The mouse X and Y
* coordinates will never go outside the given box.
* NOTE: The function does *not* check if the mouse is currently inside the
* given margins. The proper way to use this function therefore is:
*
* - Hide the mouse
* - Set the bounding box
* - Place the mouse at the desired position
* - Show the mouse again.
*
* NOTE2: When setting the box to something that is larger than the actual
* screen, the positioning of the mouse cursor will fail. If such margins
* are really what you want, you have to use your own cursor routines.
*/
void __fastcall__ mouse_move (int x, int y);
/* Set the mouse cursor to the given position. If a mouse cursor is defined
* and currently visible, the mouse cursor is also moved.
* NOTE: This function does not check if the given position is valid and
* inside the bounding box.
*/
void mouse_info (void);
/* Hmmm...
*/
/* End of mouse.h */
#endif

24
include/pet.h Normal file
View File

@@ -0,0 +1,24 @@
/*
* pet.h
*
* Ullrich von Bassewitz, 26.11.1998
*/
#ifndef _PET_H
#define _PET_H
/* Color defines */
#define COLOR_BLACK 0x00
#define COLOR_WHITE 0x01
/* End of pet.h */
#endif

81
include/plus4.h Normal file
View File

@@ -0,0 +1,81 @@
/*
* plus4.h
*
* Ullrich von Bassewitz, 12.08.1998
*/
#ifndef _PLUS4_H
#define _PLUS4_H
/* Additional key defines */
#define CH_F1 133
#define CH_F2 137
#define CH_F3 134
#define CH_F4 138
#define CH_F5 135
#define CH_F6 139
#define CH_F7 136
#define CH_F8 140
/* Color attributes */
#define CATTR_LUMA0 0x00
#define CATTR_LUMA1 0x10
#define CATTR_LUMA2 0x20
#define CATTR_LUMA3 0x30
#define CATTR_LUMA4 0x40
#define CATTR_LUMA5 0x50
#define CATTR_LUMA6 0x60
#define CATTR_LUMA7 0x70
#define CATTR_BLINK 0x80
/* Base colors */
#define BCOLOR_BLACK 0x00
#define BCOLOR_WHITE 0x01
#define BCOLOR_RED 0x02
#define BCOLOR_CYAN 0x03
#define BCOLOR_VIOLET 0x04
#define BCOLOR_GREEN 0x05
#define BCOLOR_BLUE 0x06
#define BCOLOR_YELLOW 0x07
#define BCOLOR_ORANGE 0x08
#define BCOLOR_BROWN 0x09
#define BCOLOR_LEMON 0x0A /* What's that color? */
#define BCOLOR_LIGHTVIOLET 0x0B
#define BCOLOR_BLUEGREEN 0x0C
#define BCOLOR_LIGHTBLUE 0x0D
#define BCOLOR_DARKBLUE 0x0E
#define BCOLOR_LIGHTGREEN 0x0F
/* Now try to mix up a C64/C128 compatible palette */
#define COLOR_BLACK (BCOLOR_BLACK)
#define COLOR_WHITE (BCOLOR_WHITE | CATTR_LUMA7)
#define COLOR_RED (BCOLOR_RED | CATTR_LUMA4)
#define COLOR_CYAN (BCOLOR_CYAN | CATTR_LUMA7)
#define COLOR_VIOLET (BCOLOR_VIOLET | CATTR_LUMA7)
#define COLOR_GREEN (BCOLOR_GREEN | CATTR_LUMA7)
#define COLOR_BLUE (BCOLOR_BLUE | CATTR_LUMA7)
#define COLOR_YELLOW (BCOLOR_YELLOW | CATTR_LUMA7)
#define COLOR_ORANGE (BCOLOR_ORANGE | CATTR_LUMA7)
#define COLOR_BROWN (BCOLOR_BROWN | CATTR_LUMA7)
#define COLOR_LIGHTRED (BCOLOR_RED | CATTR_LUMA7)
#define COLOR_GRAY1 (BCOLOR_WHITE | CATTR_LUMA1)
#define COLOR_GRAY2 (BCOLOR_WHITE | CATTR_LUMA3)
#define COLOR_LIGHTGREEN (BCOLOR_LIGHTGREEN | CATTR_LUMA7)
#define COLOR_LIGHTBLUE (BCOLOR_LIGHTBLUE | CATTR_LUMA7)
#define COLOR_GRAY3 (BCOLOR_WHITE | CATTR_LUMA5)
/* End of plus4.h */
#endif

125
include/rs232.h Normal file
View File

@@ -0,0 +1,125 @@
/*
* rs232.h
*
* Ullrich von Bassewitz, 19.3.1999
*
* This module is based upon the public domain swiftlink module written by
* Craig Bruce. Thanks a lot!
*
*/
#ifndef _RS232_H
#define _RS232_h
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Baudrate settings */
#define RS_BAUD_50 0x00
#define RS_BAUD_110 0x01
#define RS_BAUD_134_5 0x02
#define RS_BAUD_300 0x03
#define RS_BAUD_600 0x04
#define RS_BAUD_1200 0x05
#define RS_BAUD_2400 0x06
#define RS_BAUD_4800 0x07
#define RS_BAUD_9600 0x08
#define RS_BAUD_19200 0x09
#define RS_BAUD_38400 0x0A
#define RS_BAUD_57600 0x0B
#define RS_BAUD_115200 0x0C
#define RS_BAUD_230400 0x0D
/* Stop bit settings */
#define RS_STOP_1 0x00
#define RS_STOP_2 0x80
/* Data bit settings */
#define RS_BITS_5 0x60
#define RS_BITS_6 0x40
#define RS_BITS_7 0x20
#define RS_BITS_8 0x00
/* Parity settings */
#define RS_PAR_NONE 0x00
#define RS_PAR_ODD 0x20
#define RS_PAR_EVEN 0x60
#define RS_PAR_MARK 0xA0
#define RS_PAR_SPACE 0xE0
/* Bit masks to mask out things from the status returned by rs232_status */
#define RS_STATUS_PE 0x01 /* Parity error */
#define RS_STATUS_FE 0x02 /* Framing error */
#define RS_STATUS_OVERRUN 0x04 /* Overrun error */
#define RS_STATUS_RDRF 0x08 /* Receiver data register full */
#define RS_STATUS_THRE 0x10 /* Transmit holding reg. empty */
#define RS_STATUS_DCD 0x20 /* NOT data carrier detect */
#define RS_STATUS_DSR 0x40 /* NOT data set ready */
#define RS_STATUS_IRQ 0x80 /* IRQ condition */
/* Error codes returned by all functions */
#define RS_ERR_OK 0x00 /* Not an error - relax */
#define RS_ERR_NOT_INITIALIZED 0x01 /* Module not initialized */
#define RS_ERR_BAUD_TOO_FAST 0x02 /* Cannot handle baud rate */
#define RS_ERR_BAUD_NOT_AVAIL 0x03 /* Baud rate not available */
#define RS_ERR_NO_DATA 0x04 /* Nothing to read */
#define RS_ERR_OVERFLOW 0x05 /* No room in send buffer */
/*****************************************************************************/
/* Code */
/*****************************************************************************/
unsigned char __fastcall__ rs232_init (char hacked);
/* Initialize the serial port, install the interrupt handler. The parameter
* must be true (non zero) for a hacked swiftlink and false (zero) otherwise.
*/
unsigned char __fastcall__ rs232_params (unsigned char params, unsigned char parity);
/* Set the port parameters. Use a combination of the #defined values above. */
unsigned char __fastcall__ rs232_done (void);
/* Close the port, deinstall the interrupt hander. You MUST call this function
* before terminating the program, otherwise the machine may crash later. If
* in doubt, install an exit handler using atexit(). The function will do
* nothing, if it was already called.
*/
unsigned char __fastcall__ rs232_get (char* b);
/* Get a character from the serial port. If no characters are available, the
* function will return RS_ERR_NO_DATA, so this is not a fatal error.
*/
unsigned char __fastcall__ rs232_put (char b);
/* Send a character via the serial port. There is a transmit buffer, but
* transmitting is not done via interrupt. The function returns
* RS_ERR_OVERFLOW if there is no space left in the transmit buffer.
*/
unsigned char __fastcall__ rs232_pause (void);
/* Assert flow control and disable interrupts. */
unsigned char __fastcall__ rs232_unpause (void);
/* Re-enable interrupts and release flow control */
unsigned char __fastcall__ rs232_status (unsigned char* status,
unsigned char* errors);
/* Return the serial port status. */
/* End of rs232.h */
#endif

29
include/setjmp.h Normal file
View File

@@ -0,0 +1,29 @@
/*
* setjmp.h
*
* Ullrich von Bassewitz, 06.06.1998
*
*/
#ifndef _SETJMP_H
#define _SETJMP_H
typedef char jmp_buf [5];
int __fastcall__ _setjmp (jmp_buf buf);
#define setjmp _setjmp /* ISO insists on a macro */
void __fastcall__ longjmp (jmp_buf buf, int retval);
/* End of stddef.h */
#endif

33
include/stdarg.h Normal file
View File

@@ -0,0 +1,33 @@
/*
* stdarg.h
*
* Ullrich von Bassewitz, 31.05.1998
*
*/
#ifndef _STDARG_H
#define _STDARG_H
typedef unsigned char* va_list;
#define va_start(ap, fix) ap = (va_list)&fix + *(((va_list)&fix)-1) - __fixargs__
#define va_arg(ap,type) ((type)*(ap -= ((sizeof (type) + 1) & ~1)))
#define va_end(ap)
/* This is only valid *before* the first call to va_arg. It will also work
* only for int sized parameters.
*/
#define va_fix(ap, offs) *(ap+(__fixargs__-2*offs))
/* End of stdarg.h */
#endif

34
include/stddef.h Normal file
View File

@@ -0,0 +1,34 @@
/*
* stddef.h
*
* Ullrich von Bassewitz, 06.06.1998
*
*/
#ifndef _STDDEF_H
#define _STDDEF_H
/* Standard data types */
typedef int ptrdiff_t;
typedef unsigned size_t;
/* NULL pointer */
#ifdef NULL
# undef NULL
#endif
#define NULL 0
/* offsetof macro */
#define offsetof(type, member) (size_t) (&((type*) 0)->member)
/* End of stddef.h */
#endif

101
include/stdio.h Normal file
View File

@@ -0,0 +1,101 @@
/*
* stdio.h
*
* Ullrich von Bassewitz, 30.05.1998
*
*/
#ifndef _STDIO_H
#define _STDIO_H
#ifndef _STDDEF_H
# include <stddef.h>
#endif
#ifndef _STDARG_H
# include <stdarg.h>
#endif
/* Types */
typedef struct _FILE FILE;
typedef unsigned long fpos_t;
/* Standard file descriptors */
extern FILE* stdin;
extern FILE* stdout;
extern FILE* stderr;
/* Standard defines */
#define _IOFBF 0
#define _IOLBF 1
#define _IONBF 2
#define BUFSIZ 256
#define EOF -1
#define FILENAME_MAX 16
#define FOPEN_MAX 8
#define L_tmpnam (FILENAME_MAX + 1)
#define SEEK_CUR 0
#define SEEK_END 1
#define SEEK_SET 2
#define TMP_MAX 256
/* Functions */
void __fastcall__ clearerr (FILE* f);
int fclose (FILE* f);
int __fastcall__ feof (FILE* f);
int __fastcall__ ferror (FILE* f);
int __fastcall__ fflush (FILE* f);
int fgetc (FILE* f);
char* fgets (char* buf, size_t size, FILE* f);
FILE* fopen (const char* name, const char* mode);
int fprintf (FILE* f, const char* format, ...);
int fputc (int c, FILE* f);
int fputs (const char* s, FILE* f);
size_t fread (void* buf, size_t size, size_t count, FILE* f);
FILE* freopen (const char* name, const char* mode, FILE* f);
size_t fwrite (const void* buf, size_t size, size_t count, FILE* f);
int getchar (void);
char* gets (char* s);
void perror (const char* s);
int printf (const char* format, ...);
int putchar (int c);
int puts (const char* s);
int remove (const char* name);
int rename (const char* old, const char* new);
int sprintf (char* buf, const char* format, ...);
int vfprintf (FILE* f, const char* format, va_list ap);
int vprintf (const char* format, va_list ap);
int vsprintf (char* buf, const char* format, va_list ap);
#ifndef __STRICT_ANSI__
FILE* fdopen (int fd, const char* mode); /* Unix */
int __fastcall__ fileno (FILE* f); /* Unix */
#endif
/* Masking macros for some functions */
#define getchar() fgetc (stdin) /* ANSI */
#define putchar(c) fputc (c, stdout) /* ANSI */
#define getc(f) fgetc (f) /* ANSI */
#define putc(c, f) fputc (c, f) /* ANSI */
/* Non-standard function like macros */
#ifndef __STRICT_ANSI__
#define flushall() /* Unix */
#define unlink(name) remove (name) /* Unix */
#endif
/* End of stdio.h */
#endif

68
include/stdlib.h Normal file
View File

@@ -0,0 +1,68 @@
/*
* stdlib.h
*
* Ullrich von Bassewitz, 02.06.1998
*
*/
#ifndef _STDLIB_H
#define _STDLIB_H
#include <stddef.h>
/* Standard exit codes */
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
/* Memory management */
void* malloc (size_t size);
void* calloc (size_t count, size_t size);
void* realloc (void* block, size_t size);
void free (void* block);
#ifndef __STRICT_ANSI__
void _hadd (void* mem, size_t size); /* Non-standard */
#endif
/* Random numbers */
#define RAND_MAX 0x7FFF
int rand (void);
void __fastcall__ srand (unsigned seed);
/* Other standard stuff */
void abort (void);
int __fastcall__ abs (int val);
long __fastcall__ labs (long val);
int __fastcall__ atoi (char* s);
long __fastcall__ atol (char* s);
int __fastcall__ atexit (void (*exitfunc) (void));
void* bsearch (const void* key, const void* base, size_t n,
size_t size, int (*cmp) (const void*, const void*));
void exit (int ret);
char* __fastcall__ getenv (const char* name);
void qsort (void* base, size_t count, size_t size,
int (*compare) (const void*, const void*));
/* Non-ANSI functions */
#ifndef __STRICT_ANSI__
void __fastcall__ _swap (void* p, void* q, size_t size);
char* __fastcall__ itoa (int val, char* buf, int radix);
char* __fastcall__ utoa (unsigned val, char* buf, int radix);
char* __fastcall__ ltoa (long val, char* buf, int radix);
char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);
#endif
/* End of stdlib.h */
#endif

58
include/string.h Normal file
View File

@@ -0,0 +1,58 @@
/*
* string.h
*
* Ullrich von Bassewitz, 04.06.1998
*
*/
#ifndef _STRING_H
#define _STRING_H
#include <stddef.h>
char* __fastcall__ strcat (char* dest, const char* src);
char* __fastcall__ strchr (const char* s, int c);
int __fastcall__ strcmp (const char* s1, const char* s2);
int __fastcall__ strcoll (const char* s1, const char* s2);
char* __fastcall__ strcpy (char* dest, const char* src);
size_t __fastcall__ strcspn (const char* s1, const char* s2);
char* __fastcall__ strerror (int errcode);
size_t __fastcall__ strlen (const char* s);
char* __fastcall__ strncat (char* s1, const char* s2, size_t count);
int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);
char* __fastcall__ strncpy (char* dest, const char* src, size_t count);
char* __fastcall__ strrchr (const char* s, int c);
size_t __fastcall__ strspn (const char* s1, const char* s2);
char* __fastcall__ strstr (const char* str, const char* substr);
char* strtok (char* s1, const char* s2);
size_t strxfrm (char* s1, const char* s2, size_t count);
void* __fastcall__ memchr (const void* mem, int c, size_t count);
int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);
void* __fastcall__ memcpy (void* dest, const void* src, size_t count);
void* __fastcall__ memmove (void* dest, const void* src, size_t count);
void* __fastcall__ memset (void* s, int c, size_t count);
/* Non standard: */
#ifndef __STRICT_ANSI__
char* strdup (const char* s); /* SYSV/BSD */
int __fastcall__ stricmp (const char* s1, const char* s2); /* DOS/Windows */
int __fastcall__ strcasecmp (const char* s1, const char* s2); /* Same for Unix */
char* __fastcall__ strlwr (char* s);
char* __fastcall__ strlower (char* s);
char* __fastcall__ strupr (char* s);
char* __fastcall__ strupper (char* s);
#endif
/* End of string.h */
#endif

58
include/time.h Normal file
View File

@@ -0,0 +1,58 @@
/*
* time.h
*
* Ullrich von Bassewitz, 17.06.1998
*
*/
#ifndef _TIME_H
#define _TIME_H
#include <stddef.h>
typedef unsigned long time_t;
typedef unsigned long clock_t;
/* Structure for broken down time */
struct tm {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};
/* The 610 gets its clock from the AC current */
#ifdef __CBM__
# ifdef __CBM610__
# define CLK_TCK 50 /* POSIX */
# define CLOCKS_PER_TICK 50 /* ANSI */
# else
# define CLK_TCK 60 /* POSIX */
# define CLOCKS_PER_TICK 60 /* ANSI */
# endif
#endif
/* Function prototypes */
clock_t clock (void);
/* End of time.h */
#endif