1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-03 22:29:31 +00:00
Commit Graph

178 Commits

Author SHA1 Message Date
Florent Flament
c1aac0de0e Add C support for Atari 2600 (VCS) 2017-01-13 21:12:22 +01:00
Marshall Ward
09495519c0 NES memory map amend (16k prg, 8k chr default)
The configuration file and runtime (crt0.s) provided for the default NES
ROM layout (2x16k PRG, 8k CHR) incorrectly added interrupts (IRQ1, IRQ2,
TIMERIRQ) which are not supported by the NES hardware.  For example, see
the NESdev wiki, which makes no reference to these interrupts.

    https://wiki.nesdev.com/w/index.php/CPU_memory_map

The VECTORS region was also incorrectly set to 0xFFF6, which would have
left the 0xFFF4 normally unspecified.  This did not result in any error,
however, since cc65 simply placed ROMV directly after ROM0 regardless of
start address.

(This layout may be due to a copy-and-paste from the PC-Engine
configuration, whose interrupt registers start at 0xFFF6, begins with
the three interrupts listed above, followed by NMI and START, and does
not end with a final IRQ interrupt.)

Despite the absence of any actual error, since START is still placed at
0xFFFC, this patch removes the nonexistent interrupts and also correctly
aligns the ROM0 and ROMV regions.  It also has the (admittedly very
minor) benefit of freeing up 6 additional bytes for ROM0.
2016-12-24 08:32:54 +11:00
Alex Thissen
601c6102e8 Fixed last linefeed and notation convention errors. 2016-09-13 22:02:37 +02:00
Alex Thissen
ef7e9db116 Changed __BLOCKSIZE__ to __BANK0BLOCKSIZE__.
Added __BANK1BLOCKSIZE__ which defaults to 0.
2016-09-11 22:26:52 +02:00
Christian Groessler
e2d14291b7 make BSS segment optional in atari-cassette.cfg 2016-05-25 01:29:00 +02:00
Greg King
7773fcb1e1 Converted the Atmos configuration to the new constructor segment model. 2016-03-18 11:28:56 -04:00
Oliver Schmidt
78dcb61cb8 Harmonized asm linker configs.
- All segments but CODE are optional and CODE is R/W. Both together allow to "just" write code/data without ever explicitly using a segment.

- Symbols are defined for the BSS. This allows to use/implement zerobss.

- The ZP memory area isn't artificially limited.
2016-03-17 21:51:20 +01:00
Oliver Schmidt
d5092d2d3f Consider the segment attributes 'define' and 'optional' mutually exclusive.
In normal situations it isn't too useful to define symbols for optional segments as those symbols can't be presumed to be always present.

I in fact suspect that most currently present combinations of 'define' and 'optional' aren't useful - apart form the overlay configurations of course.
2016-03-17 21:31:43 +01:00
Oliver Schmidt
e3cbc7e8b8 Moved run location of ONCE segment.
Make the same changes to the Apple II that were done with 0ee9b2e446 to the C64.

Notes:
- The startup code deliberately doesn't make use of symbols defined for the LC segment as that segment is optional.
- The <...>-asm.cfg configs move the segment BSS to an own memory area BSS although this doesn't seem necessary. However the benefit is that the size of the memeory area MAIN is identical to the number of bytes loaded from disk into RAM. To keep this an invariant for all Apple II configs allows to simplify the EXEHDR to just refer to the symbols defined for MAIN.
2016-03-17 21:07:19 +01:00
Oliver Schmidt
1d1ba3ed3b Adjusted constructors.
The constructors are _NOT_ allowed anymore to access the BSS. Rather they must use the DATA segment or the INIT segment. The latter isn't cleared at any point so the constructors may use it to expose values to the main program. However they must make sure to always write the values as they are not pre-initialized.
2016-03-16 16:28:32 +01:00
Oliver Schmidt
3d6cbec6a1 Adjust linker config to match startup code.
Apply aaf90c1252 to the Supervision default configuration.
2016-03-16 16:00:09 +01:00
Oliver Schmidt
4270b8a96c Fixed segment properties.
The CBMx10 targets don't use the INIT segment in the startup code. So it may turn out to be not necessary at all for certain programs.

