1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
mrdudz 2022-04-19 14:49:51 +02:00
commit e2ad9efe41
580 changed files with 6366 additions and 2610 deletions

13
.github/checks/Makefile vendored Normal file
View File

@ -0,0 +1,13 @@
.PHONY: check tabs lastline spaces
check: tabs lastline spaces
tabs: tabs.sh
@./tabs.sh
lastline: lastline.sh
@./lastline.sh
spaces: spaces.sh
@./spaces.sh

25
.github/checks/lastline.sh vendored Executable file
View File

@ -0,0 +1,25 @@
#! /bin/bash
OLDCWD=`pwd`
SCRIPT_PATH=`dirname $0`
CHECK_PATH=.
cd $SCRIPT_PATH/../../
nl='
'
nl=$'\n'
r1="${nl}$"
FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | while read f; do
t=$(tail -c2 $f; printf x)
[[ ${t%x} =~ $r1 ]] || echo "$f"
done`
cd $OLDCWD
if [ x"$FILES"x != xx ]; then
echo "error: found following files that have no newline at the end:" >&2
for n in $FILES; do
echo $n >&2
done
exit -1
fi

18
.github/checks/spaces.sh vendored Executable file
View File

@ -0,0 +1,18 @@
#! /bin/bash
OLDCWD=`pwd`
SCRIPT_PATH=`dirname $0`
CHECK_PATH=.
cd $SCRIPT_PATH/../../
FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l ' $'`
cd $OLDCWD
if [ x"$FILES"x != xx ]; then
echo "error: found dangling spaces in the following files:" >&2
for n in $FILES; do
echo $n >&2
done
exit -1
fi

18
.github/checks/tabs.sh vendored Executable file
View File

@ -0,0 +1,18 @@
#! /bin/bash
OLDCWD=`pwd`
SCRIPT_PATH=`dirname $0`
CHECK_PATH=.
cd $SCRIPT_PATH/../../
FILES=`find $CHECK_PATH -type f \( \( -name \*.inc -a \! -name Makefile.inc \) -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -l $'\t'`
cd $OLDCWD
if [ x"$FILES"x != xx ]; then
echo "error: found TABs in the following files:" >&2
for n in $FILES; do
echo $n >&2
done
exit -1
fi

View File

@ -21,6 +21,9 @@ jobs:
- name: Checkout Source
uses: actions/checkout@v2
- name: Do some simple style checks
shell: bash
run: make -j2 check
- name: Build the tools.
shell: bash
run: make -j2 bin USER_CFLAGS=-Werror

View File

@ -46,6 +46,9 @@ jobs:
- name: Checkout Source
uses: actions/checkout@v2
- name: Do some simple style checks
shell: bash
run: make -j2 check
- name: Build the tools.
shell: bash
run: |

3
.gitignore vendored
View File

@ -7,3 +7,6 @@
/testwrk/
/wrk/
/cc65.zip
/util/atari/*.exe
/util/gamate/*.exe

113
Contributing.md Normal file
View File

@ -0,0 +1,113 @@
This document contains all kinds of information that you should know if you want to contribute to the cc65 project. Before you start, please read all of it. If something is not clear to you, please ask - this document is an ongoing effort and may well be incomplete.
(''Note:'' The word "must" indicates a requirement. The word "should" indicates a recomendation.)
# generally
* You must obey these rules when contributing new code or documentation to cc65. We are well aware that not all existing code may respect all rules outlined here - but this is no reason for you not to respect them.
* One commit/patch/PR per issue. Do not mix several things unless they are very closely related.
# Codestyle rules
## All Sources
### TABs and spaces
This is an ongoing controversial topic - everyone knows that. However, the following is how we do it :)
* TAB characters must be expanded to spaces.
* 4 spaces per indention level (rather than 8) are preferred, especially if there are many different levels.
* No extra spaces at the end of lines.
* All text files must end with new-line characters. Don't leave the last line "dangling".
The (bash) scipts used to check the above rules can be found in ```.github/check```. You can also run all checks using ```make check```.
### misc
* 80 characters is the desired maximum width of files. But, it isn't a "strong" rule; sometimes, you will want to type longer lines, in order to keep the parts of expressions or comments together on the same line.
* You should avoid typing non-ASCII characters.
* If you change "normal" source code into comments, then you must add a comment about why that code is a comment.
* When you want to create a comment from several lines of code, you should use preprocessor lines, instead of ```/* */``` or "```;```". Example:
<pre>
#if 0
one ();
two ();
three = two () + one ();
#endif
</pre>
* You should type upper case characters for hex values.
* When you type zero-page addresses in hexadecimal, you should type two hex characters (after the hex prefix). When you type non-zero-page addresses in hex, you should type four hex characters.
* When you type lists of addresses, it is a good idea to sort them in ascending numerical order. That makes it easier for readers to build mental pictures of where things are in an address space. And, it is easier to see how big the variables and buffers are. Example:
<pre>
xCoord := $0703
yCoord := $0705 ; (this address implies that xCoord is 16 bits)
cmdbuf := $0706 ; (this address implies that yCoord is 8 bits)
cmdlen := $0786 ; (this address implies that cmdbuf is 128 bytes)
color := $0787
</pre>
## C Sources
* Your files should obey the C89 standard.
* All declarations in a block must be at the beginning of that block.
* You should put a blank line between a list of local variable declarations and the first line of code.
* You must use ANSI C comments (```/* */```); you must not use C++ comments (```//```).
* The normal indentation width should be four spaces.
* When a function's argument list wraps around to a next line, you should indent that next line by either the normal width or enough spaces to align it with the arguments on the previous line.
* When you add functions to an existing file, you should separate them by the same number of blank lines that separate the functions that already are in that file.
(The next two rules will be changed at some time in the future; but, for now:)
* You must separate function names and parameter/argument lists by one space.
* When declaring/defining pointers, you must put the asterisk (```*```) next to the data type, with a space between it and the variable's name. Examples:
<pre>
int* namedPtr[5];
char* nextLine (FILE* f);
</pre>
## Assembly Sources
* Op-code mnemonics must have lower-case letters. The names of instruction macroes may have upper-case letters.
* Hexadecimal number constants should be used except where decimal or binary numbers make much more sense in that constant's context.
* Hexadecimal letters should be upper-case.
* When you set two registers or two memory locations to an immediate 16-bit zero, you should use the expressions ```#<$0000``` and ```#>$0000``` (they make it obvious where you are putting the lower and upper bytes).
* If a function is declared to return a char-sized value, it actually must return an integer-sized value. (When cc65 promotes a returned value, it sometimes assumes that the value already is an integer.)
* Functions, that are intended for a platform's system library, should be optimized as much as possible.
* Sometimes, there must be a trade-off between size and speed. If you think that a library function won't be used often, then you should make it small. Otherwise, you should make it fast.
* Comments that are put on the right side of instructions must be aligned (start in the same character columns).
* Assembly source fields (label, operation, operand, comment) should start ''after'' character columns that are multiples of eight (such as 1, 9, 17, 33, and 41).
## LinuxDoc Sources
* TAB characters must be expanded to spaces.
* All text files must end with new-line characters. Don't leave the last line "dangling".
* 80 characters is the desired maximum width of files.
* You should avoid typing non-ASCII characters.
* You should put blank lines between LinuxDoc sections:
* Three blank lines between ```<sect>``` sections.
* Two blank lines between ```<sect1>``` sections.
* One blank line between other sections.
# Library implementation rules
* By default the toolchain must output a "standard" binary for the platform, no emulator formats, no extra headers used by tools. If the resulting binaries can not be run as is on emulators or eg flash cartridges, the process of converting them to something that can be used with these should be documented in the user manual.
* Generally every function should live in a seperate source file - unless the functions are so closely related that splitting makes no sense.
* Source files should not contain commented out code - if they do, there should be a comment that explains why that commented out code exists.
# Makefile rules
* Makefiles must generally work on both *nix (ba)sh and windows cmd.exe.
* Makefiles must not use external tools that are not provided by the cc65 toolchain itself.
The only exception to the above are actions that are exclusive to the github actions - those may rely on bash and/or linux tools.
# Documentation rules
## User manual (LinuxDoc)
* This is the primary documentation.
## Wiki
* The Wiki is strictly for additional information that does not fit into the regular user manual (LinuxDoc). The wiki must not duplicate any information that is present in the user manual

View File

@ -1,4 +1,4 @@
.PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples test util
.PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples test util check
.SUFFIXES:
@ -24,6 +24,9 @@ samples:
test:
@$(MAKE) -C test --no-print-directory $@
check:
@$(MAKE) -C .github/checks --no-print-directory $@
util:
@$(MAKE) -C util --no-print-directory $@

View File

