Commit Graph

89 Commits

Author SHA1 Message Date
mrdudz ffa83c32a4 clean-up of driver return codes 2023-02-26 20:03:41 +01:00
mrdudz 89c08dc6d4 extra underscores for _randomize and _swap 2022-08-29 20:52:35 +02:00
Greg King 5f145542b0 Exported the Commodore CHRIN and CHROUT Kernal functions, in the CBM libraries.
This commit complements commit 98f8064b83.
2021-03-03 17:39:53 -05:00
Polluks 9563541870 crt0 clean-up 2020-11-29 18:08:33 +01:00
Polluks a0596eae6e Added waitvsync for PET 2020-11-18 10:28:19 +01: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
Bas Wassink 2eac69a943 Remove trailings spaces from CBM-related asm files 2019-03-22 22:54:05 +01:00
Oliver Schmidt 40f42e977f Adjusted comments to match actual prototypes. 2018-11-06 11:13:23 +01:00
Olli Savia 820c0efcb3 Use common include file cbm_kernal.inc 2018-07-01 09:56:37 +03:00
Olli Savia c2adade8a8 Updated to use the new VIA register names 2018-04-20 21:25:43 +03:00
Oliver Schmidt 1976d6cd32 Removed IRQ support from joystick drivers.
All but one joystick drivers didn't use IRQs. Espsecially when the joystick driver kernel was the only .interruptor this meant quite some unnecessary overhead because it pulled in the whole IRQ infrastructure.

I was told that the one driver using IRQs (the DXS/HIT-4 Player joystick driver for the C64) can be reworked to not do it. Until this is done that driver is defunct.
2018-02-01 22:38:36 +01:00
mrdudz 8902730756 cbm stuff from greggs pull request 2017-12-11 19:52:11 +01:00
Greg King 3c0b8c4e86 Made the CBM Pet kbrepeat() work on both 40-column and 80-column machines.
Put the kbrepeat() description in an alphabetical position in the function document.
2017-09-05 09:19:01 -04:00
Oliver Schmidt 4aa19494f5 Removed dysfunctional kbrepeatdelay() and kbrepeatrate().
As discussed in https://github.com/cc65/cc65/pull/452 after my premature merge the two functions in question don't work as expected.

Additionally I adjusted several style deviations in the pull request in question.
2017-08-30 16:37:59 +02:00
Oliver Schmidt b5a4e5667a Merge pull request #452 from mrdudz/kbrepeat
kbrepeatdelay and kbrepeatrate for cbm targets
2017-08-20 14:15:37 +02:00
Oliver Schmidt 7f52a770d9 Removed joy_masks array.
So far the joy_masks array allowed several joystick drivers for a single target to each have different joy_read return values. However this meant that every call to joy_read implied an additional joy_masks lookup to post-process the return value.

Given that almost all targets only come with a single joystick driver this seems an inappropriate overhead. Therefore now the target header files contain constants matching the return value of the joy_read of the joystick driver(s) on that target.

If there indeed are several joystick drivers for a single target they must agree on a common return value for joy_read. In some cases this was alredy the case as there's a "natural" return value for joy_read. However a few joystick drivers need to be adjusted. This may cause some overhead inside the driver. But that is for sure smaller than the overhead introduced by the joy_masks lookup before.

!!! ToDo !!!

The following three joystick drivers become broken with this commit and need to be adjusted:
- atrmj8.s
- c64-numpad.s
- vic20-stdjoy.s
2017-08-19 19:11:28 +02:00
Bob Andrews 5dcebbccb6 Merge branch 'master' into kbrepeat 2017-08-06 20:22:52 +02:00
mrdudz a42feca228 fixed some stuff, compiles again :) 2017-06-17 02:37:34 +02:00
Oliver Schmidt 13482984ca Introduced internal gotoxy that pops both parameters.
About all CONIO functions offering a <...>xy variant call
  popa
  _gotoxy

By providing an internal gotoxy variant that starts with a popa all those CONIO function can be shortened by 3 bytes. As soon as program calls more than one CONIO function this means an overall code size reduction.
2016-06-05 14:58:38 +02: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
mrdudz 85760e0c53 initial import from old sources 2016-02-28 22:13:05 +01: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 031bd2ebf0 Fixed the random-seed generators for the Commodore targets.
They use a byte from the time counter; but, it is stored in big-endian order.
2015-09-11 10:03:07 -04:00
Greg King c7969a78b0 Refined the comments in the target start-up files.
Fixed typo errors.  Made the comments consistent across all those files.
2014-08-24 10:10:20 -04:00
Oliver Schmidt 2c975d3642 Create static drivers directly from source files.
Up to now static drivers were created via co65 from dynamic drivers. However there was an issue with that approach:

The dynamic drivers are "o65 simple files" which obligates that they start with the 'code' segment. However dynamic drivers need to start with the module header - which is written to. For dynamic drivers this isn't more than a conceptual issue because they are always contain a 'data' segment and may therefore only be loaded into writable memory.

However when dynamic drivers are converted to static drivers using co65 then that issue becomes a real problem as then the 'code' segment may end up in non-writable memory - and thus writing to the module header fails.