The CBMx10 targets don't need symbols for the ONCE segment. Likely their definition was a C&P error in the first place.
2016-03-15 22:55:39 +01:00
Oliver Schmidt
0edd05b4bf Removed symbol definition for ONCE.
Almost all targets don't need symbols for the ONCE segment. Likely their definition was a C&P error in the first place.
2016-03-15 22:55:34 +01:00
Oliver Schmidt
46d4307bbb Removed ONCE segment.
Pure assembler programs don't have constructors. Therefore constructor code ending up in an assembler program should trigger an error.
2016-03-15 22:55:32 +01:00
Oliver Schmidt
c768de156a Fixed INIT properties.
The main chunk load header references __BSS_LOAD__ so BSS must be the first bss type segment. Subsequent changes will move ONCE to share its address with the BSS. Then it'll be necessary to load INIT from disk. Therefore we do it right now.
2016-03-13 22:18:51 +01:00
Oliver Schmidt
692f96409d Fixed BSS properties.
The cassette boot file header references __BSS_RUN__ so BSS must be the first bss type segment (and for sure isn't optional).
2016-03-13 22:13:41 +01:00
Oliver Schmidt
a3a22733f8 Cleaned up C64 linker configs.
The BSS segment and the ONCE segment share the same start address. So they need to be placed in two different memory areas.

So far BSS was placed in the MAIN memory area and ONCE was placed in an additional memory area. Both memory areas were written to the output file. They just "happened" to be loadable and runnable at a stretch.

Now ONCE is placed in the MAIN memory area and BSS is placed in an additional memory area. Only MAIN is written to the output file. It becomes more obvious that BSS is "just" defined to share memory with ONCE.
2016-03-13 14:32:07 +01:00
Oliver Schmidt
d8c31cf1d3 Renamed RAM to MAIN for all disk based targets.
The name RAM doesn't make much sense in general for a memeory area because i.e. the zero page is for sure RAM but is not part of the memory area named RAM.

For disk based targets it makes sense to put the disk file more into focus and here MAIN means the main part of the file - in contrast to some header.

Only for ROM based targets the name RAM is kept as it makes sense to focus on the difference between RAM and ROM.
2016-03-07 01:28:55 +01:00
Oliver Schmidt
419eb700b5 Renamed INITBSS to INIT and INIT to ONCE.
The way we want to use the INITBSS segment - and especially the fact that it won't have the type bss on all ROM based targets - means that the name INITBSS is misleading. After all INIT is the best name from my perspective as it serves several purposes and therefore needs a rather generic name.

Unfortunately this means that the current INIT segment needs to be renamed too. Looking for a short (ideally 4 letter) name I came up with ONCE as it contains all code (and data) accessed only once during initialization.
2016-03-06 21:27:19 +01:00
Oliver Schmidt
3d08abcfa8 Load INITBSS segment from disk.
Conceptually the INITBSS segment is not initialized in any way. Therefore it makes sense to not load it from disk. However the INIT segment has to be loaded from disk and therefore moved to its run location above the INITBSS segment. The necessary move routine increases runtime RAM usage :-(

Therefore we now "unnecessarily" load the INITBSS segment from disk too meaning that the INIT segment is loaded at its run location. Therefore there's no need for the move routine anymore.

After all we trade disk space for (runtime) RAM space - an easy decision ;-)

Notes:

- The code allowing to re-run a program without re-load present so far could not have worked as far as I can see as it only avoided to re-run the move routine but still tried to re-run the code in the INIT segment that was clobbered by zeroing the BSS. Therefore I removed the code in question altogether. I'm personally not into this "dirty re-run" but if someone wants to add an actually working solution I won't block that.

- INITBSS is intentionally not just merged with the DATA segment as ROM-based targets can't reuse the INIT segment for the BSS and therefore have no reason to place the INIT segment above INITBSS.

- Because ROM-based targets don't copy INITBSS from the ROM (like it is done with the DATA segment) all users of INITBSS _MUST_NOT_ presume INITBSS to be initialized with zeros!
2016-02-28 19:45:36 +01:00
Oliver Schmidt
54e09fdd03 Added basic frame for new target 'creativision'.
Kym Greenshields <kym.greenshields@gmail.com> has expressed interest
in contributing and maintaining support for the VTech CreatiVision system.

this resembles commit 8e6b8dd0af from oliver
2016-02-28 19:05:40 +01:00
mrdudz
b39a8b7a61 more cleanup 2015-11-29 20:04:10 +01:00
mrdudz
c636675521 moved cart header into seperate file, moved nmi stub into several file, tweaked linker config 2015-11-29 16:01:36 +01:00
mrdudz
9fbf8a4299 conio and most other stuff working now 2015-11-29 01:14:59 +01:00
mrdudz
88e7b5776a some more fiddling 2015-11-22 19:02:47 +01:00
mrdudz
60285097e3 initial import of the gamate stuff 2015-11-14 13:15:29 +01:00
Oliver Schmidt
76a5a72403 Adjusted current working directory initialization on Apple and Atari.
Moving __cwd from BSS into INITBSS does of course ;-) not only impact the CBM targets but all targets with disk I/O support.

