1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-25 13:29:41 +00:00
Commit Graph

570 Commits

Author SHA1 Message Date
Christian Groessler
e4e3dbf756 atarixl: check at startup whether RAM beneath the ROM is in use
If detected, the program refuses to run, preventing a crash.
The check only works with SpartaDOS. I don't have an overview which
DOSes potentially use the RAM under the ROM. Or which other installed
programs might use it.

No additional runtime memory space is consumed, since the change
is in the "system check" load chunk which gets replaced by the
user program during loading.
2018-09-12 01:05:52 +02:00
Christian Groessler
b6ccd4d5d4 Atari: RealDOS adaptations
RealDOS is a SpartaDOS clone. Handle it the same way as SpartaDOS.
2018-09-06 15:55:07 +02:00
Christian Groessler
e9b8f5d814 Atari: Add detection of RealDOS (http://www.realdos.net/realdos.html). 2018-09-06 12:08:50 +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
Christian Groessler
d199ca1460 Atari, Atari5200: disable "attract mode" on mouse or joystick input
Fixes #736.
2018-09-05 11:23:12 +02:00
Oliver Schmidt
250e4ed9e0 Added dummy clock_settime() for the Atari.
Allow to build ip65/date65.
2018-08-18 01:36:56 +02:00
Oliver Schmidt
842c151edd Replaced _systime with clock_gettime.
We want to add the capability to not only get the time but also set the time, but there's no "setter" for the "getter" time().

The first ones that come into mind are gettimeofday() and settimeofday(). However, they take a struct timezone argument that doesn't make sense - even the man pages says "The use of the timezone structure is obsolete; the tz argument should normally be specified as NULL." And POSIX says "Applications should use the clock_gettime() function instead of the obsolescent gettimeofday() function."

The ...timeofday() functions work with microseconds while the clock_...time() functions work with nanoseconds. Given that we expect our targets to support only 1/10 of seconds the microseconds look preferable at first sight. However, already microseconds require the cc65 data type 'long' so it's not such a relevant difference to nanoseconds. Additionally clock_getres() seems useful.

In order to avoid code duplication clock_gettime() takes over the role of the actual time getter from _systime(). So time() now calls clock_gettime() instead of _systime().

For some reason beyond my understanding _systime() was mentioned in time.h. _systime() worked exactly like e.g. _sysremove() and those _sys...() functions are all considered internal. The only reason I could see would be a performance gain of bypassing the time() wrapper. However, all known _systime() implementations internally called mktime(). And mktime() is implemented in C using an iterative algorithm so I really can't see what would be left to gain here. From that perspective I decided to just remove _systime().
2018-08-15 16:06:44 +02:00
Oliver Schmidt
e86a7db18b Some minor cleanups. 2018-07-26 14:35:26 +02:00
Irgendwer
32bbacbb78
Merge branch 'master' into popptr1 2018-05-21 13:33:14 +02:00
IrgendwerA8
c95ed4b8b5 Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
Greg King
b844572159 Moved most of the tgi_colors.s files into the libsrc/common/ directory.
Only the Apple2 and Lynx platforms use different codes for the white color; they have their own files.
2018-03-27 07:28:46 -04:00
Oliver Schmidt
dacee3b9ed Removed IRQ support from TGI drivers.
All but one TGI drivers didn't use IRQs. Especially when the TGI driver kernel was the only .interruptor this meant quite some unnecessary overhead because it pulled in the whole IRQ infrastructure.

The one driver using IRQs (the graphics driver for the 160x102x16 mode on the Lynx) now uses a library reference to set up a JMP to its IRQ handler.
2018-02-02 18:15:45 +01: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
Christian Groessler
30c6018887 Implementation of getfirstdevice/getnextdevice for Atari. 2017-12-28 04:54:18 +01:00
Christian Groessler
a084ea8e42 Atari: split "setcursor" function out of cgetc.s source file into setcursor.s.
This function is used by many other CONIO functions, and the user program not
necessarily uses 'cgetc'. Having "setcursor" in a different object file saves
space in this case and also allows the user program to override it (e.g. when
not using GRAPHICS 0 mode).
2017-10-03 21:58:52 +02:00
Oliver Schmidt
0c54a19a0b Adjusted to recent driver interface change.
The change is inspired by the code of the standard joystick driver. It is however absolutely untested.

Note: Sites like http://raster.atariportal.cz/english.htm state that there needs to be a delay when reading joysticks via the MultiJoy adapter. There's no such delay in the driver. But I don't dare to decide to add it.
2017-08-20 11:49:02 +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
Christian Groessler
f613ee0f57 More optimization in libsrc/atari/is_cmdline_dos.s.
Suggestion by Spiro Trikaliotis.
2017-01-24 21:01:42 +01:00
Christian Groessler
6f463d60a3 Small space optimization in libsrc/atari/is_cmdline_dos.s. 2017-01-24 20:21:56 +01:00
Christian Groessler
6198e10f67 Atari: fix lookup of default device on XDOS.
Stefan Dorndorf, author of XDOS, pointed out that retrieving the
default device by looking at an undocumented memory location won't
work in future XDOS versions.
He also showed a way to get the default device in a compatible
manner.

This change implements his method and adds a version check (XDOS
versions below 2.4 don't support this -- for them the behaviour
will be the same as, for example, AtariDOS: no notion of a default
drive).
2016-09-12 23:40:25 +02:00
Christian Groessler
a9c69bb8c9 A small rearrangement of instructions in Atari's exec() to let the comments
make sense again.
2016-06-16 00:47:13 +02:00
Christian Groessler
ec7751332f Fix exec() for atarixl target.
The final part of exec() called 'excexit' and only then restored the
stack pointer to its value at program entry.  'excexit' does all
cleanup (the same as '_exit()'), which means that on the atarixl
target the ROM is banked in again.  On big programs the 'SP_save'
variable might reside at a high memory address which is no longer
accessible after the ROM has been banked in.
The change just moves the restoration of the stack pointer before
the call to 'excexit'.

Another change lets exec.s compile if UCASE_FILENAME is not defined.
And some other small cleanups, also in open.s.
2016-06-15 23:52:16 +02:00
Oliver Schmidt
2c8b8d90bf Merge pull request #311 from groessler/something_to_pull
Fix doesclrscrafterexit() function on atarixl target.
2016-06-15 08:59:50 +02:00
Christian Groessler
d0faf471b8 Some improvements to Atari exec() after review. 2016-06-14 20:44:57 +02:00
Christian Groessler
4aa9a414c6 Fix doesclrscrafterexit() function on atarixl target.
On atarixl, the screen is always cleared, regardless of the running DOS.
2016-06-13 21:16:27 +02:00
Christian Groessler
94ba9575ec Implement exec() for Atari XDOS.
- Adds new ENOEXEC error code, also used by Apple2 targets.
- Maximum command line length is 40, incl. program name. This is
  an XDOS restriction.
- testcode/lib/tinyshell.c has been extended to be able to run
  programs.
2016-06-13 20:40:01 +02:00
Oliver Schmidt
2f486b6201 Merge pull request #307 from groessler/something_to_pull2
Add Atari version of of doesclrscrafterexit().
2016-06-07 15:13:28 +02:00
Christian Groessler
346d88a6a7 Add issues from pull request #307. 2016-06-07 12:07:38 +02:00
Christian Groessler
c7874b9f60 Add Atari version of of doesclrscrafterexit().
- Update documentation.
- Update atari.h and apple2.h header files.
- Adapt Atari test/target programs.
- Fix a typo in "div" entry in funcref.sgml.
2016-06-07 00:42:51 +02:00
Christian Groessler
27841c7b40 Some Atari runtime library fixes.
* libsrc/atari/ucase_fn.s: Fix handling if input parameter 'tmp2' is 0.
* libsrc/atari/open.s: Set 'tmp2' parameter for 'ucase_fn' if DEFAULT_DEVICE
  is not defined.
2016-06-06 22:45:20 +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
89329f1519 Merge pull request #287 from silverdr/target_goodies
moved output of target utils and drivers to separate directory
2016-06-01 11:01:56 +02:00
Oliver Schmidt
f1a052f259 Merge pull request #303 from groessler/something_to_pull
Atari: get current drive on XDOS
2016-05-31 12:47:11 +02:00
Christian Groessler
0114a850d9 Atari, getdefdev.s: use mnemonics for 'crvec'. 2016-05-31 12:24:21 +02:00
Christian Groessler
4d02d47832 Use atexit() to wait for key press at program ternination.
Idea by polluks.
2016-05-31 10:38:02 +02:00
Christian Groessler
c1f17e9c18 Atari: make __getdefdev function ROM-friendly 2016-05-31 09:28:53 +02:00
Christian Groessler
9523fa2d33 Atari: get current drive on XDOS 2016-05-31 07:37:58 +02:00
Christian Groessler
b3d7c09ba1 forgot to add the new file atari/is_cmdline_dos.s in my last commit... 2016-05-25 01:06:53 +02:00
Christian Groessler
da65866e24 Atari: add new function '_is_cmdline_dos()' and some other small changes.
- use this function instead of directly looking at _dos_type in the included
  targetutil and test programs
- fixes/improvements to the Atari runtime library regarding the recently
  changed _dos_type values
- libsrc/atari/targetutil/w2cas.c: exit if no filename was entered
- add documentation for the new function
2016-05-25 00:57:43 +02:00
Christian Groessler
6d7dfad80b add support for XDOS command lines 2016-05-24 03:06:00 +02:00
Patrycjusz R. Łogiewa
ba10c74a7a directory structure changed from driver-centric to target-centric 2016-05-16 19:49:43 +02:00
Patrycjusz R. Łogiewa
93f55c274b moved output of target utils and drivers to separate directory 2016-05-13 14:28:58 +02: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
56a8c69b14 Use AX paradigm. 2016-03-13 21:23:45 +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
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
Oliver Schmidt
ccc7c2b1f9 Minor style adjustment. 2015-10-09 22:18:51 +02: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
Greg King
0390c34e88 Changed multi-line C comments into another style.
The left side doesn't look unbalanced.
2014-06-30 16:51:07 -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
2bc4634860 Normalized style.
We don't use .ifndef .else .endif
2014-06-03 18:30:11 +02: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
ef1e96aff0 small optimization 2014-05-27 01:50:22 +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
Christian Groessler
f290c1aa28 remove build warning 2014-04-25 13:21:54 +02:00
Christian Groessler
ec417c0dc5 Merge remote-tracking branch 'upstream/master' into a5200 2014-04-25 02:07:44 +02:00
Christian Groessler
401e18d982 Put mouse cursor shape definition into .rodata. 2014-04-24 02:04:08 +02:00
Oliver Schmidt
9e3154220c Merge pull request #106 from groessler/something_to_pull
add P/M (aka 'Sprite') mouse callback for Atari
2014-04-22 20:01:43 +02:00
Christian Groessler
2059e34114 rename ser_libref.s to serref.s in order to be consistent with other targets 2014-04-22 13:42:17 +02:00
Christian Groessler
eefd33d309 Split libref.s into multiple files to prevent inclusion of unnecessary code. 2014-04-22 12:50:07 +02:00
Christian Groessler
7eaf721e7c Selection whether to use page 6 for mouse P/M data is not done in
Makefile.inc, like the other compile-time options. Small fix in the
P/M mouse "show" routine: adapt mouse cursor colors to current
screen colors.
2014-04-21 11:41:37 +02:00
Christian Groessler
88e3e60550 address issue raised in the pull request; add support to not use page 6
again
2014-04-15 11:37:34 +02:00
Christian Groessler
526b440b24 - always use page 6 for P/M mouse cursor
- make cursor character of text mode callback configurable
- change default cursor character of text mode callback from 'plus' to 'diamond'
- set P/M callback as default
2014-04-11 23:51:49 +02:00
Christian Groessler
661203a89a initial version of a P/M mouse callback 2014-04-11 23:51:49 +02:00
Christian Groessler
f266612697 Merge remote-tracking branch 'upstream/master' into a5200 2014-03-20 00:24:11 +01:00
Christian Groessler
889783bedb add some conio functions 2014-03-11 01:17:59 +01:00
Christian Groessler
73df73194a fix indentation 2014-03-07 23:15:57 +01:00
Christian Groessler
b40fe584d8 fix typo 2014-03-07 23:15:11 +01:00
Oliver Schmidt
3f0af9b241 Have src/Makefile and libsrc/Make use disjoint work directories.
Building the clean target in src or libsrc should only delete stuff created by the make in those directories. Having both separated allows the Travis CI build to replace the native binaries with cross built binaries while keeping everything else.
2014-03-05 23:24:35 +01:00
Oliver Schmidt
44ccb27549 Changed Makefile.inc handling.
It seems more appropriate to trigger the inclusion of Makefile.inc via $TARGET (instead of $SRCDIR). This is btw. more consistent with extzp.s inclusion which is triggered via $TARGET too.
2014-03-04 21:46:25 +01:00
Christian Groessler
bf8eb8c22e rename libsrc/atari/tvtype.s to libsrc/atari/get_tv.s 2014-03-04 15:44:10 +01:00
Oliver Schmidt
3f7cd3387f Optimize for size instead for speed. 2014-03-03 21:08:35 +01:00
Christian Groessler
7a9fa9d4cd rename W2CAS.COM to w2cas.com (lowercase) 2014-03-03 18:12:11 +01:00
Christian Groessler
69f81f6d67 make 'w2cas' a targetutil 2014-03-01 13:11:52 +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
65874d4604 Merge remote-tracking branch 'upstream/master' into cassette 2014-02-20 01:05:10 +01:00
Christian Groessler
b326a04b1e fix uninitialized use of 'buflen' 2014-02-19 22:39:39 +01:00
Christian Groessler
b496a400ec Merge remote-tracking branch 'upstream/master' into cassette
ecessary,
2014-02-18 21:36:53 +01:00
Christian Groessler
b477023783 Turn off mouse polling interrupt if the mouse hasn't been moved for
some time. Turn it back on when the mouse is moved again.
Since the polling interrupt runs at a rather high frequency (1kHz),
this saves many processor cycles when the mouse is inactive.
2014-02-14 01:44:00 +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
0cf0ed5510 Disable the high frequency mouse polling IRQ while the system does
time critical things (CRITICAL flag set).
2014-01-29 23:40:48 +01:00
Christian Groessler
33bc340814 add missing stddrv defines for atarixl 2014-01-21 23:09:00 +01:00
Christian Groessler
63ce6e28fe Adapt to new mouse driver interface ('prep' and 'draw') 2014-01-20 23:04:31 +01:00
Christian Groessler
9e155eb096 Always print the mouse cursor, even if coordinates haven't changed.
This makes sure that the cursor is always visible, even if the program
has written text to the screen (only valid for non-P/M mouse callbacks).
2014-01-20 23:04:31 +01:00
Christian Groessler
1fd7c2b318 fix bug where the high byte of X and Y positions were destroyed of
the user had lifted the pen
2014-01-20 23:04:31 +01:00
Christian Groessler
ecd10e632a some comment fixes 2014-01-20 23:04:31 +01:00
Christian Groessler
97d512a1e1 Detect pen button. If we read 228 for X or Y position, don't change cursor
position, since the pen was probably lifted from the pad.
2014-01-20 23:04:30 +01:00
Christian Groessler
6026776460 Trakball mouse driver 2014-01-20 23:04:30 +01:00
Christian Groessler
d61b8754fb Adapt to new mouse driver interface ('prep' and 'draw') 2014-01-20 23:04:30 +01:00
Christian Groessler
09aa007191 Change display logic of mouse cursor (hide and show functions). 2014-01-20 23:04:30 +01:00
Christian Groessler
2be7c7c88d Always print the mouse cursor, even if coordinates haven't changed.
This makes sure that the cursor is always visible, even if the program
has written text to the screen (only valid for non-P/M mouse callbacks).
2014-01-20 23:04:30 +01:00
Christian Groessler
77ba5b7e1c Fix timer IRQ hooking for atarixl target. 2014-01-20 23:04:30 +01:00
Christian Groessler
597c4a6b89 add comment 2014-01-20 23:04:29 +01:00
Christian Groessler
c78d7a82fb use ST mouse as static standard driver, too 2014-01-20 23:04:29 +01:00
Christian Groessler
c22b91e3c3 align comment to the same column 2014-01-20 23:04:29 +01:00
Christian Groessler
09da71c5d9 another small cleanup 2014-01-20 23:04:29 +01:00
Christian Groessler
24198a9ebb small cleanup 2014-01-20 23:04:29 +01:00
Christian Groessler
d614fc4e64 When disabling interrupts, restore original interrupt flag afterwards. 2014-01-20 23:04:29 +01:00