Instead of changing the way dynamic drivers work I opted to rather make static driver creation totally independent from dynamic drivers. This allows to place the module header in the 'data' segment (see 'module.mac').
2014-06-04 23:50:18 +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
Greg King d0fb1fe0ae Added the model-specific addresses that the CBM exec() needs. 2013-08-25 00:43:23 -04:00
Oliver Schmidt 23650cb946 Added library reference joy_libref to JOY interface. 2013-06-01 00:36:08 +02:00
Oliver Schmidt 85885001b1 Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
Oliver Schmidt 81e467cdc2 Replaced whole bunch for Makefiles with a single generic Makefile.
- No complex shell logic.
- "Source file shadowing" for all targets via vpath.
- Dependency handling.
- True incremental build.
- Don't write into source directories.
- Easy cleanup by just removing 'wrk'.
2013-05-04 22:15:30 +02:00
Oliver Schmidt 008b4c4e1d Replaced whole bunch for Makefiles with a single generic Makefile.
- No complex shell logic.
- "Source file shadowing" for all targets via vpath.
- Dependency handling.
- True incremental build.
- Don't write into source directories.
- Easy cleanup by just removing 'wrk'.
2013-05-04 22:10:48 +02:00
ol.sc 2e5823d43d Save some bytes by sharing the code doing the actual vector setting. Note: Jumping from segemnt INIT to segment CODE is okay while the other way wouldn't be.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5989 b7a2c559-68d2-44c3-8de9-860c34a00d81
2013-02-14 16:48:05 +00:00
ol.sc 7c9171ee87 Moved IRQ hooking / unhooking from startup code to constructor / destructor to avoid linking in the hooking / unhooking code (and callirq) for the majority of cc65 prorams not linking in interruptors.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5985 b7a2c559-68d2-44c3-8de9-860c34a00d81
2013-02-12 22:39:38 +00:00
ol.sc 6860ac7dfd Introduced static standard drivers.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5891 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-11-01 19:53:47 +00:00
ol.sc dbc66c247a Added missing standard driver definitions.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5890 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-11-01 15:58:27 +00:00
ol.sc 1bba8355da Fixed typo.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5889 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-10-31 23:39:58 +00:00
ol.sc a3c940e315 Convert dynamically loadable drivers into statically linkable drivers and add them to the target libraries.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5887 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-10-29 20:26:26 +00:00
ol.sc 59e96ef740 Turned the 'ST' status byte into a symbol resolved by the linker in order to allow to use it from code living in the 'cbm' directory.
Moved getdevice.s from 'c64'/'c128' to 'cbm' making use of the new 'ST' setup.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5834 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-09-30 18:20:15 +00:00
uz 285aaf8933 Patch by Stefan Haubenthal: Remove __fastcall__ in comments and/or the
function description for functions that don't take any parameters.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5573 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-03-04 13:08:54 +00:00
uz 9a9cea5a61 Changed the startup module and the linker config for the Commodore PET to use
the common loadaddr and exehdr modules.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4873 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-11-17 13:27:43 +00:00
uz fa1b5047dd Fixed order of options in call to ld65, which became important after the
latest changes.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4843 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-11-09 21:33:14 +00:00
uz 207a8ea10d Fixes for the pet-ptvjoy driver and a new standard joystick driver by Marco
van den Heuvel. Cleanup and integration by me.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4604 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-02-28 09:56:51 +00:00
uz a284d8ffeb Moved the pet.inc file into the asminc subdirectory. Added definitions for the
6522 VIA and fixed the assignments for addresses to use ':=' instead of '='.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4603 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-02-28 09:55:12 +00:00
ol.sc d1aad57b98 Initialize _curunit from the zeropage value DEVNUM (aka First Address) in a constructor with a very high priority to be called before DEVNUM gets overwritten by other constructors.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4588 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-02-14 23:12:54 +00:00
uz c6831e936a Added --forget-inc-paths to the assembler command line to avoid problems if
more than one version of ca65 is installed on the machine (Spiro Trikaliotis).


git-svn-id: svn://svn.cc65.org/cc65/trunk@4530 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-12-18 11:58:50 +00:00
uz 7e2a24176f Replaced $30 by literal '0' for better readability.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4513 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-12-10 22:12:24 +00:00
uz 13698871cb Removed the call to CLRCH in the startup code.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4512 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-12-10 21:22:17 +00:00
uz 60bc009991 * Moved the BASIC stub that calls the compiled program into it's own segment
named EXEHDR.
* Renamed BASICHDR to EXEHDR for the PET-II machines.
* Moved the call to CHRCH in front of the code that saves the zero page, since
  open files are sometimes remembered in the zero page, so we need to close
  them before we grab a copy.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4507 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-12-09 12:42:24 +00:00
uz bfbf94404b Squeezed bytes and cycles out of the kbhit functions for almost all platforms.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4480 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-11-24 18:31:16 +00:00
uz c7a33334ba Don't hardcode the address of the SYS call for the startup code of the
Commodore machines.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4474 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-11-23 12:01:24 +00:00