Note: Code using `__cwd-1` may trigger an ld65 range error because __cwd may end up at the very begining of a segment. As far as I see this is an ld65 bug which I'm not try to fix - at least here.
2015-10-15 00:15:38 +02:00
Oliver Schmidt
0ee9b2e446 Changed run location of INIT segment.
So far the INIT segment was run from the later heap+stack. Now the INIT segment is run from the later BSS. The background is that so far the INIT segment was pretty small (from $80 to $180 bytes). But upcoming changes will increase the INIT segment in certain scenarios up to ~ $1000 bytes. So programs with very limited heap+stack might just not been able to move the INIT segment to its run location. But moving the INIT segment to the later BSS allows it to occupy the later BSS+heap+stack.

In order to allow that the constructors are _NOT_ allowed anymore to access the BSS. Rather they must use the DATA segment or the new INITBSS segment. The latter isn't cleared at any point so the constructors may use it to expose values to the main program. However they must make sure to always write the values as they are not pre-initialized.
2015-10-14 22:52:09 +02:00
Greg King
8b89f4f5a6 Reduced c64-overlay.cfg's size by factoring out a different common expression. 2015-10-08 06:11:37 -04:00
Greg King
ca70700a0b Restored the old C-stack initiation code.
I had forgotten that the stack must be put below the CBM overlays.
2015-10-08 06:04:49 -04:00
Greg King
8a880580dc Reduced the size of the moveinit subroutine.
Made other changes that were recommended by Oliver.
* Changed its name from move_init to moveinit.
* Used self-modifying code in the subroutine.
* The INIT segment doesn't need to be optional (it's used by the start-up file).
2015-10-07 14:56:14 -04:00
Greg King
074e10d288 Adapted, to the c64 target, the INIT-segment overlay scheme from the apple2 targets.
When a program starts running, INIT is moved from one place to another place.  Then, INIT's code is executed; and, the first place is re-used for variables.  After the INIT code has finished, the second place can be re-used by the heap and the C stack.  That means that initiation code and data won't waste any RAM space after they stop being needed.
2015-10-05 05:47:43 -04:00
mrdudz
296489ba6c added interruptor support 2015-09-19 15:55:43 +02:00
mrdudz
859604407b fixed more flaws found by greg :) 2015-09-19 15:37:39 +02:00
mrdudz
9e1d39a409 more cleanup and fixing 2015-07-12 16:40:52 +02:00
mrdudz
891cb97b2f more cleanup, joystick works again 2015-07-12 14:27:24 +02:00
mrdudz
21999b081f simple conio test works again 2015-07-12 10:32:55 +02:00
mrdudz
877fd532c2 Merge remote-tracking branch 'upstream/master' into pcenginetarget 2015-07-11 13:05:26 +02:00
Stephan Mühlstrasser
b4bab018ac More room by default for zero-page data. 2015-03-23 18:42:25 +01:00
Stephan Mühlstrasser
72a9e331e3 Fixed uninitialized use of low byte of address "load". 2015-03-14 00:01:12 +01:00
Greg King
87bce0d56b Changed a comment in the osic1p configure files. 2015-03-09 06:17:28 -04:00
Greg King
2d50267bd8 Added a second OSI C1P program file format.
Unlike the first format, the new format is already loadable; it doesn't need to be converted.
2015-03-07 16:39:44 -05:00
Stephan Mühlstrasser
222668c016 Implemented a one-character buffer for kbhit() and cgetc().
If kbhit() detects that a key is pressed, it fetches and
buffers the character. If cgetc() detects a buffered character,
this one is returned instead of fetching one with the PROM
routine.
2015-02-21 20:24:58 +01:00
Stephan Mühlstrasser
94f83ea439 Replace zeropage variable with standard tmp variable. 2015-02-12 21:29:19 +01:00
Stephan Mühlstrasser
679f5aa675 Use constants for screen width and height. 2015-02-12 20:54:47 +01:00
Stephan Mühlstrasser
5063e0ecca Incorporated feedback for initial pull request. 2015-02-11 19:21:17 +01:00
Stephan Mühlstrasser
4e03d7448c Merge branch 'master' of https://github.com/cc65/cc65 into c1p 2015-02-08 15:58:42 +01:00
Stephan Mühlstrasser
14c7e9fd16 Rename c1p target to osic1p 2015-02-03 22:42:35 +01:00
Stephan Mühlstrasser
19b3c1b32b Configuration file for assembler-only build. 2015-01-31 22:45:18 +01:00
Stephan Mühlstrasser
b1f764bdc9 Minor cleanup of unnecessary newlines. 2015-01-11 20:08:39 +01:00
Greg King
43342366ed Added comments that say why the ZPSAVE1 and ZPSAVE2 segments must be together. 2015-01-08 17:07:28 -05:00
Greg King
22e06c41d1 Fixed a bug that had padded Atmos binaries with 25 bytes too many. 2015-01-08 03:51:20 -05:00
Stephan Mühlstrasser
073b4c264a Set default RAM size to 32 kB.
8 kB RAM are very small for "interesting" programs
compiled with cc65. Therefore set the default
RAM size to 32 kB.
2015-01-05 20:37:23 +01:00
Stephan Mühlstrasser
8fa5fc6108 Restructured according to coding conventions. 2015-01-02 20:28:36 +01:00
Greg King
d9df576fa6 Used an easier-to-remember way of creating a program that uses graphics RAM for other purposes. 2014-12-13 09:52:39 -05:00
mrdudz
1365afa845 more hacking 2014-11-30 11:20:57 +01:00
Stephan Mühlstrasser
67707f342d Set default start address to 0x200 2014-11-29 20:56:49 +01:00
Stephan Mühlstrasser
ac88639f4a Implemented cursor functionality. 2014-11-29 20:07:30 +01:00
mrdudz
4275b82117 added compiler/assembler target, lib compiles 2014-11-29 15:35:20 +01:00
Stephan Mühlstrasser
0a6afb59c0 Switch to assembler for cputc implementation. 2014-11-22 01:07:55 +01:00
Stephan Mühlstrasser
6edf57324e Set default start address to 0x300.
Make start address configurable via --start-addr.
2014-11-16 20:07:59 +01:00
Greg King
09e50d433d * Changed the way that Atmos programs are started.
- Put a BASIC-language stub at the beginning.
  - Removed the Autostart flag.

  Those changes make it easy to give command-line arguments to a program.

