Commit Graph

243 Commits

Author SHA1 Message Date
Oliver Schmidt 2fcd8b934a Made HGR segment obligatory.
Requiring the HGR segment makes the configs a little less flexible, but for the intended use case the HGR segment actually is necessary. And as we learned now, making the HGR segment obligatory helps users to not shoot themselves in the foot.
2020-10-24 13:57:35 +02:00
Greg King a25b28a972 Added files to the pet library that support the overlay demo sample program.
cbm_load() is needed because the Pet/CBM Kernals don't have a LOAD function that can be used by machine code programs.
2020-10-15 21:22:04 -04:00
Greg King e682f7c8c3 Protect the C stack from overlays on the c64 target. 2020-10-15 14:00:25 -04:00
Greg King 41bd8d909b Added ld65's bank attribute to the cx16 library's bank (overlay) configuration file.
That attribute makes it easier for Assembly code to know which bank holds a label.
2020-09-20 19:55:25 -04:00
Greg King 0b64ca0d7d Fixed the ld65 cx16 Assembly configuration file.
The CODE segment immediately follows the EXEHDR segment.  Added a segment for the zero-page area that's free when the BASIC ROM isn't used.
2020-09-20 16:09:58 -04:00
Greg King 410e4502ee Added a 160x192x2 TGI (graphics) driver to the VIC-20 library.
The driver requires a special linker configuration: "vic20-tgi.cfg".
The VIC-20 computer needs at least 8K of expansion RAM!

"tgidemo.c" needed to be adjusted because the VIC-20's vertical (y) range is greater than its horizontal (x) range -- the opposite of most other platforms.  Also, the circle demo would jam on the VIC-20.
2020-07-08 05:55:30 -04:00
Greg King 3fa253d31f Updated the cx16 library to the Commander X16 Kernal's prerelease 35. 2019-12-25 10:56:32 -05:00
Oliver Schmidt d5c804f851 Expanded Sim65 zero page. 2019-11-26 22:18:12 +01:00
Greg King d78133e1f0 Updated cx16 to match the Commander X16 ROMs and emulator, release 34. 2019-11-16 13:11:40 -05:00
Fabrizio Caruso fb260ef17f Init is no longer in crt0.s 2019-10-09 17:01:02 +02:00
Fabrizio Caruso 915836b3ec Improve init code readability 2019-10-09 17:01:02 +02:00
Fabrizio Caruso cdb8035cf0 Move screen init into crt0.s 2019-10-09 17:01:02 +02:00
Greg King 18afc7c703 Created a target and a library for the Commander X16 prototype computer. 2019-09-27 03:38:51 -04:00
bbbradsmith fb7d4acd5c versionable header for sim65
load and run address now configured from header
fix error codes not to conflict with test
fix test/misc/endless.c which is supposed to fail if an endless loop does not occur
2019-05-29 22:56:51 +02:00
bbbradsmith 2f3cae0d2e movable sp for sim65 2019-05-29 22:56:51 +02:00
Christian Groessler 14d8f3d81d cfg/atari-xex.cfg: fix typo in comment 2019-04-24 13:17:11 +02:00
Daniel Serpell 824e30934e Change XEX configuration file names to better reflect original names.
Also, updates documentation with the new files.
2019-02-21 19:00:17 -03:00
Daniel Serpell 0e33a653d7 Add sample linker configurations for Atari binary output in C. 2019-02-21 19:00:17 -03:00
Christian Groessler 58484449b4 remove TABs 2019-02-05 23:27:52 +01:00
Daniel Serpell e767c8990d Adds documentation and a sample config file for the ATARI format. 2019-02-03 18:16:46 -03:00
Greg King 2959ade6e6 Added, to Plus4 and GEOS linker configure files, the ability to set the start and end addresses of the program region. 2019-01-03 10:49:56 -05:00
jede a22b10e72b Correct grab default value 2018-10-19 23:43:40 +02:00
jede 5585396532 By default, we get the memory reserved for hires mode 2018-10-19 23:43:40 +02:00
jede ff182f9498 Cleaning telestrat.cfg (no need to have bashead segment). Some primitives added 2018-10-19 23:43:40 +02:00
jede ee7514fea2 Remove BASHEAD segment which is not useful 2018-10-19 23:43:40 +02:00
Christian Groessler af50b5e516 Atari: atarixl config files already had a LOWBSS segment. 2018-09-05 11:28:15 +02:00
Christian Groessler a104c289da Atari: atari-cart.cfg: There's a simpler way to discard the contents of the LOWBSS segment.
Thanks to Greg King for the hint.
2018-09-05 11:28:15 +02:00
Christian Groessler 1cc4fa9356 Atari: fix interrupt handling if extended memory is banked in
Extendend memory is mapped over the main memory in the 0x4000..0x7FFF
area. Many DOSes disable interrupts while extended memory is banked in,
but not all (e.g. SpartaDOS-X).
This change modifies the initial interrupt handler to map in main memory
before chaining to the "worker" handlers.
Since the initial interrupt handler uses a data segment to store the
trampoline to chain to the original handler, introduce a new "LOWBSS"
segment to hold this trampoline. Otherwise the trampoline may end up
inside the 0x4000..0x7FFF area.