@ -4,7 +4,9 @@
[Documentation](https://cc65.github.io/doc)
[Wiki](https://github.com/cc65/wiki/wiki)
[Contributing](Contributing.md) to the CC65 project.
The [Wiki](https://github.com/cc65/wiki/wiki) contains extra info that does not fit into the regular documentation.
[![Snapshot Build](https://github.com/cc65/cc65/actions/workflows/snapshot-on-push-master.yml/badge.svg?branch=master)](https://github.com/cc65/cc65/actions/workflows/snapshot-on-push-master.yml)
@ -27,6 +29,7 @@ including
- the Atari 8-bit machines.
- the Atari 2600 console.
- the Atari 5200 console.
- the Atari 7800 console.
- GEOS for the C64, C128 and Apple //e.
- the Bit Corporation Gamate console.
- the NEC PC-Engine (aka TurboGrafx-16) console.

View File

@ -24,4 +24,4 @@ _FPUSHBACK = $08
; File table
.global __filetab

View File

@ -1,5 +1,5 @@
; Convert characters to screen codes
; Helper macro that converts and outputs one character
.macro _scrcode char
.if (char >= 0) .and (char <= 31)

View File

@ -7,7 +7,7 @@
;-------------------------------------------------------------------------
; ATASCII CHARACTER DEFS
;-------------------------------------------------------------------------
ATEOL = $9B ; END-OF-LINE, used by CONIO
;-------------------------------------------------------------------------
@ -27,9 +27,9 @@ CH_VLINE = $01 ; exclamation mark
POKMSK = $00 ; Mask for Pokey IRQ enable
RTCLOK = $01 ; 60 hz. clock
JUMP = $01
JUMP = $01
CRITIC = $03 ; Critical section
ATRACT = $04 ; Attract Mode
ATRACT = $04 ; Attract Mode
SDLSTL = $05 ; DLISTL Shadow
SDLSTH = $06 ; DLISTH "
@ -66,20 +66,20 @@ SAVMSC = $1B ; pointer to screen memory (conio)
;-------------------------------------------------------------------------
;Interrupt Vectors
VIMIRQ = $0200 ; Immediate IRQ
VIMIRQ = $0200 ; Immediate IRQ
; Preset $FC03 (SYSIRQ)
VVBLKI = $0202 ; Vblank immediate
; Preset $FCB8 (SYSVBL)
VVBLKD = $0204 ; Vblank deferred
; Preset $FCB2 (XITVBL)
VDSLST = $0206 ; Display List
VDSLST = $0206 ; Display List
; Preset $FEA1 (OSDLI)
VKYBDI = $0208 ; Keyboard immediate
; Preset $FD02 (SYSKBD)
VKYBDF = $020A ; Deferred Keyboard
; Preset $FCB2 (XITVBL)
VTRIGR = $020C ; Soft Trigger
VTRIGR = $020C ; Soft Trigger
VBRKOP = $020E ; BRK Opcode
VSERIN = $0210 ; Serial in Ready
VSEROR = $0212 ; Serial Out Ready

8
asminc/atari7800.inc Normal file
View File

@ -0,0 +1,8 @@
; Atari 7800 TIA & RIOT read / write registers
;
; Karri Kaksonen (karri@sipo.fi), 2022
; TIA, RIOT & MARIA registers mapping
.include "atari7800_tia.inc"
.include "atari7800_riot.inc"
.include "atari7800_maria.inc"

View File

@ -0,0 +1,39 @@
; Atari 7800 MARIA read / write registers
;
; Read registers
BKGRND := $20
P0C1 := $21
P0C2 := $22
P0C3 := $23
MWSYNC := $24
P1C1 := $25
P1C2 := $26
P1C3 := $27
MSTAT := $28
P2C1 := $29
P2C2 := $2A
P2C3 := $2B
DPPH := $2C
P3C1 := $2D
P3C2 := $2E
P3C3 := $2F
DPPL := $30
P4C1 := $31
P4C2 := $32
P4C3 := $33
CHBASE := $34
P5C1 := $35
P5C2 := $36
P5C3 := $37
OFFSET := $38
P6C1 := $39
P6C2 := $3A
P6C3 := $3B
CTRL := $3C
P7C1 := $3D
P7C2 := $3E
P7C3 := $3F
; Write registers

20
asminc/atari7800_riot.inc Normal file
View File

@ -0,0 +1,20 @@
; Atari 7800 RIOT read / write registers
;
; Source: DASM - vcs.h
; Details available in: Stella Programmer's Guide by Steve Wright
;
; Florent Flament (contact@florentflament.com), 2017
; Read registers
SWCHA := $0280
CTLSWA := $0281
SWCHB := $0282
CTLSWB := $0283
INTIM := $0284
TIMINT := $0285
; Write registers
TIM1T := $0294
TIM8T := $0295
TIM64T := $0296
T1024T := $0297

69
asminc/atari7800_tia.inc Normal file
View File

@ -0,0 +1,69 @@
; Atari 7800 TIA read / write registers
;
; Source: DASM - vcs.h
; Details available in: Stella Programmer's Guide by Steve Wright
;
; Florent Flament (contact@florentflament.com), 2017
; Read registers
VSYNC := $00
VBLANK := $01
WSYNC := $02
RSYNC := $03
NUSIZ0 := $04
NUSIZ1 := $05
COLUP0 := $06
COLUP1 := $07
COLUPF := $08
COLUBK := $09
CTRLPF := $0A
REFP0 := $0B
REFP1 := $0C
PF0 := $0D
PF1 := $0E
PF2 := $0F
RESP0 := $10
RESP1 := $11
RESM0 := $12
RESM1 := $13
RESBL := $14
AUDC0 := $15
AUDC1 := $16
AUDF0 := $17
AUDF1 := $18
AUDV0 := $19
AUDV1 := $1A
GRP0 := $1B
GRP1 := $1C
ENAM0 := $1D
ENAM1 := $1E
ENABL := $1F
HMP0 := $20
HMP1 := $21
HMM0 := $22
HMM1 := $23
HMBL := $24
VDELP0 := $25
VDELP1 := $26
VDELBL := $27
RESMP0 := $28
RESMP1 := $29
HMOVE := $2A
HMCLR := $2B
CXCLR := $2C
; Write registers
CXM0P := $00
CXM1P := $01
CXP0FB := $02
CXP1FB := $03
CXM0FB := $04
CXM1FB := $05
CXBLPF := $06
CXPPMM := $07
INPT0 := $08
INPT1 := $09
INPT2 := $0A
INPT3 := $0B
INPT4 := $0C
INPT5 := $0D

View File

@ -76,13 +76,13 @@ DL_CHR20x8x2 = 6 ; colour (duochrome per character), 20 character
DL_CHR20x16x2 = 7 ; colour (duochrome per character), 20 character & 16 scanlines per mode line (GR. 2)
DL_MAP40x8x4 = 8 ; colour, 40 pixel & 8 scanlines per mode line (GR. 3)
DL_MAP80x4x2 = 9 ; 'duochrome', 80 pixel & 4 scanlines per mode line (GR.4)
DL_MAP80x4x4 = 10 ; colour, 80 pixel & 4 scanlines per mode line (GR.5)
DL_MAP160x2x2 = 11 ; 'duochrome', 160 pixel & 2 scanlines per mode line (GR.6)
DL_MAP160x1x2 = 12 ; 'duochrome', 160 pixel & 1 scanline per mode line (GR.14)
DL_MAP160x2x4 = 13 ; 4 colours, 160 pixel & 2 scanlines per mode line (GR.7)
DL_MAP160x1x4 = 14 ; 4 colours, 160 pixel & 1 scanline per mode line (GR.15)
DL_MAP320x1x1 = 15 ; monochrome, 320 pixel & 1 scanline per mode line (GR.8)
DL_MAP80x4x2 = 9 ; 'duochrome', 80 pixel & 4 scanlines per mode line (GR.4)
DL_MAP80x4x4 = 10 ; colour, 80 pixel & 4 scanlines per mode line (GR.5)
DL_MAP160x2x2 = 11 ; 'duochrome', 160 pixel & 2 scanlines per mode line (GR.6)
DL_MAP160x1x2 = 12 ; 'duochrome', 160 pixel & 1 scanline per mode line (GR.14)
DL_MAP160x2x4 = 13 ; 4 colours, 160 pixel & 2 scanlines per mode line (GR.7)
DL_MAP160x1x4 = 14 ; 4 colours, 160 pixel & 1 scanline per mode line (GR.15)
DL_MAP320x1x1 = 15 ; monochrome, 320 pixel & 1 scanline per mode line (GR.8)
; modifiers on mode lines...

View File

@ -75,7 +75,7 @@ EMD_API_VERSION = $02
;------------------------------------------------------------------------------
; Driver entry points
.global emd_install
.global emd_uninstall
.global emd_pagecount

View File

@ -1,4 +1,4 @@
;
;
; Ullrich von Bassewitz, 16.05.2000
;

View File

@ -135,35 +135,35 @@ STIMCTLB = $FD1F
TIM0BKUP = $FD00
TIM0CTLA = $FD01
TIM0CNT = $FD02
TIM0CTLB = $FD03
TIM0CTLB = $FD03
TIM1BKUP = $FD04
TIM1CTLA = $FD05
TIM1CNT = $FD06
TIM1CTLB = $FD07
TIM1CTLB = $FD07
TIM2BKUP = $FD08
TIM2CTLA = $FD09
TIM2CNT = $FD0A
TIM2CTLB = $FD0B
TIM2CTLB = $FD0B
TIM3BKUP = $FD0C
TIM3CTLA = $FD0D
TIM3CNT = $FD0E
TIM3CTLB = $FD0F
TIM3CTLB = $FD0F
TIM4BKUP = $FD10
TIM4CTLA = $FD11
TIM4CNT = $FD12
TIM4CTLB = $FD13
TIM4CTLB = $FD13
TIM5BKUP = $FD14
TIM5CTLA = $FD15
TIM5CNT = $FD16
TIM5CTLB = $FD17
TIM5CTLB = $FD17
TIM6BKUP = $FD18
TIM6CTLA = $FD19
TIM6CNT = $FD1A
TIM6CTLB = $FD1B
TIM6CTLB = $FD1B
TIM7BKUP = $FD1C
TIM7CTLA = $FD1D
TIM7CNT = $FD1E
TIM7CTLB = $FD1F
TIM7CTLB = $FD1F
; Mikey Audio

View File

@ -3,23 +3,23 @@
;
; Christian Krüger, latest change: 18-Sep-2010
;
; This software is provided 'as-is', without any expressed or implied
; warranty. In no event will the authors be held liable for any damages
; arising from the use of this software.
;
; Permission is granted to anyone to use this software for any purpose,
; including commercial applications, and to alter it and redistribute it
; freely, subject to the following restrictions:
;
; 1. The origin of this software must not be misrepresented; you must not
; claim that you wrote the original software. If you use this software
; in a product, an acknowledgment in the product documentation would be
; appreciated but is not required.
; 2. Altered source versions must be plainly marked as such, and must not
; be misrepresented as being the original software.
; 3. This notice may not be removed or altered from any source
; distribution.
;
; This software is provided 'as-is', without any expressed or implied
; warranty. In no event will the authors be held liable for any damages
; arising from the use of this software.
;
; Permission is granted to anyone to use this software for any purpose,
; including commercial applications, and to alter it and redistribute it
; freely, subject to the following restrictions:
;
; 1. The origin of this software must not be misrepresented; you must not
; claim that you wrote the original software. If you use this software
; in a product, an acknowledgment in the product documentation would be
; appreciated but is not required.
; 2. Altered source versions must be plainly marked as such, and must not
; be misrepresented as being the original software.
; 3. This notice may not be removed or altered from any source
; distribution.
;
; Opcode-Table
; ------------

View File

@ -17,7 +17,7 @@ FNAME_LEN = 11 ; Maximum length of file-name
; ---------------------------------------------------------------------------
; I/O Identifier
; Theses identifers are used for channel management
;
;
XKBD = $80 ; Keyboard
XRSE = $83 ; RS232 in
@ -87,27 +87,27 @@ HRSFB := $57
VABKP1 := $58
; RS232T
; b0-b3 : speed
; b0-b3 : speed
; 1111 => 19200 bps (please note that telestrat can't handle this speed without stopping all IRQ except ACIA's one)
; 1100 => 9600 bps (default from TELEMON)
; 1110 => 4800 bps
; 1010 => 2400 bps
; 1000 => 1200 bps
; 0111 => 600 bps
; 0110 => 300 bps
; 0101 => 150 bps
; 0010 => 75 bps
; 1110 => 4800 bps
; 1010 => 2400 bps
; 1000 => 1200 bps
; 0111 => 600 bps
; 0110 => 300 bps
; 0101 => 150 bps
; 0010 => 75 bps
; b4 : 0 external clock, 1 internal clock
; b6-b5 : 00 8 bits
; 01 7 bits
; 10 6 bits
; 11 5 bits
; b7 : 0 a stop
; b7 : 0 a stop
RS232T := $59
; RS232C
; RS232C
; b0-b3 : 0
; b4 : 1 if echo
; b5 : 1 if parity
@ -218,7 +218,7 @@ SCREEN := $BB80
; TELEMON primitives (2.4 & 3.x)
; all values are used to call bank 7 of telestrat cardridge. It works with 'brk value'
; all values are used to call bank 7 of telestrat cardridge. It works with 'brk value'
XOP0 = $00 ; Open device on channel 0
XOP1 = $01 ; Open device on channel 1
XOP2 = $02 ; Open device on channel 2
@ -275,14 +275,14 @@ XFWRITE = $3B ; Only in TELEMON 3.x write file (bank 7 of Orix
; Clock primitive
XRECLK = $3C ; Reset clock
XCLCL = $3D ; Close clock
XWRCLK = $3E ; Displays clock in the adress in A & Y registers
XWRCLK = $3E ; Displays clock in the address in A & Y registers
; Sound primitives
XSONPS = $40 ; Send data to PSG register (14 values)
XOUPS = $42 ; Send Oups sound into PSG
XPLAY = $43 ; Play a sound
XSOUND = $44
XMUSIC = $45
XSOUND = $44
XMUSIC = $45
XZAP = $46 ; Send Zap sound to PSG
XSHOOT = $47
@ -303,13 +303,13 @@ XFWR = $4E ; Put a char on the first screen. Only available
; Keyboard primitives
XALLKB = $50 ; Read Keyboard, and populate KBDCOL
XKBDAS = $51 ; Ascii conversion
XGOKBD = $52 ; Swap keyboard type (Qwerty, French ...)
XGOKBD = $52 ; Swap keyboard type (Qwerty, French ...)
; Buffer management
XECRBU = $54 ; Write A or AY in the buffer
XLISBU = $55 ; Read A or AY in the buffer
XTSTBU = $56
XVIDBU = $57 ; Flush the buffer
XVIDBU = $57 ; Flush the buffer
XINIBU = $58 ; Initialize the buffer X
XDEFBU = $59 ; Reset all value of the buffer
XBUSY = $5A ; Test if the buffer is empty
@ -328,7 +328,7 @@ XMSAVE = $61 ; Write a file to Minitel
XFREE = $62 ; Only in TELEMON 3.x (bank 7 of Orix)
; Next Minitel primitives
; Next Minitel primitives
XWCXFI = $63 ; Wait connection
XLIGNE = $64 ;
XDECON = $65 ; Minitel disconnection
@ -340,7 +340,7 @@ XHRSSE = $8C ; Set hires position cursor
XDRAWA = $8D ; Draw a line absolute
XDRAWR = $8E ; Draw a line (relative)
XCIRCL = $8F ; Draw a circle
XCURSE = $90 ; Plot a pixel
XCURSE = $90 ; Plot a pixel
XCURMO = $91 ; Move to x,y pos in Hires
XPAPER = $92
XINK = $93
@ -358,8 +358,8 @@ XPING = $9D ; Send Ping sound to PSG
PWD_PTR = $00
; ---------------------------------------------------------------------------
;
BUFTRV := $100
;
BUFTRV := $100
; ---------------------------------------------------------------------------
@ -377,7 +377,7 @@ TIMES := $211
TIMEM := $212
TIMEH := $213
FLGCLK := $214
FLGCLK_FLAG := $215
FLGCLK_FLAG := $215
FLGCUR := $216 ; Cursor management flag
; screens position managements
@ -466,7 +466,7 @@ DESALO := $52D
FISALO := $52F
EXSALO := $531
EXTDEF := $55D ; Default extension. At the start of telemon, it's set to ".COM"
BUFEDT := $590 ; Buffer edition
BUFEDT := $590 ; Buffer edition
MAX_BUFEDT_LENGTH=110
@ -480,7 +480,7 @@ BUFBUF := $c080
; ---------------------------------------------------------------------------
; Stratsed vectors
; Stratsed is the main OS for Telestrat
; Stratsed is the main OS for Telestrat
XMERGE := $FF0E
XFST := $FF11
XSPUT := $FF14
@ -532,7 +532,7 @@ XPMAP := $FFA7
XRWTS := $FFAA
; ---------------------------------------------------------------------------
; MACRO
; MACRO
.macro BRK_TELEMON value
.byte $00,value

View File

@ -54,7 +54,7 @@ TGI_VF_CCOUNT = (TGI_VF_LASTCHAR - TGI_VF_FIRSTCHAR + 1)
; Font data loaded directly from file
.struct TGI_VECTORFONT
TOP .byte ; Height of char
BOTTOM .byte ; Descender
BOTTOM .byte ; Descender
HEIGHT .byte ; Maximum char height
WIDTHS .byte ::TGI_VF_CCOUNT ; Char widths
CHARS .word ::TGI_VF_CCOUNT ; Pointer to character defs

View File

@ -33,7 +33,7 @@
; Struct utsname
; Struct utsname
.struct utsname
sysname .byte 17
nodename .byte 9

View File

@ -12,7 +12,7 @@
.globalzp ptr1, ptr2, ptr3, ptr4
.globalzp tmp1, tmp2, tmp3, tmp4
.globalzp regbank
; The size of the register bank
regbanksize = 6

67
cfg/atari7800.cfg Normal file
View File

@ -0,0 +1,67 @@
# Atari VCS 7800 linker configuration file for cc65
# In order to add the a78 header to the build you can add
# "--force-import __EXEHDR__" to the command line
SYMBOLS {
__STACKSIZE__: type = weak, value = $0600; # C stack
__CARTSIZE__: type = weak, value = $8000;
__VEC_BOTTOM__: value = $fffa, type = export;
__VEC_SIZE__: value = $6, type = export;
__ENCRYPT_BOTTOM__: value = $ff7a, type = export;
__ENCRYPT_SIZE__: value = $80, type = export;
__MEMORY_TOP__: value = __ENCRYPT_BOTTOM__, type = export;
__INIT_SIZE__: value = 121, type = export;
__MEMORY_INIT__: value = __MEMORY_TOP__ - __INIT_SIZE__, type = export;
__MEMORY_BOTTOM__: value = $10000 - __CARTSIZE__, type = weak;
__FREE_ROM_SIZE__: value = __MEMORY_INIT__ - __MEMORY_BOTTOM__, type = export;
}
MEMORY {
ZP: file = "", define = yes, start = $0040, size = $00C0, type = rw;
SP: file = "", define = yes, start = $0140, size = $00C0, type = rw;
RAM1: file = "", define = yes, start = $1800, size = $0840, type = rw;
RAM2: file = "", define = yes, start = $2100, size = $0040, type = rw;
RAM3: file = "", define = yes, start = $2200, size = $0600, type = rw;
# For emulators you also need a header file
HEADER: file = %O, start = $0000, size = 128;
# "Normal" cartridge rom. Multiple banks arent supported
# by this script. You may change the rom size, but keep
# two things in mind:
# - start must be a multiple of $1000
# - ROM must end at $ff79
ROM: file = %O, define = yes, start = __MEMORY_BOTTOM__, size = __FREE_ROM_SIZE__, type = ro, fill = yes, fillval = $ff;
ROMS: file = %O, define = yes, start = __MEMORY_INIT__, size = __INIT_SIZE__, type = ro, fill = yes, fillval = $ff;
# Encryption stuff
ROME: file = %O, start = __ENCRYPT_BOTTOM__, size = __ENCRYPT_SIZE__, type = ro, fill = yes, fillval = $ff;
# Interrupt vectors
ROMV: file = %O, start = __VEC_BOTTOM__, size = __VEC_SIZE__, type = ro, fill = yes, fillval = $ff;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
EXEHDR: load = HEADER, type = ro, optional = yes;
STARTUP: load = ROMS, type = ro, define = yes;
ONCE: load = ROMS, type = ro, define = yes;
CODE: load = ROM, type = ro, define = yes;
RODATA: load = ROM, type = ro, define = yes, align = 256;
DATA: load = ROM, run = RAM1, type = rw, define = yes;
BSS: load = RAM1, type = bss, define = yes;
VECTORS: load = ROMV, type = ro, define = yes;
ENCRYPTION: load = ROME, type = ro define = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
segment = RODATA;
CONDES: type = interruptor,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__,
segment = RODATA,
import = __CALLIRQ__;
}

View File

@ -29,7 +29,7 @@ MEMORY {
EXT: file = "", define = yes, start = $9000, size = $1000;
IO: file = "", define = yes, start = $A000, size = $1000;
RAE1: file = "", define = yes, start = $B000, size = $1000;
BASROM: file = "", define = yes, start = $C000, size = $1000;
BASROM: file = "", define = yes, start = $C000, size = $2000;
RAE2: file = "", define = yes, start = $E000, size = $1000;
TOP: file = "", define = yes, start = $F000, size = $1000;
}

View File

@ -29,7 +29,7 @@ MEMORY {
EXT: file = "", define = yes, start = $9000, size = $1000;
IO: file = "", define = yes, start = $A000, size = $1000;
RAE1: file = "", define = yes, start = $B000, size = $1000;
BASROM: file = "", define = yes, start = $C000, size = $1000;
BASROM: file = "", define = yes, start = $C000, size = $2000;
RAE2: file = "", define = yes, start = $E000, size = $1000;
TOP: file = "", define = yes, start = $F000, size = $1000;
}

View File

@ -29,7 +29,7 @@ MEMORY {
EXT: file = "", define = yes, start = $9000, size = $1000;
IO: file = "", define = yes, start = $A000, size = $1000;
RAE1: file = "", define = yes, start = $B000, size = $1000;
BASROM: file = "", define = yes, start = $C000, size = $1000;
BASROM: file = "", define = yes, start = $C000, size = $2000;
RAE2: file = "", define = yes, start = $E000, size = $1000;
TOP: file = "", define = yes, start = $F000, size = $1000;
}

View File

@ -370,7 +370,7 @@ The names in the parentheses denote the symbols to be used for static linking of
In memory constrained situations the memory from &dollar;803 to &dollar;1FFF
can be made available to a program by calling <tt/_heapadd ((void *) 0x0803, 0x17FD);/
at the beginning of <tt/main()/. Doing so is beneficial even if the program
doesn't use the the heap explicitly because loading the driver (and in fact
doesn't use the heap explicitly because loading the driver (and in fact
already opening the driver file) uses the heap implicitly.
</descrip><p>

View File

@ -376,7 +376,7 @@ The names in the parentheses denote the symbols to be used for static linking of
In memory constrained situations the memory from &dollar;803 to &dollar;1FFF
can be made available to a program by calling <tt/_heapadd ((void *) 0x0803, 0x17FD);/
at the beginning of <tt/main()/. Doing so is beneficial even if the program
doesn't use the the heap explicitly because loading the driver (and in fact
doesn't use the heap explicitly because loading the driver (and in fact
already opening the driver file) uses the heap implicitly.
</descrip><p>

View File

@ -84,7 +84,7 @@ The names are the usual ones you can find in system reference manuals. Example:
tics = OS.rtclok[1] // get ticks
...
</verb></tscreen>
<sect1>Atari 5200 specific functions<p>
<itemize>
@ -221,7 +221,7 @@ you cannot use any of the following functions (and a few others):
<sect1>CAR format<p>
AtariROMMaker (<url url="https://www.wudsn.com/index.php/productions-atari800/tools/atarirommaker"> )
AtariROMMaker (<url url="https://www.wudsn.com/index.php/productions-atari800/tools/atarirommaker"> )
can be used to create a <tt/.CAR/ file from the binary ROM image cc65 generates.
This might be more convenient when working with emulators.

157
doc/atari7800.sgml Normal file
View File

@ -0,0 +1,157 @@
<!doctype linuxdoc system>
<article>
<title>Atari 7800 specific information for cc65
<author>
<url url="mailto:karri@sipo.fi" name="Karri Kaksonen"><newline>
<abstract>
An overview over the Atari 7800 runtime system as it is implemented
for the cc65 C compiler.
</abstract>
<!-- Table of contents -->
<toc>
<!-- Begin the document -->
<sect>Overview<p>
This file contains an overview of the Atari 7800 runtime system as it
comes with the cc65 C compiler. It describes the memory layout, Atari
7800 specific header files and any pitfalls specific to that platform.
<sect>Binary format<p>
The default binary output format generated by the linker for the Atari
7800 target is a 48K cartridge image.
<sect>A78 header<p>
There is lots of different cart hardware available for the atari7800.
Some carts have ROM, RAM, sound hardware, non-volatile high score chips.
In order to know what kind of hardware the cart build requires there is
a header file of 128 bytes in front of the binary.
The default build creates a cart file for a 48K rom cart without any
extra features like the pokey audio chip or extra RAM.
In order to make cc65 more user friendly the build will add the a78
header automatically. This allows you to run the binary on emulators
and flash carts on the real console.
<sect>Encryption<p>
In order to boot the game in a mode that supports atari7800 functions
the cart must be encrypted after the linking phase.
There is a program called sign7800 that can be used to sign the cart.
The encryption is not required for running the cart on emulators.
You can also run atari2600 games without encryption.
<sect>Memory layout<p>
cc65 generated programs with the default setup can use RAM from
from &dollar;1800 to &dollar;203f.
The 4k RAM is then mapped to zero page area.
&dollar;2040 to &dollar;20ff is visible as zero page.
After that we have a vero small RAM area that is unused.
&dollar;2100 to &dollar;213f.
Then we mirror a second block from the RAM to become the hardware stack.
This would be from &dollar;2140 to &dollar;21ff.
The C-stack starts at &dollar;2800 and it can grow down to &dollar;2200.
size of the system stack can be customized by defining the
__STACKSIZE__ linker variable.
Special locations:
<descrip>
<tag/Stack/ The C runtime stack is located at &dollar;2800 -
__STACKSIZE__ and growing downwards.
<tag/Heap/ The C heap is located at &dollar;2200 and grows upwards.
</descrip><p>
<sect>Start-up condition<p>
When powered-up, the Atari 7800 TIA registers contain random
values. During the initialization phase, the start-up code needs to
initialize the TIA registers to sound values (or else the console has
an unpredictable behavior). In this implementation, zeros are written
to all of TIA registers during the start-up phase.
Note that RIOT registers (mostly timers) are left uninitialized, as
they don't have any consequence on the console behavior.
<sect>Platform specific header files<p>
Programs containing Atari 7800 specific code may use the
<tt/atari7800.h/ header file.
The following pseudo variables declared in the <tt/atari7800.h/ header
file allow access to the Atari 7800 TIA, MARIA & RIOT chips registers.
<descrip>
<tag><tt/TIA/</tag> The <tt/TIA/ structure allows read/write access
to the Atari 7800 TIA chip registers. See the <tt/_tia.h/ header
file located in the include directory for the declaration of the
structure. Also refer to the Stella Programmer's Guide by Steve
Wright for a detailed description of the chip and its registers.
<tag><tt/RIOT/</tag> The <tt/RIOT/ structure allows read/write
access to the Atari 7800 RIOT chip registers. See the
<tt/_riot.h/ header file located in the include directory for the
declaration of the structure. Also refer to the Stella Programmer's
Guide by Steve Wright for a detailed description of the chip and its
registers.
<tag><tt/MARIA/</tag> The <tt/MARIA/ structure allows read/write
access to the Atari 7800 MARIA chip registers. See the
<tt/_maria.h/ header file located in the include directory for the
declaration of the structure.
</descrip><p>
<sect>Loadable drivers<p>
There are no drivers for the Atari 7800.
<sect>Limitations<p>
TBD
<sect>Other hints<p>
One may write a custom linker configuration file to tune the memory
layout of a program. See the <tt/atari7800.cfg/ file in the cfg
directory as a starting point.
<sect>License<p>
This software is provided 'as-is', without any expressed or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
<enum>
<item> The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source
distribution.
</enum>
</article>

View File

@ -126,7 +126,7 @@ and &dollar;FF3F.
In memory constrained situations the memory from &dollar;400 to &dollar;7FF
can be made available to a program by calling <tt/_heapadd ((void *) 0x0400, 0x0400);/
at the beginning of <tt/main()/. Doing so is beneficial even if the program
doesn't use the the heap explicitly because loading a driver uses the heap implicitly.
doesn't use the heap explicitly because loading a driver uses the heap implicitly.
Using <tt/c64-soft80.o/ is as simple as placing it on the linker command
line like this:

View File

@ -3108,7 +3108,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
<sect1><tt>.IFDEF</tt><label id=".IFDEF"><p>
Conditional assembly: Check if a symbol is defined. Must be followed by
a symbol name. The condition is true if the the given symbol is already
a symbol name. The condition is true if the given symbol is already
defined, and false otherwise.
See also: <tt><ref id=".DEFINED" name=".DEFINED"></tt>
@ -3143,7 +3143,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
<sect1><tt>.IFNDEF</tt><label id=".IFNDEF"><p>
Conditional assembly: Check if a symbol is defined. Must be followed by
a symbol name. The condition is true if the the given symbol is not
a symbol name. The condition is true if the given symbol is not
defined, and false otherwise.
See also: <tt><ref id=".DEFINED" name=".DEFINED"></tt>
@ -3152,7 +3152,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
<sect1><tt>.IFNREF</tt><label id=".IFNREF"><p>
Conditional assembly: Check if a symbol is referenced. Must be followed
by a symbol name. The condition is true if if the the given symbol was
by a symbol name. The condition is true if the given symbol was
not referenced before, and false otherwise.
See also: <tt><ref id=".REFERENCED" name=".REFERENCED"></tt>
@ -3197,7 +3197,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
<sect1><tt>.IFREF</tt><label id=".IFREF"><p>
Conditional assembly: Check if a symbol is referenced. Must be followed
by a symbol name. The condition is true if if the the given symbol was
by a symbol name. The condition is true if the given symbol was
referenced before, and false otherwise.
This command may be used to build subroutine libraries in include files
@ -3622,7 +3622,7 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".BYTE" name=".BYTE"
<sect1><tt>.PDTV</tt><label id=".PDTV"><p>
Enable the 6502DTV instruction set. This is a superset of the 6502
Enable the 6502DTV instruction set. This is a superset of the 6502
instruction set.
See: <tt><ref id=".P02" name=".P02"></tt>
@ -4763,6 +4763,7 @@ compiler, depending on the target system selected:
<item><tt/__APPLE2ENH__/ - Target system is <tt/apple2enh/
<item><tt/__ATARI2600__/ - Target system is <tt/atari2600/
<item><tt/__ATARI5200__/ - Target system is <tt/atari5200/
<item><tt/__ATARI7800__/ - Target system is <tt/atari7800/
<item><tt/__ATARI__/ - Target system is <tt/atari/ or <tt/atarixl/
<item><tt/__ATARIXL__/ - Target system is <tt/atarixl/
<item><tt/__ATMOS__/ - Target system is <tt/atmos/

View File

@ -198,6 +198,189 @@ Here is a description of all the command line options:
Enables debug mode, for debugging the behavior of cc65.
<tag><tt>--debug-tables name</tt></tag>
Writes symbol table information to a file, which includes details on structs, unions
functions, and global variables. For example, given the following code:
<tscreen><verb>
struct l {
unsigned char m;
unsigned char n;
};
struct hello {
unsigned char j;
unsigned char k;
struct l l;
};
struct sub {
unsigned char x;
unsigned char y;
};
union xy {
struct sub xy;
unsigned int mem;
};
typedef struct hello thingy;
unsigned char single;
unsigned char test_local_vars_main(void) {
static unsigned char wahoo;
static unsigned char bonanza = 0x42;
unsigned char i;
unsigned int j;
unsigned int *random;
unsigned char *lol;
signed char whoa;
struct hello wow;
thingy *cool;
union xy xy;
return 0;
}
</verb></tscreen>
The following output would be produced:
<tscreen><verb>
SC_FUNC: _test_local_vars_main: Symbol table
============================================
__fixargs__:
Flags: SC_CONST SC_DEF
Type: unsigned int
__argsize__:
Flags: SC_CONST SC_DEF
Type: unsigned char
wahoo:
AsmName: M0001
Flags: SC_STATIC SC_DEF SC_REF
Type: unsigned char
bonanza:
AsmName: M0002
Flags: SC_STATIC SC_DEF SC_REF
Type: unsigned char
i:
Flags: SC_AUTO SC_DEF SC_REF
Type: unsigned char
j:
Flags: SC_AUTO SC_DEF SC_REF
Type: unsigned int
random:
Flags: SC_AUTO SC_DEF SC_REF
Type: unsigned int *
lol:
Flags: SC_AUTO SC_DEF SC_REF
Type: unsigned char *
whoa:
Flags: SC_AUTO SC_DEF SC_REF
Type: signed char
wow:
Flags: SC_AUTO SC_DEF SC_REF
Type: struct hello
cool:
Flags: SC_AUTO SC_DEF SC_REF
Type: struct hello *
xy:
Flags: SC_AUTO SC_DEF SC_REF
Type: union xy
Global symbol table
===================
thingy:
AsmName: _thingy
Flags: SC_TYPEDEF 0x100000
Type: struct hello
single:
AsmName: _single
Flags: SC_STATIC SC_EXTERN SC_STORAGE SC_DEF SC_REF 0x100000
Type: unsigned char
test_local_vars_main:
AsmName: _test_local_vars_main
Flags: SC_FUNC SC_STATIC SC_EXTERN SC_DEF 0x100000
Type: unsigned char (void)
Global tag table
================
l:
Flags: SC_STRUCT SC_DEF
Type: (none)
hello:
Flags: SC_STRUCT SC_DEF
Type: (none)
sub:
Flags: SC_STRUCT SC_DEF
Type: (none)
xy:
Flags: SC_UNION SC_DEF
Type: (none)
Global struct and union definitions
=========================
SC_STRUCT: l
============
m:
Flags: SC_STRUCTFIELD
Type: unsigned char
n:
Flags: SC_STRUCTFIELD
Type: unsigned char
SC_STRUCT: hello
================
j:
Flags: SC_STRUCTFIELD
Type: unsigned char
k:
Flags: SC_STRUCTFIELD
Type: unsigned char
l:
Flags: SC_STRUCTFIELD
Type: struct l
SC_STRUCT: sub
==============
x:
Flags: SC_STRUCTFIELD
Type: unsigned char
y:
Flags: SC_STRUCTFIELD
Type: unsigned char
SC_UNION: xy
============
xy:
Flags: SC_STRUCTFIELD
Type: struct sub
mem:
Flags: SC_STRUCTFIELD
Type: unsigned int
</verb></tscreen>
<tag><tt>--debug-opt name</tt></tag>
The named file contains a list of specific optimization steps to enable or disable.

View File

@ -119,9 +119,9 @@ Here is a description of all the command line options:
<item>4510
</itemize>
6502x is for the NMOS 6502 with unofficial opcodes. 6502dtv is for the
emulated CPU of the C64DTV device. huc6280 is the CPU of the PC engine.
4510 is the CPU of the Commodore C65. Support for the 65816 currently
6502x is for the NMOS 6502 with unofficial opcodes. 6502dtv is for the
emulated CPU of the C64DTV device. huc6280 is the CPU of the PC engine.
4510 is the CPU of the Commodore C65. Support for the 65816 currently
is not available.
@ -253,8 +253,8 @@ for this CPU. Invalid opcodes are translated into <tt/.byte/ commands.
With the command line option <tt><ref id="option--cpu" name="--cpu"></tt>, the
disassembler may be told to recognize either the 65SC02 or 65C02 CPUs. The
latter understands the same opcodes as the former, plus 16 additional bit
manipulation and bit test-and-branch commands. Using 6502x as CPU the illegal
opcodes of 6502 CPU are detected and displayed. 6502dtv setting recognizes the
manipulation and bit test-and-branch commands. Using 6502x as CPU the illegal
opcodes of 6502 CPU are detected and displayed. 6502dtv setting recognizes the
emulated CPU instructons of the C64DTV device.

View File

@ -6127,7 +6127,7 @@ pointer you're passing somewhere else, otherwise
<tscreen><verb>
ptr = realloc (ptr, size);
</verb></tscreen>
will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
will lose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>

View File

@ -1332,7 +1332,7 @@ This function returns the GEOS Kernal version combined (by logical OR) with the
<p>
This function returns the PAL/NTSC flag combined (by logical OR) with the 40/80 columns flag. This is
not the best way to check if the screen has 40 or 80 columns since a PAL/NTSC check is always
performed and it can take as long as a full raster frame. If you just want to know if the
performed and it can take as long as a full raster frame. If you just want to know if the
screen has 40 or 80 columns use the expression <tt/graphMode & 0x80/ which returns <tt/0/ for
40 columns and <tt/0x80/ for 80 columns. Remember that this value can be changed during
runtime. It is unclear if this will work for GEOS 64 so you probably do not want to test

View File

@ -124,6 +124,9 @@
<tag><htmlurl url="atari5200.html" name="atari5200.html"></tag>
Topics specific to the Atari 5200 Game Console.
<tag><htmlurl url="atari7800.html" name="atari7800.html"></tag>
Topics specific to the Atari 7800 Game Console.
<tag><htmlurl url="atmos.html" name="atmos.html"></tag>
Topics specific to the Oric Atmos.

View File

@ -410,7 +410,7 @@ Available at <url
url="https://github.com/commanderx16/x16-emulator/releases">:
Emulates the Commander X16 Single Board Computer, with sound, SD card images,
VGA and NTSC video, and a NES game controller emulation. Includes a monitor.
VGA and NTSC video, and a NES game controller emulation. Includes a monitor.
It runs on all SDL2 platforms.
Compile the tutorial with
@ -459,7 +459,7 @@ Substitute the name of a Commodore computer for that <tt/&lt;sys&gt;/:
Start the desired version of the emulator (CBM610 programs run on
the CBM II &lsqb;<tt/xcbm2/&rsqb; emulator).
Choose <bf>File&gt;Autostart disk/tape image...</bf>, choose your executable,
Choose <bf>File&gt;Autostart disk/tape image...</bf>, choose your executable,
and click <bf/OK/.
The file has a 14-byte header which corresponds to a PRG-format BASIC program,
@ -500,7 +500,7 @@ prompt.
Before you can run the cartridge image produced by the linker, the binary has to
be patched using the <bf/gamate-fixcart/ tool that is included in the cc65
package in the util/gamata directory.
package in the util/gamate/ directory.
<tscreen><verb>
gamate-fixcart <image.bin>

View File

@ -166,6 +166,7 @@ Here is a description of all of the command-line options:
<item>apple2
<item>apple2enh
<item>atari2600
<item>atari7800
<item>atari
<item>atarixl
<item>atmos

View File

@ -36,7 +36,7 @@ Here is a small traditional Hello World program for the Atari Lynx.
<tscreen><verb>
#include <lynx.h>
#include <tgi.h>
#include <6502.h>
#include <6502.h>
void main(void) {
tgi_install(tgi_static_stddrv);

View File

@ -112,7 +112,7 @@ For a C test compiled and linked with <tt/--target sim6502/ the
command line arguments to <tt/sim65/ will be passed to <tt/main/,
and the return value from <tt/main/ will become sim65's exit code.
The <tt/exit/ function may also be used to terminate with an exit code.
Exit codes are limited to 8 bits.
The standard C library high level file input and output is functional.

View File

@ -15,21 +15,40 @@ An overview over the Sym-1 runtime system as it is implemented for the cc65 C co
<sect>Overview<p>
This file contains an overview of the Sym-1 runtime system as it comes with the cc65 C compiler. It describes the memory layout, Sym-1 specific header files, available drivers, and any pitfalls specific to the platform.
This file contains an overview of the Sym-1 runtime system as it comes with the cc65 C compiler.
It describes the memory layout, Sym-1 specific header files, available drivers, and any pitfalls
specific to the platform.
Please note that Sym-1 specific functions are just mentioned here, they are described in detail in the separate <url url="funcref.html" name="function reference">. Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information.
Please note that Sym-1 specific functions are just mentioned here, they are described in detail
in the separate <url url="funcref.html" name="function reference">. Even functions marked as
&quot;platform dependent&quot; may be available on more than one platform. Please see the
function reference for more information.
<sect>Binary format<p>
The output format generated by the linker for the Sym-1 target is a raw binary BIN file, which is essentially a memory image. You can convert this to a HEX file using BIN2HEX, which is a popular open-source conversion utility program. A HEX file has ASCII representations of the hexadecimal byte values of the machine-language program. So the HEX file can be transferred to the Sym-1 using the RS-232 terminal port, just as if the machine-code was entered by hand. Enter 'm 200' in the monitor and start the HEX file transfer.
The output format generated by the linker for the Sym-1 target is a raw binary BIN file, which
is essentially a memory image. You can convert this to a HEX file using BIN2HEX, which is a
popular open-source conversion utility program. A HEX file has ASCII representations of the
hexadecimal byte values of the machine-language program. So the HEX file can be transferred
to the Sym-1 using the RS-232 terminal port, just as if the machine-code was entered by hand.
Enter 'm 200' in the monitor and start the HEX file transfer.
<p>
Included with this distribution is a 4k configuration file and a 32k config file. The Sym-1 on-board memory is limited to 4 kbytes but system memory can be increased to 32 kbytes of contiguous RAM with aftermarket add-on boards. So choose the config file that matches your system configuration before compiling and linking user programs.
Included with this distribution is a 4k configuration file and a 32k config file. The Sym-1
on-board memory is limited to 4 kbytes but system memory can be increased to 32 kbytes of
contiguous RAM with aftermarket add-on boards. So choose the config file that matches your
system configuration before compiling and linking user programs.
<sect>Memory layout<p>
The ROMs and I/O areas are defined in the configuration files, as are most of the entry points for useful subroutines in the Sym-1 monitor ROM. cc65 generated programs compiled and linked using 4k config run in the memory range of &dollar;200 - &dollar;0FFF. The 32k config expands this range to &dollar;7FFF. The starting memory location and entry point for running the program is &dollar;200, so when the program is transferred to the Sym-1, it is executed by typing 'g 200'. The system returns control back to the monitor ROM when the program terminates, providing the '.' prompt.
The ROMs and I/O areas are defined in the configuration files, as are most of the entry points
for useful subroutines in the Sym-1 monitor ROM. cc65 generated programs compiled and linked
using 4k config run in the memory range of &dollar;200 - &dollar;0FFF. The 32k config expands
this range to &dollar;7FFF. Memory above 32k can be used to extend the heap, as described below.
The starting memory location and entry point for running the program is &dollar;200, so when the
program is transferred to the Sym-1, it is executed by typing 'g 200'. The system returns control
back to the monitor ROM when the program terminates, providing the '.' prompt.
Special locations:
@ -38,10 +57,12 @@ Special locations:
Conio support is not currently available for the Sym-1. But stdio console functions are available.
<tag/Stack/
The C runtime stack is located at &dollar;0FFF on 4KB Syms, or at &dollar;7FFF for 32KB systems. The stack always grows downwards.
The C runtime stack is located at &dollar;0FFF on 4kb Syms, or at &dollar;7FFF for 32kb systems.
The stack always grows downwards.
<tag/Heap/
The C heap is located at the end of the program and grows towards the C runtime stack.
The C heap is located at the end of the program and grows towards the C runtime stack. Extended
memory can be added to the heap, as described below.
</descrip><p>
@ -51,7 +72,8 @@ Programs containing Sym-1 code may use the <tt/sym1.h/ header file. See the hea
<sect1>Hardware access<p>
The pseudo variables declared in the <tt/sym1.inc/ include file allow access to hardware located in the address space. See the include file for more information.
The pseudo variables declared in the <tt/sym1.inc/ include file allow access to hardware located in the
address space. See the include file for more information.
<sect>Loadable drivers<p>
@ -61,7 +83,9 @@ No graphics drivers are currently available for the Sym-1.
<sect1>Extended memory drivers<p>
No extended memory drivers are currently available for the Sym-1.
There are no extended memory drivers for the Sym-1. However, there is a way to access memory beyond the
32kb boundary, if extended memory is physically present in the system. See the example program,
symExtendedMemory, in the samples directory.
<sect1>Joystick drivers<p>
@ -73,7 +97,8 @@ No mouse drivers are currently available for the Sym-1.
<sect1>RS232 device drivers<p>
No communication port drivers are currently available for the Sym-1. It has only the &quot;master console&quot; e.g. stdin and stdout.
No communication port drivers are currently available for the Sym-1. It has only the &quot;master console&quot;
e.g. stdin and stdout.
<sect>Limitations<p>
@ -94,29 +119,45 @@ To be more specific, this limitation means that you cannot use any of the follow
<sect>Other hints<p>
<sect1>sym1.h<p>
This header exposes Sym-specific I/O functions that are useful for reading and writing its ports and front panel. See the <tt/sym1.h/ include file for a list of the functions available.
This header exposes Sym-specific I/O functions that are useful for reading and writing its ports and front panel.
See the <tt/sym1.h/ include file for a list of the functions available.
<sect2>Limited memory applications<p>
As stated earlier, there are config files for 4KB and 32KB systems. If you have 32KB RAM, then you will probably want to use the sym1-32k configuration, but if not - if you are using the sym1-4k configuration - then you may want to use functions like getchar, putchar, gets and puts rather than functions like scanf and printf. Printf, for example, requires about 1KB because it needs to know how to process all the format specifiers.
As stated earlier, there are config files for 4kb and 32kb systems. If you have 32kb RAM, then you will probably
want to use the sym1-32k configuration, but if not - if you are using the sym1-4k configuration - then you may
want to use functions like getchar, putchar, gets and puts rather than functions like scanf and printf.
Printf, for example, requires about 1KB because it needs to know how to process all the format specifiers.
<sect3>Sample programs<p>
<sect3>Using extended memory<p>
All the samples will run on the &quot;stock&quot; 4KB Sym-1, except for symIO and symNotepad, which require 32KB. These sample programs can be found in the samples/sym1 directory:
Memory may be physically present that is addressed at locations above the monitor ROM at $8000. This extended
memory is accessible by adding to the heap, as described in the symExtendedMemory sample program.
<sect4>Sample programs<p>
All the samples will run on the &quot;stock&quot; 4kb Sym-1, except for symIO and symNotepad, which require 32kb.
Additionally, symExtendedMemory shows how to access memory above 32kb, so it expects more than 32kb.
These sample programs can be found in the samples/sym1 directory:
<itemize>
<item>symHello prints &quot;Hello World!&quot; and then inputs characters, which are echoed on the screen. It also makes a &quot;beep&quot; sound.</item>
<item>symTiny does the same as symHello, but does it with puts() rather than printf() to show the difference in compiled binary size.</item>
<item>symHello prints &quot;Hello World!&quot; and then inputs characters, which are echoed on the screen.
It also makes a &quot;beep&quot; sound.</item>
<item>symTiny does the same as symHello, but does it with puts() rather than printf() to show the difference
in compiled binary size.</item>
<item>symDisplay allows entry of a message, which is then displayed by scrolling it across the front panel display.</item>
<item>symIO allows access to the Sym-1 digital I/O ports.</item>
<item>symNotepad is a simple text entry/retrieval program that uses tape storage.</item>
<item>symExtendedMemory demonstrates how to access upper-memory and add it to the heap.</item>
</itemize>
<sect>License<p>
This software is provided 'as-is', without any expressed or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
This software is provided 'as-is', without any expressed or implied warranty. In no event will the authors be held
liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter
it and redistribute it freely, subject to the following restrictions:
<enum>
<item> The origin of this software must not be misrepresented; you must not

View File

@ -192,9 +192,9 @@ port cardridge.
Telemon 2.4 returns in keyboard buffer the direction of the joysticks. This means that
if you get input from keyboard by conio cgetc function, you will get direction from joysticks.
Anyway, if you don't want to use ROM, you can use joysticks standard drivers in your code.
Anyway, if you don't want to use ROM, you can use joysticks standard drivers in your code.
The standard driver manages two joysticks. Only one button is managed for these joysticks.
The standard driver manages two joysticks. Only one button is managed for these joysticks.
Telestrat can handle one button for the left port, and three buttons for the right port (but this port was designed for a mouse).
@ -217,7 +217,7 @@ RS232 port with Telemon calls (see XSOUT primitive for example)
Telemon 3.0 handles fopen, fread, fclose primitives. It means that this
function will crash the Telestrat because Telemon 2.4 does not have these
primitives. By the way, Telemon 3.0 uses an extension "ch376 card" which
handles sdcard and FAT 32 usb key. In the next version of Telemon, FT DOS,
handles sdcard and FAT 32 usb key. In the next version of Telemon, FT DOS,
Sedoric, Stratsed will be handled in these 3 primitives (fopen, fread, fclose).
<itemize>
@ -227,10 +227,10 @@ Sedoric, Stratsed will be handled in these 3 primitives (fopen, fread, fclose).
</itemize>
<sect1>conio<p>
Functions textcolor and bgcolor are available only with Telemon 3.0 (Orix).
Telemon 2.4 primitives can't handle any change of colors in text mode except with XINK or
XPAPER primitives which put on the first and second columns ink and paper attributes.
The only way to change color on the same line for text is to handle it in pure assembly
Functions textcolor and bgcolor are available only with Telemon 3.0 (Orix).
Telemon 2.4 primitives can't handle any change of colors in text mode except with XINK or
XPAPER primitives which put on the first and second columns ink and paper attributes.
The only way to change color on the same line for text is to handle it in pure assembly
without systems calls.
<sect>Other hints<p>

View File

@ -76,13 +76,13 @@ ifneq ($(MAKECMDGOALS),clean)
endif
%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $<
&#9;$(CC) -c $(CFLAGS) -o $@ $<
$(PROGRAM): $(SOURCES:.c=.o)
$(CC) $(LDFLAGS) -o $@ $^
&#9;$(CC) $(LDFLAGS) -o $@ $^
clean:
$(RM) $(SOURCES:.c=.o) $(SOURCES:.c=.d) $(PROGRAM) $(PROGRAM).map
&#9;$(RM) $(SOURCES:.c=.o) $(SOURCES:.c=.d) $(PROGRAM) $(PROGRAM).map
</verb></tscreen>
<bf/Important:/ When using the sample Makefile above via copy & paste it is

View File

@ -137,7 +137,7 @@ struct __antic {
** Called during every vertical blank; see SYSVBV, VVBLKI, CRITIC, and VVBLKD,
** as well as the SETVBV routine.
*/
#define NMIEN_VBI 0x40
#define NMIEN_VBI 0x40
/* [Reset] key pressed */
#define NMIEN_RESET 0x20

View File

@ -31,19 +31,19 @@
struct __os {
/*Page zero*/
unsigned char pokmsk; // = $00 System mask for POKEY IRQ enable
unsigned char pokmsk; // = $00 System mask for POKEY IRQ enable
unsigned char rtclok[2]; // = $01,$02 Real time clock
unsigned char critic; // = $03 Critical section flag
unsigned char critic; // = $03 Critical section flag
unsigned char atract; // = $04 Attract mode counter
union {
struct {
unsigned char sdlstl; // = $05 Save display list LO
unsigned char sdlsth; // = $06 Save display list HI
};
void* sdlst; // = $05,$06 Display list shadow
};
};
unsigned char sdmctl; // = $07 DMACTL shadow
unsigned char pcolr0; // = $08 PM color 0
unsigned char pcolr1; // = $09 PM color 1
@ -55,10 +55,10 @@ struct __os {
unsigned char color3; // = $0F PF color 3
unsigned char color4; // = $10 PF color 4
unsigned char _free_1[0xEF]; // = $11-$FF User space
/*Stack*/
unsigned char stack[0x100]; // = $100-$1FF Stack
/*Page 2 OS variables*/
void (*vinter)(void); // = $200 Immediate IRQ vector
void (*vvblki)(void); // = $202 Immediate VBI vector
@ -74,7 +74,7 @@ struct __os {
void (*vtimr1)(void); // = $216 POKEY timer 1 IRQ vector
void (*vtimr2)(void); // = $218 POKEY timer 2 IRQ vector
void (*vtimr4)(void); // = $21A POKEY timer 4 IRQ vector
};
#endif

View File

@ -66,7 +66,7 @@ struct __dcb {
unsigned char dtimlo; /* device timeout in seconds */
unsigned char dunuse; /* - unused - */
unsigned int dbyt; /* # of bytes to transfer */
union {
union {
struct {
unsigned char daux1; /* 1st command auxiliary byte */
unsigned char daux2; /* 2nd command auxiliary byte */
@ -105,7 +105,7 @@ struct __dos2x {
unsigned char* zbufp; /* points to user filename */
unsigned char* zdrva; /* points to serveral buffers (mostly VTOC) */
unsigned char* zsba; /* points to sector buffer */
unsigned char errno; /* number of occured error */
unsigned char errno; /* number of occurred error */
};
typedef struct __dos2x dos2x_t;
@ -167,28 +167,28 @@ struct __os {
#ifdef OSA
unsigned char* linzbs; // = $00/$01 LINBUG RAM (WILL BE REPLACED BY MONITOR RAM)
#else
#else
unsigned char linflg; // = $00 LNBUG FLAG (0 = NOT LNBUG)
unsigned char ngflag; // = $01 MEMORY STATUS (0 = FAILURE)
#endif
#endif
unsigned char* casini; // = $02/$03 CASSETTE INIT LOCATION
unsigned char* ramlo; // = $04/$05 RAM POINTER FOR MEMORY TEST
#ifdef OSA
#ifdef OSA
unsigned char tramsz; // = $06 FLAG FOR LEFT CARTRIDGE
unsigned char tstdat; // = $07 FLAG FOR RIGHT CARTRIDGE
#else
#else
unsigned char trnsmz; // = $06 TEMPORARY REGISTER FOR RAM SIZE
unsigned char tstdat; // = $07 UNUSED (NOT TOUCHED DURING RESET/COLD START)
#endif
// Cleared upon Coldstart only
// Cleared upon Coldstart only
unsigned char warmst; // = $08 WARM START FLAG
unsigned char bootq; // = $09 SUCCESSFUL BOOT FLAG
unsigned char bootq; // = $09 SUCCESSFUL BOOT FLAG
void (*dosvec)(void); // = $0A/$0B DISK SOFTWARE START VECTOR
void (*dosini)(void); // = $0C/$0D DISK SOFTWARE INIT ADDRESS
unsigned char* appmhi; // = $0E/$0F APPLICATIONS MEMORY HI LIMIT
unsigned char* appmhi; // = $0E/$0F APPLICATIONS MEMORY HI LIMIT
// Cleared upon Coldstart or Warmstart
@ -199,26 +199,26 @@ struct __os {
unsigned char iccomt; // = $17 COMMAND FOR VECTOR
unsigned char* dskfms; // = $18/$19 DISK FILE MANAGER POINTER
unsigned char* dskutl; // = $1A/$1B DISK UTILITIES POINTER
#ifdef OSA
#ifdef OSA
unsigned char ptimot; // = $1C PRINTER TIME OUT REGISTER
unsigned char pbpnt; // = $1D PRINT BUFFER POINTER
unsigned char pbufsz; // = $1E PRINT BUFFER SIZE
unsigned char ptemp; // = $1F TEMPORARY REGISTER
#else
#else
unsigned char abufpt[4]; // = $1C-$1F ACMI BUFFER POINTER AREA
#endif
#endif
iocb_t ziocb; // = $20-$2F ZERO PAGE I/O CONTROL BLOCK
unsigned char status; // = $30 INTERNAL STATUS STORAGE
unsigned char chksum; // = $31 CHECKSUM (SINGLE BYTE SUM WITH CARRY)
unsigned char* bufr; // = $32/$33 POINTER TO DATA BUFFER
unsigned char* bfen; // = $34/$35 NEXT BYTE PAST END OF THE DATA BUFFER LO
#ifdef OSA
#ifdef OSA
unsigned char cretry; // = $36 NUMBER OF COMMAND FRAME RETRIES
unsigned char dretry; // = $37 NUMBER OF DEVICE RETRIES
#else
#else
unsigned int ltemp; // = $36/$37 LOADER TEMPORARY
#endif
#endif
unsigned char bufrfl; // = $38 DATA BUFFER FULL FLAG
unsigned char recvdn; // = $39 RECEIVE DONE FLAG
unsigned char xmtdon; // = $3A TRANSMISSION DONE FLAG
@ -227,22 +227,22 @@ struct __os {
unsigned char bptr; // = $3D CASSETTE BUFFER POINTER
unsigned char ftype; // = $3E CASSETTE IRG TYPE
unsigned char feof; // = $3F CASSETTE EOF FLAG (0 // = QUIET)
unsigned char freq; // = $40 CASSETTE BEEP COUNTER
unsigned char soundr; // = $41 NOISY I/0 FLAG. (ZERO IS QUIET)
unsigned char critic; // = $42 DEFINES CRITICAL SECTION (CRITICAL IF NON-Z)
dos2x_t fmszpg; // = $43-$49 DISK FILE MANAGER SYSTEM ZERO PAGE
#ifdef OSA
#ifdef OSA
unsigned char ckey; // = $4A FLAG SET WHEN GAME START PRESSED
unsigned char cassbt; // = $4B CASSETTE BOOT FLAG
#else
#else
void* zchain; // = $4A/$4B HANDLER LINKAGE CHAIN POINTER
#endif
#endif
unsigned char dstat; // = $4C DISPLAY STATUS
unsigned char atract; // = $4D ATRACT FLAG
unsigned char drkmsk; // = $4E DARK ATRACT MASK
unsigned char colrsh; // = $4F ATRACT COLOR SHIFTER (EOR'ED WITH PLAYFIELD
unsigned char tmpchr; // = $50 TEMPORARY CHARACTER
unsigned char hold1; // = $51 TEMPORARY
unsigned char lmargn; // = $52 LEFT MARGIN (NORMALLY 2, CC65 C STARTUP CODE SETS IT TO 0)
@ -255,68 +255,68 @@ struct __os {
unsigned int oldcol; // = $5B/$5C PRIOR COLUMN
unsigned char oldchr; // = $5D DATA UNDER CURSOR
unsigned char* oldadr; // = $5E/$5F SAVED CURSOR MEMORY ADDRESS
#ifdef OSA
#ifdef OSA
unsigned char newrow; // = $60 POINT DRAW GOES TO
unsigned int newcol; // = $61/$62 COLUMN DRAW GOES TO
#else
#else
unsigned char* fkdef; // = $60/$61 FUNCTION KEY DEFINITION TABLE
unsigned char palnts; // = $62 PAL/NTSC INDICATOR (0 // = NTSC)
#endif
#endif
unsigned char logcol; // = $63 POINTS AT COLUMN IN LOGICAL LINE
unsigned char* adress; // = $64/$65 TEMPORARY ADDRESS
unsigned int mlttmp; // = $66/$67 TEMPORARY / FIRST BYTE IS USED IN OPEN AS TEMP
unsigned int savadr; // = $68/$69 SAVED ADDRESS
unsigned int mlttmp; // = $66/$67 TEMPORARY / FIRST BYTE IS USED IN OPEN AS TEMP
unsigned int savadr; // = $68/$69 SAVED ADDRESS
unsigned char ramtop; // = $6A RAM SIZE DEFINED BY POWER ON LOGIC
unsigned char bufcnt; // = $6B BUFFER COUNT
unsigned char* bufstr; // = $6C/$6D EDITOR GETCH POINTER
unsigned char bitmsk; // = $6E BIT MASK
unsigned char shfamt; // = $6F SHIFT AMOUNT FOR PIXEL JUSTIFUCATION
unsigned int rowac; // = $70/$71 DRAW WORKING ROW
unsigned int colac; // = $72/$73 DRAW WORKING COLUMN
unsigned char* endpt; // = $74/$75 END POINT
unsigned char deltar; // = $76 ROW DIFFERENCE
unsigned int deltac; // = $77/$78 COLUMN DIFFERENCE
#ifdef OSA
unsigned char rowinc; // = $79 ROWINC
#ifdef OSA
unsigned char rowinc; // = $79 ROWINC
unsigned char colinc; // = $7A COLINC
#else
#else
unsigned char* keydef; // = $79/$7A 2-BYTE KEY DEFINITION TABLE ADDRESS
#endif
#endif
unsigned char swpflg; // = $7B NON-0 1F TXT AND REGULAR RAM IS SWAPPED
unsigned char holdch; // = $7C CH IS MOVED HERE IN KGETCH BEFORE CNTL & SH
unsigned char insdat; // = $7D 1-BYTE TEMPORARY
unsigned int countr; // = $7E/$7F 2-BYTE DRAW ITERATION COUNT
unsigned char _free_1[0xD4-0x7F-1]; // USER SPACE
// Floating Point Package Page Zero Address Equates
fpreg_t fpreg[4]; // = $D4-$EB 4 REGSITERS, ACCCESS LIKE "fpreg[FPIDX_R0].fr"
unsigned char frx; // = $EC 1-BYTE TEMPORARY
fpreg_t fpreg[4]; // = $D4-$EB 4 REGSITERS, ACCCESS LIKE "fpreg[FPIDX_R0].fr"
unsigned char frx; // = $EC 1-BYTE TEMPORARY
unsigned char eexp; // = $ED VALUE OF EXP
#ifdef OS_REV2
#ifdef OS_REV2
unsigned char frsign; // = $EE ##REV2## 1-BYTE FLOATING POINT SIGN
unsigned char plycnt; // = $EF ##REV2## 1-BYTE POLYNOMIAL DEGREE
unsigned char sgnflg; // = $F0 ##REV2## 1-BYTE SIGN FLAG
unsigned char xfmflg; // = $F1 ##REV2## 1-BYTE TRANSFORM FLAG
#else
#else
unsigned char nsign; // = $EE SIGN OF #
unsigned char esign; // = $EF SIGN OF EXPONENT
unsigned char fchrflg; // = $F0 1ST CHAR FLAG
unsigned char digrt; // = $F1 # OF DIGITS RIGHT OF DECIMAL
#endif
#endif
unsigned char cix; // = $F2 CURRENT INPUT INDEX
unsigned char* inbuff; // = $F3/$F4 POINTS TO USER'S LINE INPUT BUFFER
unsigned char* inbuff; // = $F3/$F4 POINTS TO USER'S LINE INPUT BUFFER
unsigned int ztemp1; // = $F5/$F6 2-BYTE TEMPORARY
unsigned int ztemp4; // = $F7/$F8 2-BYTE TEMPORARY
unsigned int ztemp3; // = $F9/$FA 2-BYTE TEMPORARY
union {
union {
unsigned char degflg; // = $FB ##OLD## SAME AS RADFLG
unsigned char radflg; // = $FB ##OLD## 0=RADIANS, 6=DEGREES
};
fpreg_t* flptr; // = $FC/$FD 2-BYTE FLOATING POINT NUMBER POINTER
fpreg_t* fptr2; // = $FE/$FF 2-BYTE FLOATING POINT NUMBER POINTER
@ -356,28 +356,28 @@ struct __os {
union {
struct {
unsigned char sdlstl; // = $0230 SAVE DISPLAY LIST LOW BYTE
unsigned char sdlsth; // = $0231 SAVE DISPLAY LIST HI BYTE
unsigned char sdlsth; // = $0231 SAVE DISPLAY LIST HI BYTE
};
void* sdlst; // = $0230/$0231 (same as above as pointer)
};
unsigned char sskctl; // = $0232 SKCTL REGISTER RAM
#ifdef OSA
#ifdef OSA
unsigned char _spare_1; // = $0233 No OS use.
#else
unsigned char lcount; // = $0233 ##1200xl## 1-byte relocating loader record
#endif
#endif
unsigned char lpenh; // = $0234 LIGHT PEN HORIZONTAL VALUE
unsigned char lpenv; // = $0235 LIGHT PEN VERTICAL VALUE
void (*brkky)(void); // = $0236/$0237 BREAK KEY VECTOR
#ifdef OSA
#ifdef OSA
unsigned char spare2[2]; // = $0238/$0239 No OS use.
#else
#else
void (*vpirq)(void); // = $0238/$0239 ##rev2## 2-byte parallel device IRQ vector
#endif
#endif
unsigned char cdevic; // = $023A COMMAND FRAME BUFFER - DEVICE
unsigned char ccomnd; // = $023B COMMAND
union {
struct {
struct {
unsigned char caux1; // = $023C COMMAND AUX BYTE 1
unsigned char caux2; // = $023D COMMAND AUX BYTE 2
};
@ -389,15 +389,15 @@ struct __os {
unsigned char dbsect; // = $0241 NUMBER OF DISK BOOT SECTORS
unsigned char* bootad; // = $0242/$0243 ADDRESS WHERE DISK BOOT LOADER WILL BE PUT
unsigned char coldst; // = $0244 COLDSTART FLAG (1=IN MIDDLE OF COLDSTART>
#ifdef OSA
#ifdef OSA
unsigned char spare3; // = $0245 No OS use.
#else
#else
unsigned char reclen; // = $0245 ##1200xl## 1-byte relocating loader record length
#endif
#endif
unsigned char dsktim; // = $0246 DISK TIME OUT REGISTER
#ifdef OSA
#ifdef OSA
unsigned char linbuf[40]; // = $0247-$026E ##old## CHAR LINE BUFFER
#else
#else
unsigned char pdvmsk; // = $0247 ##rev2## 1-byte parallel device selection mask
unsigned char shpdvs; // = $0248 ##rev2## 1-byte PDVS (parallel device select)
unsigned char pdimsk; // = $0249 ##rev2## 1-byte parallel device IRQ selection
@ -409,7 +409,7 @@ struct __os {
unsigned char vsflag; // = $026C ##1200xl## 1-byte fine vertical scroll count
unsigned char keydis; // = $026D ##1200xl## 1-byte keyboard disable
unsigned char fine; // = $026E ##1200xl## 1-byte fine scrolling mode
#endif
#endif
unsigned char gprior; // = $026F GLOBAL PRIORITY CELL
unsigned char paddl0; // = $0270 1-BYTE POTENTIOMETER 0
unsigned char paddl1; // = $0271 1-BYTE POTENTIOMETER 1
@ -435,30 +435,30 @@ struct __os {
unsigned char strig1; // = $0285 1-BYTE JOYSTICK TRIGGER 1
unsigned char strig2; // = $0286 1-BYTE JOYSTICK TRIGGER 2
unsigned char strig3; // = $0287 1-BYTE JOYSTICK TRIGGER 3
#ifdef OSA
#ifdef OSA
unsigned char cstat; // = $0288 ##old## cassette status register
#else
#else
unsigned char hibyte; // = $0288 ##1200xl## 1-byte relocating loader high byte
#endif
#endif
unsigned char wmode; // = $0289 1-byte cassette WRITE mode
unsigned char blim; // = $028A 1-byte cassette buffer limit
#ifdef OSA
unsigned char _reserved_2[5]; // = $028B-$028F RESERVED
#else
#else
unsigned char imask; // = $028B ##rev2## (not used)
void (*jveck)(void); // = $028C/$028D 2-byte jump vector
unsigned newadr; // = $028E/028F ##1200xl## 2-byte relocating address
#endif
#endif
unsigned char txtrow; // = $0290 TEXT ROWCRS
unsigned txtcol; // = $0291/$0292 TEXT COLCRS
unsigned char tindex; // = $0293 TEXT INDEX
unsigned char* txtmsc; // = $0294/$0295 FOOLS CONVRT INTO NEW MSC
unsigned char txtold[6]; // = $0296-$029B OLDROW & OLDCOL FOR TEXT (AND THEN SOME)
#ifdef OSA
#ifdef OSA
unsigned char tmpx1; // = $029C ##old## 1--byte temporary register
#else
#else
unsigned char cretry; // = $029C ##1200xl## 1-byte number of command frame retries
#endif
#endif
unsigned char hold3; // = $029D 1-byte temporary
unsigned char subtmp; // = $029E 1-byte temporary
unsigned char hold2; // = $029F 1-byte (not used)
@ -473,41 +473,41 @@ struct __os {
unsigned tmpcol; // = $02B9/$02BA 2-byte temporary column
unsigned char scrflg; // = $02BB SET IF SCROLL OCCURS
unsigned char hold4; // = $02BC TEMP CELL USED IN DRAW ONLY
#ifdef OSA
#ifdef OSA
unsigned char hold5; // = $02BD ##old## DITTO
#else
#else
unsigned char dretry; // = $02BD ##1200xl## 1-byte number of device retries
#endif
#endif
unsigned char shflok; // = $02BE 1-byte shift/control lock flags
unsigned char botscr; // = $02BF BOTTOM OF SCREEN 24 NORM 4 SPLIT
unsigned char pcolr0; // = $02C0 1-byte player-missile 0 color/luminance
unsigned char pcolr1; // = $02C1 1-byte player-missile 1 color/luminance
unsigned char pcolr2; // = $02C2 1-byte player-missile 2 color/luminance
unsigned char pcolr3; // = $02C3 1-byte player-missile 3 color/luminance
unsigned char pcolr3; // = $02C3 1-byte player-missile 3 color/luminance
unsigned char color0; // = $02C4 1-byte playfield 0 color/luminance
unsigned char color1; // = $02C5 1-byte playfield 1 color/luminance
unsigned char color2; // = $02C6 1-byte playfield 2 color/luminance
unsigned char color3; // = $02C7 1-byte playfield 3 color/luminance
unsigned char color4; // = $02C8 1-byte background color/luminance
#ifdef OSA
#ifdef OSA
unsigned char _spare_2[23]; // = $02C9-$02DF No OS use.
#else
union {
unsigned char parmbl[6]; // = $02C9 ##rev2## 6-byte relocating loader parameter
struct {
struct {
void (*runadr)(void); // = $02C9 ##1200xl## 2-byte run address
unsigned int hiused; // = $02CB ##1200xl## 2-byte highest non-zero page address
unsigned int zhiuse; // = $02CD ##1200xl## 2-byte highest zero page address
};
};
union {
};
};
union {
unsigned char oldpar[6]; // = $02CF ##rev2## 6-byte relocating loader parameter
struct {
struct {
void (*gbytea)(void); // = $02CF ##1200xl## 2-byte GET-BYTE routine address
unsigned int loadad; // = $02D1 ##1200xl## 2-byte non-zero page load address
unsigned int zloada; // = $02D3 ##1200xl## 2-byte zero page load address
};
};
};
};
unsigned int dsctln; // = $02D5 ##1200xl## 2-byte disk sector length
unsigned int acmisr; // = $02D7 ##1200xl## 2-byte ACMI interrupt service routine
unsigned char krpdel; // = $02D9 ##1200xl## 1-byte auto-repeat delay
@ -517,78 +517,78 @@ struct __os {
unsigned char dmasav; // = $02DD ##1200xl## 1-byte SDMCTL save/restore
unsigned char pbpnt; // = $02DE ##1200xl## 1-byte printer buffer pointer
unsigned char pbufsz; // = $02DF ##1200xl## 1-byte printer buffer size
#endif
union {
#endif
union {
unsigned char glbabs[4]; // = $02E0-$02E3 byte global variables for non-DOS users
struct {
struct {
void (*runad)(void); // = $02E0 ##map## 2-byte binary file run address
void (*initad)(void); // = $02E2 ##map## 2-byte binary file initialization address
};
};
};
};
unsigned char ramsiz; // = $02E4 RAM SIZE (HI BYTE ONLY)
void* memtop; // = $02E5 TOP OF AVAILABLE USER MEMORY
void* memlo; // = $02E7 BOTTOM OF AVAILABLE USER MEMORY
#ifdef OSA
#ifdef OSA
unsigned char _spare_3; // = $02E9 No OS use.
#else
#else
unsigned char hndlod; // = $02E9 ##1200xl## 1-byte user load flag
#endif
#endif
unsigned char dvstat[4]; // = $02EA-$02ED STATUS BUFFER
union {
union {
unsigned int cbaud; // = $02EE/$02EF 2-byte cassette baud rate
struct {
struct {
unsigned char cbaudl; // = $02EE 1-byte low cassette baud rate
unsigned char cbaudh; // = $02EF 1-byte high cassette baud rate
};
};
};
};
unsigned char crsinh; // = $02F0 CURSOR INHIBIT (00 = CURSOR ON)
unsigned char keydel; // = $02F1 KEY DELAY
unsigned char ch1; // = $02F2 1-byte prior keyboard character
unsigned char chact; // = $02F3 CHACTL REGISTER RAM
unsigned char chbas; // = $02F4 CHBAS REGISTER RAM
#ifdef OSA
#ifdef OSA
unsigned char _spare_4[5]; // = $02F5-$02F9 No OS use.
#else
#else
unsigned char newrow; // = $02F5 ##1200xl## 1-byte draw destination row
unsigned int newcol; // = $02F6/$02F7 ##1200xl## 2-byte draw destination column
unsigned char rowinc; // = $02F8 ##1200xl## 1-byte draw row increment
unsigned char colinc; // = $02F9 ##1200xl## 1-byte draw column increment
#endif
#endif
unsigned char char_; // = $02FA 1-byte internal character (naming changed due to do keyword conflict)
unsigned char atachr; // = $02FB ATASCII CHARACTER
unsigned char ch; // = $02FC GLOBAL VARIABLE FOR KEYBOARD
unsigned char fildat; // = $02FD RIGHT FILL DATA <DRAW>
unsigned char dspflg; // = $02FE DISPLAY FLAG DISPLAY CNTLS IF NON-ZERO
unsigned char ssflag; // = $02FF START/STOP FLAG FOR PAGING (CNTL 1). CLEARE
// --- Page 3 ---
dcb_t dcb; // = $0300-$030B DEVICE CONTROL BLOCK
unsigned int timer1; // = $030C/$030D INITIAL TIMER VALUE
#ifdef OSA
#ifdef OSA
unsigned char addcor; // = $030E ##old## ADDITION CORRECTION
#else
#else
unsigned char jmpers; // = $030E ##1200xl## 1-byte jumper options
#endif
#endif
unsigned char casflg; // = $030F CASSETTE MODE WHEN SET
unsigned int timer2; // = $0310/$0311 2-byte final baud rate timer value
unsigned char temp1; // = $0312 TEMPORARY STORAGE REGISTER
#ifdef OSA
#ifdef OSA
unsigned char _spare_5; // = $0313 unused
unsigned char temp2; // = $0314 ##old## TEMPORARY STORAGE REGISTER
#else
#else
unsigned char temp2; // = $0313 ##1200xl## 1-byte temporary
unsigned char ptimot; // = $0314 ##1200xl## 1-byte printer timeout
#endif
#endif
unsigned char temp3; // = $0315 TEMPORARY STORAGE REGISTER
unsigned char savio; // = $0316 SAVE SERIAL IN DATA PORT
unsigned char timflg; // = $0317 TIME OUT FLAG FOR BAUD RATE CORRECTION
unsigned char stackp; // = $0318 SIO STACK POINTER SAVE CELL
unsigned char tstat; // = $0319 TEMPORARY STATUS HOLDER
#ifdef OSA
#ifdef OSA
hatabs_t hatabs[12]; // = $031A-$033D handler address table
unsigned int zeropad; // = $033E/$033F zero padding
#else
#else
hatabs_t hatabs[11]; // = $031A-$033A handler address table
unsigned int zeropad; // = $033B/$033C zero padding
unsigned char pupbt1; // = $033D ##1200xl## 1-byte power-up validation byte 1
@ -598,9 +598,9 @@ struct __os {
iocb_t iocb[8]; // = $0340-$03BF 8 I/O Control Blocks
unsigned char prnbuf[40]; // = $03C0-$3E7 PRINTER BUFFER
#ifdef OSA
#ifdef OSA
unsigned char _spare_6[151]; // = $03E8-$047F unused
#else
#else
unsigned char superf; // = $03E8 ##1200xl## 1-byte editor super function flag
unsigned char ckey; // = $03E9 ##1200xl## 1-byte cassette boot request flag
unsigned char cassbt; // = $03EA ##1200xl## 1-byte cassette boot flag
@ -639,7 +639,7 @@ struct __basic {
void* starp; // = $8C/$8D ADDRESS FOR THE STRING AND ARRAY TABLE
void* runstk; // = $8E/$8F ADDRESS OF THE RUNTIME STACK
void* memtop; // = $90/$91 POINTER TO THE TOP OF BASIC MEMORY
unsigned char _internal_1[0xBA-0x91-1]; // INTERNAL DATA
unsigned int stopln; // = $BA/$BB LINE WHERE A PROGRAM WAS STOPPED

63
include/_maria.h Normal file
View File

@ -0,0 +1,63 @@
/*****************************************************************************/
/* */
/* _maria.h */
/* */
/* Atari 7800, Maria chip register hardware structures */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
/*
* MARIA registers
*/
struct __maria {
unsigned char bkgrnd;
unsigned char p0c1;
unsigned char p0c2;
unsigned char p0c3;
unsigned char wsync;
unsigned char p1c1;
unsigned char p1c2;
unsigned char p1c3;
unsigned char mstat;
unsigned char p2c1;
unsigned char p2c2;
unsigned char p2c3;
unsigned char dpph;
unsigned char p3c1;
unsigned char p3c2;
unsigned char p3c3;
unsigned char dppl;
unsigned char p4c1;
unsigned char p4c2;
unsigned char p4c3;
unsigned char chbase;
unsigned char p5c1;
unsigned char p5c2;
unsigned char p5c3;
unsigned char offset;
unsigned char p6c1;
unsigned char p6c2;
unsigned char p6c3;
unsigned char ctrl;
unsigned char p7c1;
unsigned char p7c2;
unsigned char p7c3;
};

View File

@ -131,7 +131,7 @@ struct __pokey_write {
#define SKCTL_KEYBOARD_SCANNING 0x02 /* Enable keyboard scanning circuit */
/* Fast pot scan
** The pot scan counter completes its sequence in two TV line times instead of
** The pot scan counter completes its sequence in two TV line times instead of
** one frame time (228 scan lines). Not as accurate as the normal pot scan
*/
#define SKCTL_FAST_POT_SCAN 0x04
@ -204,7 +204,7 @@ struct __pokey_read {
#define SKSTAT_DATA_READ_INGORING_SHIFTREG 0x10 /* Data can be read directly from the serial input port, ignoring the shift register. */
#define SKSTAT_KEYBOARD_OVERRUN 0x20 /* Keyboard over-run; Reset BITs 7, 6 and 5 (latches) to 1, using SKREST */
#define SKSTAT_INPUT_OVERRUN 0x40 /* Serial data input over-run. Reset latches as above. */
#define SKSTAT_INPUT_FRAMEERROR 0x80 /* Serial data input frame error caused by missing or extra bits. Reset latches as above. */
#define SKSTAT_INPUT_FRAMEERROR 0x80 /* Serial data input frame error caused by missing or extra bits. Reset latches as above. */
/* KBCODE, internal keyboard codes for Atari 8-bit computers,

View File

@ -180,7 +180,7 @@ unsigned char detect_c128 (void);
unsigned char __fastcall__ set_chameleon_speed (unsigned char speed);
/* Set the speed of the C64 Chameleon cartridge, the following inputs
* are accepted:
* are accepted:
* SPEED_SLOW : 1 Mhz mode
* SPEED_1X : 1 Mhz mode
* SPEED_2X : 2 Mhz mode

View File

@ -159,11 +159,11 @@ extern struct {
unsigned day :5;
unsigned mon :4;
unsigned year :7;
} createdate; /* Current date: 0 */
} createdate; /* Current date: 0 */
struct {
unsigned char min;
unsigned char hour;
} createtime; /* Current time: 0 */
} createtime; /* Current time: 0 */
} _datetime;
/* The addresses of the static drivers */

65
include/atari7800.h Normal file
View File

@ -0,0 +1,65 @@
/*****************************************************************************/
/* */
/* Atari VCS 7800 TIA & RIOT registers addresses */
/* */
/* Karri Kaksonen (karri@sipo.fi), 2022 */
/* */
/* */
/*****************************************************************************/
#ifndef _ATARI7800_H
#define _ATARI7800_H
/* Check for errors */
#if !defined(__ATARI7800__)
# error This module may only be used when compiling for the Atari 7800!
#endif
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Color defines */
#define COLOR_BLACK 0x00
#define COLOR_GREY 0x01
#define COLOR_LIGHTGREY 0x02
#define COLOR_WHITE 0x03
/* TGI color defines (default palette) */
#define TGI_COLOR_BLACK COLOR_BLACK
#define TGI_COLOR_GREY COLOR_GREY
#define TGI_COLOR_LIGHTGREY COLOR_LIGHTGREY
#define TGI_COLOR_WHITE COLOR_WHITE
/* Masks for joy_read */
#define JOY_RIGHT_MASK 0x80
#define JOY_LEFT_MASK 0x40
#define JOY_DOWN_MASK 0x20
#define JOY_UP_MASK 0x10
#define JOY_BTN_1_MASK 0x01
#define JOY_BTN_2_MASK 0x02
#define JOY_BTN_A_MASK JOY_BTN_1_MASK
#define JOY_BTN_B_MASK JOY_BTN_2_MASK
#define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK)
#define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK)
/* No support for dynamically loadable drivers */
#define DYN_DRV 0
#include <_tia.h>
#define TIA (*(struct __tia*)0x0000)
#include <_riot.h>
#define RIOT (*(struct __riot*)0x0280)
#include <_maria.h>
#define MARIA (*(struct __maria*)0x0020)
/* End of atari7800.h */
#endif

View File

@ -59,21 +59,21 @@ unsigned long __fastcall__ udiv32by16r16 (unsigned long rhs, unsigned lhs);
*/
int __fastcall__ imul8x8r16 (signed char lhs, signed char rhs);
/* Multiplicate two signed 8 bit to yield an signed 16 bit result */
/* Multiply two signed 8 bit to yield an signed 16 bit result */
long __fastcall__ imul16x16r32 (int lhs, int rhs);
/* Multiplicate two signed 16 bit to yield a signed 32 bit result */
/* Multiply two signed 16 bit to yield a signed 32 bit result */
unsigned __fastcall__ umul8x8r16 (unsigned char lhs, unsigned char rhs);
/* Multiplicate two unsigned 8 bit to yield an unsigned 16 bit result */
/* Multiply two unsigned 8 bit to yield an unsigned 16 bit result */
unsigned long __fastcall__ umul16x8r32 (unsigned lhs, unsigned char rhs);
/* Multiplicate an unsigned 16 bit by an unsigned 8 bit number yielding a 24
/* Multiply an unsigned 16 bit by an unsigned 8 bit number yielding a 24
** bit unsigned result that is extended to 32 bits for easier handling from C.
*/
unsigned long __fastcall__ umul16x16r32 (unsigned lhs, unsigned rhs);
/* Multiplicate two unsigned 16 bit to yield an unsigned 32 bit result */
/* Multiply two unsigned 16 bit to yield an unsigned 32 bit result */
unsigned int __fastcall__ mul20 (unsigned char value);
/* Multiply an 8 bit unsigned value by 20 and return the 16 bit unsigned

View File

@ -39,7 +39,7 @@
** are declared here.
**
** To use the debugger, just call DbgInit in your application. Once it has
** been called, the debugger will catch any BRK opcode. Use the BREAK macro
** been called, the debugger will catch any BRK opcode. Use the BREAK macro
** defined below to insert breakpoints into your code.
**
** There are currently a lot of things that cannot be debugged, graphical
@ -121,4 +121,4 @@ void __fastcall__ DbgInit (unsigned unused);

View File

@ -84,7 +84,7 @@ extern int _errno;
int __fastcall__ _osmaperrno (unsigned char oserror);
/* Map an operating system specific error code (for example from _oserror)
/* Map an operating system specific error code (for example from _oserror)
** into one of the E... codes above. It is user callable.
*/

View File

@ -145,6 +145,8 @@
/* constants for the conio implementation */
#define COLOR_BLACK 0x03
#define COLOR_GRAY2 0x02
#define COLOR_GRAY1 0x01
#define COLOR_WHITE 0x00
#define CH_HLINE 1

View File

@ -12,7 +12,7 @@
void __fastcall__ CopyString(char *dest, const char *source);
char __fastcall__ CmpString(const char *dest, const char *source);
void __fastcall__ CopyFString(char len, char *dest, const char *source);
char __fastcall__ CmpFString(char len, char *dest, const char *source);
char __fastcall__ CmpFString(char len, char *dest, const char *source);
unsigned __fastcall__ CRC(const char *buffer, unsigned len);
void* __fastcall__ ClearRam(char *dest, unsigned len);

View File

@ -52,24 +52,25 @@
/* Color defines */
#define COLOR_BLACK 0x00
#define COLOR_RED 0x01
#define COLOR_PINK 0x02
#define COLOR_LIGHTGREY 0x03
#define COLOR_GREY 0x04
#define COLOR_DARKGREY 0x05
#define COLOR_BROWN 0x06
#define COLOR_PEACH 0x07
#define COLOR_YELLOW 0x08
#define COLOR_LIGHTGREEN 0x09
#define COLOR_GREEN 0x0A
#define COLOR_DARKBROWN 0x0B
#define COLOR_TRANSPARENT 0x00
#define COLOR_BLACK 0x01
#define COLOR_RED 0x02
#define COLOR_PINK 0x03
#define COLOR_LIGHTGREY 0x04
#define COLOR_GREY 0x05
#define COLOR_DARKGREY 0x06
#define COLOR_BROWN 0x07
#define COLOR_PEACH 0x08
#define COLOR_YELLOW 0x09
#define COLOR_LIGHTGREEN 0x0A
#define COLOR_GREEN 0x0B
#define COLOR_VIOLET 0x0C
#define COLOR_BLUE 0x0D
#define COLOR_LIGHTBLUE 0x0E
#define COLOR_WHITE 0x0F
/* TGI color defines (default palette) */
#define TGI_COLOR_TRANSPARENT COLOR_TRANSPARENT
#define TGI_COLOR_BLACK COLOR_BLACK
#define TGI_COLOR_RED COLOR_RED
#define TGI_COLOR_PINK COLOR_PINK
@ -81,7 +82,6 @@
#define TGI_COLOR_YELLOW COLOR_YELLOW
#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN
#define TGI_COLOR_GREEN COLOR_GREEN
#define TGI_COLOR_DARKBROWN COLOR_DARKBROWN
#define TGI_COLOR_VIOLET COLOR_VIOLET
#define TGI_COLOR_BLUE COLOR_BLUE
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE

View File

@ -52,8 +52,8 @@ typedef unsigned size_t;
/* Those non-standard cc65 exit constants definitions are in addition
** to the EXIT_SUCCESS and EXIT_FAILURE constants, which should not be
** redefined
*/
** redefined
*/
#define EXIT_ASSERT 2
#define EXIT_ABORT 3

View File

@ -41,7 +41,7 @@
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/*

View File

@ -43,6 +43,8 @@
# include <atari2600.h>
#elif defined(__ATARI5200__)
# include <atari5200.h>
#elif defined(__ATARI7800__)
# include <atari7800.h>
#elif defined(__ATMOS__)
# include <atmos.h>
#elif defined(__CBM__)

View File

@ -21,6 +21,7 @@ TARGETS = apple2 \
atarixl \
atari2600 \
atari5200 \
atari7800 \
atmos \
creativision \
$(CBMS) \

View File

@ -13,4 +13,4 @@ _textcolor := return1
_bgcolor := return0
_bordercolor := return0
_bordercolor := return0

View File

@ -18,7 +18,7 @@ typerr: lda #$4A ; "Incompatible file format"
; Cleanup name
oserr: jsr popname ; Preserves A
; Set __oserror
jmp __mappederrno
@ -129,7 +129,7 @@ setbuf: lda #$00 ; Low byte
.assert MLI::OPEN::PATHNAME = MLI::INFO::PATHNAME, error
; Lower file level to avoid program file
; being closed by C libary shutdown code
; being closed by C library shutdown code
ldx LEVEL
stx level
beq :+
@ -185,13 +185,13 @@ setbuf: lda #$00 ; Low byte
lda #$00 ; '\0'
beq :- ; Branch always
; Call loader stub after C libary shutdown
; Call loader stub after C library shutdown
: lda #<target
ldx #>target
sta done+1
stx done+2
; Initiate C libary shutdown
; Initiate C library shutdown
jmp _exit
.bss

View File

@ -2,7 +2,7 @@
; Oliver Schmidt, 10.9.2009
;
; Default ProDOS 8 I/O buffer management
;
;
.export iobuf_alloc, iobuf_free
.import _posix_memalign, _free

View File

@ -8,13 +8,13 @@
;
.export _mouse_def_callbacks
.include "apple2.inc"
; ------------------------------------------------------------------------
.bss
backup: .res 1
visible:.res 1

View File

@ -152,7 +152,7 @@ next: inc ptr1+1
sta xparam+1
sta jump+2
; Disable interrupts now because setting the slot number makes
; Disable interrupts now because setting the slot number makes
; the IRQ handler (maybe called due to some non-mouse IRQ) try
; calling the firmware which isn't correctly set up yet
sei
@ -167,7 +167,7 @@ next: inc ptr1+1
asl
asl
sta yparam+1
; The AppleMouse II Card needs the ROM switched in
; to be able to detect an Apple //e and use RDVBL
bit $C082
@ -175,7 +175,7 @@ next: inc ptr1+1
; Reset mouse hardware
ldx #INITMOUSE
jsr firmware
; Switch in LC bank 2 for R/O
bit $C080
@ -236,12 +236,12 @@ UNINSTALL:
SETBOX:
sta ptr1
stx ptr1+1
; Set x clamps
ldx #$00
ldy #MOUSE_BOX::MINX
jsr :+
; Set y clamps
ldx #$01
ldy #MOUSE_BOX::MINY
@ -257,7 +257,7 @@ SETBOX:
sta pos1_lo
iny
lda (ptr1),y
sta box,y
sta box,y
sta pos1_hi
; Skip one word
@ -267,11 +267,11 @@ SETBOX:
; Set high clamp
iny
lda (ptr1),y
sta box,y
sta box,y
sta pos2_lo
iny
lda (ptr1),y
sta box,y
sta box,y
sta pos2_hi
txa

View File

@ -57,7 +57,7 @@ extern char _cwd[FILENAME_MAX];
DIR* __fastcall__ opendir (register const char* name)
DIR* __fastcall__ opendir (register const char* name)
{
register DIR* dir;

View File

@ -111,4 +111,4 @@ errno: jmp __directerrno
; Set __oserror
oserr: jmp __mappederrno

View File

@ -63,7 +63,7 @@ L1: lda #<brk_handler ; Set the break vector to our routine
lda #$00
sta oldvec ; Clear the old vector
stx oldvec+1
@L9: rts
@L9: rts
.endproc

View File

@ -17,7 +17,7 @@ _cclearxy:
_cclear:
cmp #0 ; Is the length zero?
beq L9 ; Jump if done
sta tmp1
sta tmp1
L1: lda #0 ; Blank - screen code
jsr cputdirect ; Direct output
dec tmp1

View File

@ -12,7 +12,7 @@
.include "ctypetable.inc"
.export __ctypeidx
; The tables are readonly, put them into the rodata segment
.rodata

View File

@ -5,7 +5,7 @@
; void cvline (unsigned char length);
;
.include "atari.inc"
.export _cvlinexy, _cvline
.import gotoxy, putchar, setcursor
.importzp tmp1

View File

@ -137,7 +137,7 @@ _dio_open:
iny
lda #1
finish: sta (ptr2),y ; set default sector size
finish: sta (ptr2),y ; set default sector size
fini2: lda ptr2
ldx ptr2+1
rts

View File

@ -12,7 +12,7 @@
.proc _dio_query_sectsize
sta ptr1 ; handle
stx ptr1+1
stx ptr1+1
lda #0
sta __oserror

View File

@ -12,7 +12,7 @@
.ifdef __ATARIXL__
_doesclrscrafterexit = return1 ; the c65 runtime always clears the screen at program termination
.else
.else
_doesclrscrafterexit:
jsr __is_cmdline_dos ; currently (unless a DOS behaving differently is popping up)
eor #$01 ; we can get by with the inverse of __is_cmdline_dos

View File

@ -11,7 +11,7 @@
; Bit 2: bank control
; Bit 1: BASIC on/off
; Bit 0: OS RAM on/off
;
;
; Masks: %11100011 $E3 Bank 0
; %11100111 $E7 Bank 1
; %11101011 $EB Bank 2
@ -67,7 +67,7 @@
; Constants
BANK = $4000 ; bank window
STACK = $0100 ; stack location
STACK = $0100 ; stack location
PAGES = 256 ; 4 x 16k banks
@ -93,17 +93,17 @@ stacktest: sei
@2: sta $4000 ; restore
cli
rts
stacktest_end:
stacktest_end:
stackcopy: sei ; disable interrupts
@1: dex ; pre-decrement (full page x=0)
ldy #$FF ; this will be replaced STACK+3
sty $D301 ; set bank
sty $D301 ; set bank
lda $FF00,x ; address to copy from STACK+8,+9
ldy #$FF ; this will be replaced STACK+11
sty $D301
sty $D301
sta $FF00,x ; address to copy to STACK+16,+17
cpx #0
cpx #0
bne @1
ldy #$FF ; portb_save STACK+23
sty $D301
@ -122,7 +122,7 @@ stackcopy_byte: sei
sty $D301
cli
rts
stackcopy_byte_end:
stackcopy_byte_end:
.data
@ -186,14 +186,14 @@ setpage:
INSTALL:
lda $D301 ; save state of portb
sta portb_save
tay
tay
jsr install_test ; doesn't touch Y
sty STACK+13
lda $4000 ; test for extended memory
jsr STACK
bcs @1
bcs @1
lda #EM_ERR_OK
rts
@1: lda #EM_ERR_NO_DEVICE
@ -242,7 +242,7 @@ MAP: jsr setpage ; extract the bank/page
lda banks,x
sta STACK+3 ; set bank to copy from
; lda ptr1
; sta STACK+8
; sta STACK+8
lda ptr1+1
sta STACK+9 ; set copy from address
lda portb_save
@ -251,10 +251,10 @@ MAP: jsr setpage ; extract the bank/page
lda ptr2
sta STACK+16
lda ptr2+1
sta STACK+17 ; set copy to address
sta STACK+17 ; set copy to address
ldx #0 ; full page copy
jsr STACK ; do the copy!
jsr STACK ; do the copy!
; Return the memory window
@ -298,7 +298,7 @@ COMMIT: lda curpage ; Get the current page
sta STACK+3 ; set bank to copy from
sta STACK+23 ; set final portb restore
lda ptr1
sta STACK+8
sta STACK+8
lda ptr1+1
sta STACK+9 ; set copy from address
ldx curbank
@ -307,10 +307,10 @@ COMMIT: lda curpage ; Get the current page
;lda ptr2
;sta STACK+16
lda ptr2+1
sta STACK+17 ; set copy to address
sta STACK+17 ; set copy to address
ldx #0 ; full page copy
jsr STACK ; do the copy!
jsr STACK ; do the copy!
commit_done:
rts
@ -329,7 +329,7 @@ COPYFROM:
ldy #EM_COPY::OFFS
lda (ptr3),y
sta STACK+7 ; offset goes into BANK low
sta STACK+7 ; offset goes into BANK low
ldy #EM_COPY::PAGE
lda (ptr3),y
@ -357,9 +357,9 @@ COPYFROM:
add #>BANK ; add to BANK address
sta STACK+8 ; current page in bank
ldx curbank
lda banks,x
sta STACK+2 ; set bank in stack
lda portb_save
lda banks,x
sta STACK+2 ; set bank in stack
lda portb_save
sta STACK+10 ; set bank restore in stack
sta STACK+18 ; set final restore too
@ -399,7 +399,7 @@ copyfrom_copy:
bne @3
inc STACK+16
@3: jmp copyfrom_copy ; copy another byte
@3: jmp copyfrom_copy ; copy another byte
done:
rts
@ -418,7 +418,7 @@ COPYTO:
ldy #EM_COPY::OFFS
lda (ptr3),y
sta STACK+15 ; offset goes into BANK low
sta STACK+15 ; offset goes into BANK low
ldy #EM_COPY::PAGE
lda (ptr3),y
@ -446,9 +446,9 @@ COPYTO:
add #>BANK ; add to BANK address
sta STACK+16 ; current page in bank
ldx curbank
lda banks,x
sta STACK+10 ; set bank in stack
lda portb_save
lda banks,x
sta STACK+10 ; set bank in stack
lda portb_save
sta STACK+2 ; set bank restore in stack
sta STACK+18 ; set final restore too
@ -488,5 +488,5 @@ copyto_copy:
bne @3
inc STACK+8
@3: jmp copyto_copy ; copy another byte
@3: jmp copyto_copy ; copy another byte

View File

@ -74,7 +74,7 @@ prep:
jsr getcursor ; Get character at cursor position
cmp #mouse_txt_char ; "mouse" character
bne overwr ; no, probably program has overwritten it
lda backup ;
lda backup ;
jmp setcursor ; Draw character
overwr: sta backup
rts

View File

@ -10,7 +10,7 @@
.include "atari.inc"
__randomize:
__randomize:
ldx VCOUNT ; Use vertical line counter as high byte
lda RTCLOK+2 ; Use clock as low byte
jmp _srand ; Initialize generator

View File

@ -4,7 +4,7 @@
; unsigned char revers (unsigned char onoff);
;
.include "atari.inc"
.export _revers
.export _revflag

View File

@ -737,9 +737,9 @@ fn_cont:jsr get_fn_len
lda #0
sta ICBLH,x
jsr chk_CIO_buf
pla
pla
sta ICBLH,x
pla
pla
sta ICBLL,x
pla
tay
@ -756,7 +756,7 @@ chk_CIO_buf:
lda ICBAH,x
cmp #$c0
bcc @cont
@ret:
@ret:
.ifdef DEBUG
jsr CIO_buf_noti
.endif

View File

@ -93,7 +93,7 @@ sdnobw: lda DOS+1 ; SD version
ldy #31 ; offset for OSRMFLG
lda (DOSVEC),y ; get OSRMFLG
bne sdcrts1
sdcrts0:clc
rts
sdcrts1:sec

View File

@ -7,7 +7,7 @@
; It calculates the value to put into RAMTOP for a subsequent
; "GRAPHICS 0" call, and the lowest address which will be used
; by the screen memory afterwards.
;
;
; inputs:
; __STARTADDRESS__ - load address of the program
; outputs:

View File

@ -74,7 +74,7 @@ conio_color: .res 1
dlist: .repeat 3
.byte DL_BLK8
.endrepeat
.byte DL_CHR20x8x2 | DL_LMS
.word SCREEN_BUF

View File

@ -5,7 +5,7 @@
; void cvline (unsigned char length);
;
.include "atari5200.inc"
.export _cvlinexy, _cvline
.import gotoxy, putchar
.importzp tmp1

View File

@ -74,7 +74,7 @@ conio_color: .res 1
dlist: .repeat 3
.byte DL_BLK8
.endrepeat
.byte DL_CHR20x16x2 | DL_LMS
.word SCREEN_BUF

View File

@ -44,7 +44,7 @@
;
INSTALL:
lda #$04 ; enable POT input from the joystick ports, see section "GTIA" in
lda #$04 ; enable POT input from the joystick ports, see section "GTIA" in
sta CONSOL ; http://www.atarimuseum.com/videogames/consoles/5200/conv_to_5200.html
lda #JOY_ERR_OK
ldx #0

View File

@ -10,7 +10,7 @@
.include "atari5200.inc"
__randomize:
__randomize:
ldx VCOUNT ; Use vertical line counter as high byte
lda RTCLOK+1 ; Use clock as low byte
jmp _srand ; Initialize generator

View File

@ -9,16 +9,16 @@ Y2K LDY #$00 ; Copy BIOS opening screen to RAM
CPX #$E8 ; Is this a 4 port?
BNE Y2K0 ; Jump if not
LDA #$42 ; Yes, 4 port system
Y2K0 STA TEMPL
Y2K1 LDA (TEMPL),Y
Y2K0 STA TEMPL
Y2K1 LDA (TEMPL),Y
STA $0600,Y
INY
INY
BNE Y2K1
LDY #$50
INC TEMPH
Y2K2 LDA (TEMPL),Y
Y2K2 LDA (TEMPL),Y
STA $0700,Y
DEY
DEY
BPL Y2K2
LDA #$D4 ; Point to copyright string
STA $0724
@ -26,8 +26,8 @@ Y2K2 LDA (TEMPL),Y
STA $0725
LDX #$0B ; Store NOP's @ end
LDA #$EA
Y2K3 STA $0732,X
DEX
Y2K3 STA $0732,X
DEX
BPL Y2K3
LDA #$60 ; Store RTS opcode @ end
STA $0750

69
libsrc/atari7800/clock.s Normal file
View File

@ -0,0 +1,69 @@
;
; 2022-03-15, Karri Kaksonen
;
; clock_t clock (void);
;
.export _clock, clock_count
.interruptor update_clock, 2 ; (low priority)
.constructor init_clock
.import sreg: zp
.import _zonecounter
.include "atari7800.inc"
.macpack generic
.code
;-----------------------------------------------------------------------------
; Read the clock counter.
;
.proc _clock
lda #0
sta sreg+1 ; Promote 24 bits up to 32 bits
lda clock_count+2
sta sreg
ldx clock_count+1
lda clock_count
rts
.endproc
;-----------------------------------------------------------------------------
; This interrupt handler increments a 24-bit counter at every video
; vertical-blanking time.
; Update the clock only on interrupt while the drawing on screen is on
; _zonecounter == 1 (from 1st visible scanline to last visible scanline)
;
update_clock:
lda _zonecounter
and #01
beq @L1
inc clock_count
bne @L1
inc clock_count+1
bne @L1
inc clock_count+2
@L1: ;clc ; General interrupt was not reset
rts
;-----------------------------------------------------------------------------
; Set time to zero at startup
;
.segment "ONCE"
init_clock:
lda #0
sta clock_count+2
sta clock_count+1
sta clock_count
rts
;-----------------------------------------------------------------------------
; Store time in 3 bytes
;
.bss
clock_count:
.res 3

View File

@ -0,0 +1,34 @@
;
; 2022-03-15, Karri Kaksonen
;
; clock_t _clocks_per_sec (void);
;
.export __clocks_per_sec
.import sreg: zp
.import _paldetected
.include "atari7800.inc"
.macpack generic
.code
;-----------------------------------------------------------------------------
; Return the number of clock ticks in one second.
;
.proc __clocks_per_sec
lda #0
tax
sta sreg ; return 32 bits
sta sreg+1
lda _paldetected
bne pal
lda #60 ; NTSC - 60Hz
rts
pal:
lda #50 ; PAL - 50Hz
rts
.endproc

71
libsrc/atari7800/crt0.s Normal file
View File

@ -0,0 +1,71 @@
.export _zonecounter
.export __STARTUP__ : absolute = 1
.export _exit
.import __ROM_START__
.import __RAM3_START__, __RAM3_SIZE__
.import initlib, donelib
.import zerobss, copydata
.import IRQStub
.import push0, _main
.include "atari7800.inc"
.include "zeropage.inc"
INPTCTRL = $01
.segment "STARTUP"
start:
; Startup sequence recommended by Atari.
; See the 7800 standards document.
sei ; Initialize 6502
cld
lda #$07 ; Lock machine in 7800 mode
sta INPTCTRL
lda #$7f ; DMA off
sta CTRL
ldx #0 ; OFFSET must always be 0
stx OFFSET
stx INPTCTRL ; Make sure joysticks don't freeze
dex ; Stack pointer = $ff
txs
; Set up parameter stack
lda #<(__RAM3_START__ + __RAM3_SIZE__)
sta sp
lda #>(__RAM3_START__ + __RAM3_SIZE__)
sta sp+1
jsr copydata
jsr zerobss
jsr initlib
; Call main program (pass empty command line)
jsr push0 ; argc
jsr push0 ; argv
ldy #4 ; Argument size
jsr _main
_exit:
jsr donelib
jmp start
NMIHandler:
inc _zonecounter
jmp IRQStub
IRQHandler:
rti
.segment "DATA"
_zonecounter:
.byte 0
.segment "ENCRYPTION"
.res 126, $ff ; Reserved for encryption
Lfff8: .byte $ff ; Region verification (always $ff)
Lfff9: .byte $f7 ; Use last 4096 bytes only for encryption
;;;Lfff9: .byte <(((__ROM_START__/4096)<<4) | 7)
.segment "VECTORS"
.word NMIHandler
.word start
.word IRQHandler

5
libsrc/atari7800/ctype.s Normal file
View File

@ -0,0 +1,5 @@
; Character specification table.
;
; uses the "common" definition
.include "ctype_common.inc"

46
libsrc/atari7800/exehdr.s Normal file
View File

@ -0,0 +1,46 @@
;
; Karri Kaksonen, 2022
;
; This header contains data for emulators
;
.export __EXEHDR__: absolute = 1
.import __CARTSIZE__
; ------------------------------------------------------------------------
; EXE header
.segment "EXEHDR"
.byte 3 ; version
.byte 'A','T','A','R','I','7','8','0','0',' ',' ',' ',' ',' ',' ',' '
.byte 'G','a','m','e',' ','n','a','m','e',0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,>__CARTSIZE__,0 ; Set the cart size in the cfg file
; bit 0 - pokey at 4000
; bit 1 - supergame bank switched
; bit 2 - supergame ram at $4000
; bit 3 - rom at $4000
; bit 4 - bank 6 at $4000
; bit 5 - supergame banked ram
; bit 6 - pokey at $450
; bit 7 - mirror ram at $4000
; bit 8 - activision banking
; bit 9 - absolute banking
; bit 10 - pokey at $440
; bit 11 - ym2151 at $461/462
; bit 12 - souper
; bit 13-15 - Special
; 0 = Normal cart
.byte 0,0 ; 0 = Normal cart
.byte 1 ; 1 = Joystick, 2 = lightgun
.byte 0 ; No joystick 2
.byte 0 ; bit0 = 0:NTSC,1:PAL bit1 = 0:component,1:composite
.byte 0 ; Save data peripheral - 1 byte (version 2)
; 0 = None / unknown (default)
; 1 = High Score Cart (HSC)
; 2 = SaveKey
.byte 0 ; 63 Expansion module
; 0 = No expansion module (default on all currently released games)
; 1 = Expansion module required
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 'A','C','T','U','A','L',' ','C','A','R','T',' ','D','A','T','A',' ','S','T','A','R','T','S',' ','H','E','R','E'

65
libsrc/atari7800/get_tv.s Normal file
View File

@ -0,0 +1,65 @@
;
; Karri Kaksonen, 2022-03-25
;
; unsigned char get_tv (void)
;
.include "atari7800.inc"
.include "get_tv.inc"
.export _get_tv
.export _paldetected
.segment "DATA"
_paldetected:
.byte $FF
; ---------------------------------------------------------------
; unsigned char get_tv (void)
; ---------------------------------------------------------------
.segment "CODE"
.proc _get_tv: near
.segment "CODE"
ldx #$00
lda #$FF
cmp _paldetected
bne L8
L1: lda MSTAT
and #$80
bne L1
L2: lda MSTAT
and #$80
beq L2
L3: lda MSTAT
and #$80
bne L3
lda #$00
sta M0001
jmp L5
L4: sta MWSYNC
sta MWSYNC
dec M0001
L5: lda MSTAT
and #$80
beq L4
lda M0001
cmp #$78
bcc L6
lda #TV::NTSC
jmp L7
L6: lda #TV::PAL
L7: sta _paldetected
ldx #$00
L8: lda _paldetected
rts
.segment "BSS"
M0001:
.res 1,$00
.endproc

36
libsrc/atari7800/irq.s Normal file
View File

@ -0,0 +1,36 @@
;
; IRQ handling (Atari 7800 version)
;
.export initirq, doneirq, IRQStub
.import __INTERRUPTOR_COUNT__, callirq
.include "atari7800.inc"
.code
; ------------------------------------------------------------------------
initirq:
doneirq:
rts
; ------------------------------------------------------------------------
IRQStub:
cld ; Just to be sure
pha
lda #<(__INTERRUPTOR_COUNT__ * 2)
beq @L1
txa
pha
tya
pha
jsr callirq ; Call the functions
pla
tay
pla
tax
@L1: pla
rti

Some files were not shown because too many files have changed in this diff Show More