* Made the Atmos configure file accept a special symbol definition on ld65's command line.  We can use "__RAMEND__" to increase the amount of RAM that's available to programs.
2014-11-09 06:32:11 -05:00
Stephan Mühlstrasser
0b186407f1 Merge https://github.com/cc65/cc65 into c1p 2014-11-02 16:17:16 +01:00
Oliver Schmidt
99f0a56f63 Merge pull request #122 from groessler/a5200
new target: Atari 5200 console
2014-05-30 22:52:51 +02:00
Christian Groessler
d9a8ea3b6c Don't reserve space for display list in __RESERVED_MEMORY__ since the
default display list is in ROM.
2014-05-27 02:43:17 +02:00
Oliver Schmidt
9056e41f7f Reintroduced optional INIT segment for (weird) NES TGI driver. 2014-05-01 22:12:05 +02:00
Oliver Schmidt
d6c3bd29ac Renamed JUMPTABLE and cleaned up module.cfg.
This change was suppsed to fix the issue that the former JUMPTABLE is merked as 'ro' while it is actually written to in several scenarios. When drivers are converted using co65 and then compiled into ROMs the JUMPTABLE isn't copied to RAM and therefore the write operations in question fail.

However unfortunately I didn't succeed in changing that :-( Just setting the former JUMPTABLE to 'rw' broke the drivers. So I placed the DATA segment directly after the former JUMPTABLE segment. This made the drivers converted with co65 work again - obviously after changing libsrc/Makefile:235 from '--code-label' to '--data-label'. But the actual dynamic drivers still didn't work as the former JUMPTABLE wasn't placed as the beginning of the loaded file anymore. That effect could be changed by exchanging src/ld65/o65.c:1391 with src/ld65/o65.c:1394 but doing so broke the drivers again :-((
2014-05-01 21:44:39 +02:00
Oliver Schmidt
73a50ae3c0 Made LOWCODE and INIT optional (like the other targets). 2014-04-28 22:14:26 +02:00
Christian Groessler
92b32d7d0e atari5200 update: simple conio "hello world" works now 2014-04-25 03:02:44 +02:00
Christian Groessler
f266612697 Merge remote-tracking branch 'upstream/master' into a5200 2014-03-20 00:24:11 +01:00
Karri Kaksonen
100ecb0a45 Use LOWCODE segment 2014-03-19 11:32:44 +02:00
Christian Groessler
84c655a907 use __RESERVED_MEMORY__ to reserve memory for the default 20x24 text screen 2014-03-13 02:36:10 +01:00
Christian Groessler
c8f7f2f161 first changes for atari5200 target 2014-03-01 17:20:09 +01:00
Christian Groessler
4b58a20b8c Increase the default start address a bit in case BASIC is started
('OPTION' not pressed at power on). It would otherwise overwrite parts
at the beginning.
2014-02-21 23:34:05 +01:00
Christian Groessler
81fe7a3805 cleanups; split 'header' and 'init' part into two source files 2014-02-21 22:43:44 +01:00
Christian Groessler
478da8e51f load CASHDR segment into RAM 2014-02-20 00:45:48 +01:00
Christian Groessler
3bd5d3f88b Merge remote-tracking branch 'upstream/master' into cassette
Conflicts:
	asminc/atari.inc
	libsrc/atari/mou/atrst.s