Add a link time warning if "LOWCODE" segment lays within the extended
memory window.
2018-09-05 11:28:15 +02:00
Greg King 959eff34a3 Fixed and improved some pce comments. 2018-08-30 11:48:46 +02:00
Greg King b5d939c858 Style changes. 2018-08-30 11:48:46 +02:00
Oliver Schmidt 8e75906737 Switched Apple II output format to AppleSingle.
Although the primary target OS for the Apple II for sure isn't DOS 3.3 but ProDOS 8 the Apple II binary files contained a DOS 3.3 4-byte header. Recently I was made aware of the AppleSingle file format. That format is a much better way to transport Apple II meta data from the cc65 toolchain to the ProDOS 8 file system. Therefore I asked AppleCommander to support the AppleSingle file format. Now that there's an AppleCommander BETA with AppleSingle support it's the right time for this change.

I bumped version to 2.17 because of this from the perspective of Apple II users of course incompatible change.
2018-03-07 23:05:21 +01:00
Greg King 3a0506ccb3 Changed the PC-Engine's configuration file, so that the command line can build 8K, 16K, and 32K carts.
Adjusted the PCE's document, the start-up code, and the PCE library test makefile.  That makefile shows how to post-process the linker's output file.
2018-02-23 16:06:49 -05:00
Oliver Schmidt b65981fc3a Reduced default stack size to a reasonable value.
The unexpanded Creativision has only $206 bytes of RAM available to cc65 programs. So it's a bad idea(tm) to reserve $180 bytes for the software stack. $40 bytes seems a much better default (aka guess).
2018-02-10 11:30:10 +01:00
Oliver Schmidt 7521ae888a Marked Apple II EXEHDR segment as optional.
The docs say "Use -D __EXEHDR__=0 to omit the header." so it should work without generating a linker warning.
2018-02-02 14:46:57 +01:00
Oliver Schmidt 38049d22ba Provide symbole for RAM memory area.
The RAM memory area symbols are referred by the startup code. The 64k and 128k variant say "for assembler" so it may be not necessary to do that there. However given the "limited" state of documentation for the target I don't assign too much value to those statements.