2014-01-30 10:48:13 +01:00
Christian Groessler
0fa8960836 add EXTZP segment to atari-asm.cfg 2014-01-22 18:15:52 +01:00
Christian Groessler
f614a75717 add ZEROPAGE segment to apple2-asm.cfg and c64-asm.cfg 2014-01-22 18:15:51 +01:00
Christian Groessler
ca9fb8b6ed make "ZEROPAGE" segment optional 2014-01-22 13:26:05 +01:00
Christian Groessler
f091d0b3cd Merge branch 'master' of https://github.com/oliverschmidt/cc65 into cassette 2014-01-17 23:06:29 +01:00
Christian Groessler
40e49074a4 add support for 16K cartridges 2014-01-17 20:10:28 +01:00
Christian Groessler
5a404b6786 fix last change 2014-01-16 23:56:32 +01:00
Christian Groessler
94df0e8ef4 made more segments optional so that the config file can be used for assembler programs, too 2014-01-16 23:56:32 +01:00
Christian Groessler
b237bb9d9a Add support to create cartridges. 2014-01-14 22:53:49 +01:00
Christian Groessler
057884ffa9 Atari: initial support to create cassette bootable programs -- unfinished 2014-01-02 19:28:22 +01:00
Oliver Schmidt
0a8efc9fc3 Revert "Added basic frame for new target 'creativision'."
This reverts commit 8e6b8dd0af.
2013-12-05 21:45:20 +01:00
Oliver Schmidt
8e6b8dd0af Added basic frame for new target 'creativision'.
Kym Greenshields <kym.greenshields@gmail.com> has expressed interest
in contributing and maintaining support for the VTech CreatiVision system.
2013-11-25 22:52:04 +01:00
Stephan Mühlstrasser
9fd27d6ef6 Merge branch 'master' into c1p 2013-11-19 20:53:17 +01:00
Christian Groessler
478a7679a2 Force inclusion of 'shadow RAM preparation' load chunk in crt0.s and
not in the linker config file.
2013-10-18 22:08:26 +02:00
Christian Groessler
9f44d00d17 Put EXE header and main chunk load header into a single file --
it makes no sense to be able to include/exclude them separately.
2013-10-18 14:54:22 +02:00
Christian Groessler
b153ec8896 atari-asm.cfg linker config file 2013-10-18 03:08:26 +02:00
Christian Groessler
bf3a23c34c Rename 'syschk' symbol in the linker config file, which forces inclusion
of the 'system check' load chunki, to '__SYSTEM_CHECK__'.
2013-10-18 03:08:15 +02:00
Christian Groessler
90bac9d38c rename LOWDATA segment to LOWBSS 2013-10-16 18:20:57 +02:00
Christian Groessler
1077a2876e Lower the default Atari start adress from $2E00 to $2000. With
the startup memory check of the "system check" load chunk this
should be fine
2013-10-04 01:04:06 +02:00
Christian Groessler
700fd4f187 Enable "system check" load chunk for non-XL Atari target. 2013-10-04 00:54:24 +02:00
Christian Groessler
73d38b0ff2 Fix typo in last change. 2013-10-03 14:15:39 +02:00
Christian Groessler
417110d341 Use all available memory below the ROM. 2013-10-03 14:13:13 +02:00
Christian Groessler
7fb0cf4bb2 Some formatting and style fixes. 2013-10-01 11:36:37 +02:00
Christian Groessler
39a98f250b untabify 2013-09-27 22:01:54 +02:00