Additionally it's unclear to me why two variants provide symbols for the ROM memory.
2018-01-31 14:53:31 +01:00
Oliver Schmidt 80b09ba9fc Significantly simplified recently added linker config files.
I just forgot about the 'start' segment attribute - which makes the scenario at hand dead easy.
2018-01-31 08:54:48 +01:00
Oliver Schmidt 855aceaba8 Added Apple II linker configs for programs including a hires screen.
The Apple II hires screen buffer is located at $2000 (and can't be moved). The usual way to get along with this is to load the cc65 program above the hires screen buffer at $4000. However, that means that it becomes difficult to make good use of the memory below the hires screen buffer. The simplest approach is to add that memory to the heap. But there are programs containing just lots of code and not much data. One could think of moving the code to the area below the hires screen after loading (like it is done with the code for the language card). But if the program is really large (and already contains code to be moved to the language card) it won't just fit into memory in the first place.

The alternative is to load the program at the usual $803 and have it "cover" the hires screen buffer. Of course the part of the program that actually "covers" the hires screen buffer mustn't contain anything necessary for the program. The downside of this approach is that the program file on disk contains 8kB that can't be used by the program. But instead of just containing zeros the program can as well contain a hires screen picture that can be displayed right after startup.

Now the user can have code loaded below the hires screen buffer by setting the code-name to LOWCODE. However, he needs to explicitly do so. Otherwise the memory below the hires screen is totally wasted.

Trivia: Allowing to do this hires screen buffer "covering" was the very reason to change tgi_init() to not clear the hires screen anymore.
2018-01-29 17:46:36 +01:00
Christian Groessler 356c73f2cf atari5200.cfg: fix formatting 2018-01-21 15:42:12 +01:00
Christian Groessler 643152fb38 Fix last change, put display list at beginning of ROM. 2018-01-21 15:40:22 +01:00
Christian Groessler 2ef6514e47 atari5200: put default display list into its own memory area
This avoids 1K boundary crossing of the display list. Fix for issue #560.
2018-01-19 15:18:43 +01:00
bauen1 aa34aed7dd
Fixed unused import and export of none.cfg and none/crt0.s 2018-01-04 22:27:39 +01:00
bauen1 cea8332084
Fixed none.cfg 2018-01-04 22:01:44 +01:00
bauen1 ef993f2fcf
none.cfg consistency changes 2018-01-04 21:29:58 +01:00
bauen1 884dfcf3c1
Fixed none.lib missing symbols 2018-01-04 12:22:42 +01:00
bauen1 98b2b2544d
Added crt0 to none.lib 2018-01-04 12:07:35 +01:00
Stefan 98e2b79ef4 Optimizing the stack size 2017-12-18 19:19:59 +01:00
Oliver Schmidt bbbd4e4742
Merge pull request #553 from polluks/patch-1
Fixed memory config #551
2017-12-16 18:29:27 +00:00
Stefan b4fe03e49f
Update c16.cfg 2017-12-16 02:36:31 +01:00
Stefan afb758bd6c
Update c16-32k.cfg 2017-12-16 02:35:00 +01:00
Stefan 6452fbac89
Added new config #551 2017-12-16 01:04:05 +01:00
Stefan 41fab61253
Fixed memory config #551 2017-12-16 00:41:00 +01:00
Oliver Schmidt 3a6430b13d Merge pull request #494 from jedeoric/master
[telestrat] Adding some vars, adding getcwd management, changing ZP address and ZP length
2017-09-27 09:52:19 +02:00
jede d4c6c995ba Correcting missing return line :/ 2017-09-24 11:57:52 +02:00
jede fdd789edd8 correcting some return lines 2017-09-24 11:56:55 +02:00
jede c640619db5 Add some bytes in ZP block in order to able to link with o65 files 2017-09-24 11:55:37 +02:00
Piotr Fusik 8e35a82c91 Fix regression of #pragma bss-name
Closes #409
2017-03-21 22:35:25 +01:00
Christian Groessler a3d8829be9 Creativison changes.
This change includes some cleanups, removal of mainargs.s (game console
programs never have arguments), and a workaround for a problem I'm seeing.

The problem is that sometimes (in fact, more often than not) the clrscr()
call in testcode/lib/joy-test.c writes some garbage chars on the screen (most
often a "P"). Could be my hardware (I haven't seen it on MAME), but to
me the root cause is still unknown.
2017-03-17 21:42:51 +01:00
Christian Groessler a5fba551d1 Merge remote-tracking branch 'upstream/master' into something_to_pull2 2017-02-13 21:38:38 +01:00
Oliver Schmidt 5bbf010029 Merge pull request #371 from jedeoric/master
Create an Oric Telestrat target library
2017-02-10 23:47:13 +01:00
jede 0e649f24ea Correcting some code from github comments 2017-02-01 23:58:33 +01:00
Christian Groessler a08f905224 Cleanups for Creativision. 2017-02-01 20:09:03 +01:00
Christian Groessler 07f840f11c Merge remote-tracking branch 'upstream/master' into creativision 2017-02-01 18:15:05 +01:00
jede b5fef66f37 Merge telemon24 and telemon30 into telestrat target.
Cleaning, and replace tab to spaces
Converting hex lowercase value into uppercase char.
Changing := and = when it was needed
2017-01-31 22:09:14 +01:00
jede 0f8fb4d79d Merge with current version 2017-01-29 22:39:51 +01:00
jede d1b5a6632d Adding telemon30 and telemon24 primitives 2017-01-29 21:18:49 +01:00
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