1
0
mirror of https://github.com/cc65/cc65.git synced 2026-03-11 08:41:58 +00:00
Commit Graph

3606 Commits

Author SHA1 Message Date
Colin Leroy-Mira
2085646e57 Apple2: implement get_tv()
get_tv() will return TV_NTSC or TV_PAL for any Apple II model
with a way of checking vblank. For Apple ][ and ][+ it will
return TV_OTHER and let the user figure it out in another way.
2025-04-28 11:58:53 +02:00
Christian Groessler
5cb1bc60fc Add 'define=yes' for INIT segment to atari-asm.cfg and atari-asm-xex.cfg linker configs.
libsrc/atari/exehdr.s: Add (empty) INIT segment to cover assembler programs which link with
exehdr.s.
2025-04-09 22:51:11 +02:00
Stefan
5ceb4f0d68 Revert atr5200std.s 2025-03-24 21:27:55 +01:00
Stefan A. Haubenthal
774e275965 Fixed many comments 2025-03-24 20:52:55 +01:00
Colin Leroy-Mira
fb63a839bf Optimize LZ4 decompressor
Use a walking out pointer instead of &out[written]. This
simplifies the code by 27 bytes and spares 15% cycles.
Tested with both the unit test and code uncompressing
10kB of data.

Renamed the labels for legibility.
2025-03-14 16:33:13 +01:00
Oliver Schmidt
ee540678e6 Improved consistency of notation for return value promotion. 2025-03-13 22:22:28 +01:00
Oliver Schmidt
3edb959298 Finally made CONIO and STDIO fully interoperable in 80 column mode.
In order to avoid undefined behaviour of programs not aware of 80 column mode, the 80 column firmware deliberately doesn't use CH but OURCH. So in order to be fully interoperable, CONIO needs to do the same. This changes introduces that behavior. So far so good.
But the 80 column firmware can also be active in 40 column mode. This scenario is not detectable with reasonable effort. Therefore the behaviour of CONIO in this scenario is _not_ improved. However, this scenario is supposed to be very uncommon - and a recent update to videomode() makes sure to not activate it anymore ourselves.
Notes:
* If a program wants to be 100% sure to not run in 40 column mode with 80 column firmware active it can call videomode(VIDEOMODE_40COL) to explicitly deactivate a potentially active 80 column firmware. However, this always implicitly clears the screen.
* In 40 column mode (contrast to 80 column mode) the 80 column firmware updates CH to reflect OURCH. So as long as CONIO only reads CH, but doesn't update it, everything works as expected. Interestingly this makes a rather useful scenario of STDIO/CONIO interoperation work: Using STDIO for screen output and CONIO for keyboard input. When cgetc() is called after cursor(1), it has to write to the screen as there's no hardware cursor on the Apple II. Those writes work as expected even in 40 column mode with active 80 column firmware as CH is only read but not written.
2025-03-13 22:22:28 +01:00
Oliver Schmidt
7c2671be2a Disable interrupts during aux memory access.
Interrupt handlers rather likely access text screen holes. Especially MSLOT is obligatory for every interrupt handler that requires access to an extension ROM ($C800-$CFFE) in order to be able to re-enable the extension ROM that was enabled when the interrupt occured. Those text screen holes only hold valid values in main memory so interrupts must be disabled while the aux memory text screen is mapped.
2025-03-13 22:22:28 +01:00
Oliver Schmidt
fd4c1e193d Completely disable/enable 80 column firmware.
The //e 80 column firmware allows to switch between 80 and 40 clumns without clearing the screen. So far, I made that feature available via videomode(). However thinking about it once more, I don't see a C program making use of it. A C program rather benefits from the consistent behavior of videomode() always clearing the screen.
Apart from that, the (default) 40 column display and the 40 column display with 80 column firmware active, behave differently (CH vs. OURCH) which causes subtile issues. Those issues can be avoid altogether by simply always deactivating the 80 column firmware when switching from 80 column display to 40 column display.
Of course, those issues are also relevant, if the 40 column display with 80 column firmware is already active when the C program starts. However, I have reasons to believe that running the Apple II in that mode was/is very unpopular.
2025-03-13 22:22:28 +01:00
Colin Leroy-Mira
c8eb6e2dd5 Apple II: Document BLTU alternative 2025-03-09 16:19:42 +01:00
Colin Leroy-Mira
020fe4028a Fix RANGE ERROR STOPPED AT 8214
On a 48k Apple II, the BLTU2 call throws an error,
even when there is nothing to copy in the LC segment.

Add an alternative LC copy, based on memcpy, to an
extra file that the user can link in as with iobuf-0800.

This memcpy-based version allows our programs to run on
Integer ROM apple2. It costs 21 bytes in binary size,
plus memcpy (60 bytes in binary size + RAM use) if it
wasn't already linked in.
2025-03-06 15:55:10 +01:00
Christian Groessler
02470a2343 atari5200: fix conio screen initialization
Screen memory clearing was wrong, now uses _clrscr function.
2025-03-04 23:41:30 +01:00
Christian Groessler
16224cdd36 atari5200: fix _clrscr to use correct screen size
Could be different than default when linking with atari5200-conioscreen-20x12.o.
2025-03-04 23:07:13 +01:00
Christian Groessler
b0220e5456 fix problem in _get_tv for GEOS CBM
Found by mkslack, see #2046
2025-03-02 09:26:31 +01:00
Christian Groessler
04ada63935 Atari: let crt0.s always provide an (empty) INIT segment 2025-02-23 01:06:08 +01:00
Christian Groessler
0082473630 Atari: fix fallout of change of INIT segment to 'bss' type
The size of the load chunk was calculated incorrectly in exehdr.s
since the INIT segment is no longer being part of the file anymore.

While at it, change atari-cassette.cfg so that order of BSS and INIT
is the same as in the other configs. See 692f96409d why it was
in different order.
2025-02-23 00:35:23 +01:00
Stefan
46b2f95ac8 comment 2025-01-31 20:56:59 +01:00
Stefan
fb12363a6a Fixed cassette boot file header #2600 2025-01-31 20:26:35 +01:00
Colin Leroy-Mira
adfb42bfa6 Rewrite rewind in assembly 2025-01-01 14:32:07 +01:00
Colin Leroy-Mira
50cccc2c3a Add lseek to sim6502 paravirt 2025-01-01 14:32:03 +01:00
Sidney Cadot
8ee93f7e5f Fixed indentation inside comment. 2024-12-18 09:04:20 +01:00
Sidney Cadot
ceac9f87ba Temporary fix for fgets() not using target-specific newline.
This patch provides a temporary fix for the issue where the fgets()
function did not use the target-specific newline character to
decide if it has reached the end of the line. It defaulted to the
value $0a, which is the newline character on only some targets.
The Atari, for example, has newline character $9b instead.

This patch is ugly, because the ca65 assembler that is used for
fgets doesn't currently accept C-type character escape sequences
as values. Ideally we'd be able to write:

		cmp #'\n'

And this would end up being translated to a compare-immediate
to the target-specific newline character.

Since that is impossible, this patch substitutes the equivalent,
but ugly, code:

		.byte $c9, "\n"

This works because $c9 is the opcode for cmp #imm, and the "\n"
string /is/ translated to the platform-specific newline character,
at least when the 'string_escapes' feature is enabled.
2024-12-18 07:44:52 +01:00
Bob Andrews
a53524b9de Merge pull request #2558 from polluks/cpp
Clean-up preprocessor syntax
2024-12-15 23:02:35 +01:00
Colin Leroy-Mira
852b622c43 Apple2: Don't forcefully re-enable IRQ
Avoid enabling IRQ after disabling them in driver code, remember
previous state instead (in case user had them disabled already).
2024-12-09 19:01:00 +01:00
Stefan
0f6b427170 Update strftime.c 2024-12-09 18:37:02 +01:00
Colin Leroy-Mira
21030c22a0 Apple2: Rewrite rewinddir() in assembly 2024-11-17 11:03:58 +01:00
Colin Leroy-Mira
f663ee428d Apple2: Rewrite readdir() and closedir() to assembly 2024-11-17 11:03:58 +01:00
Colin Leroy-Mira
700c01fa8b Rename dir_file_count to dir_entry_count 2024-11-15 19:25:40 +01:00
Colin Leroy-Mira
40d9f3eed5 Apple2: Provide a way to get directory file count
The information is available in the directory key block.
Providing it to the user as soon as opendir() is done
can save them costly code.
2024-11-15 19:25:40 +01:00
Colin Leroy-Mira
819a314508 Apple2: Rewrite opendir in assembly
58 bytes size gain
2024-11-09 18:17:30 +01:00
rumbledethumps
e373aa2d3f Merge branch 'cc65:master' into master 2024-09-29 18:36:34 -07:00
Kugel Fuhr
efa2020d93 Improved/fixed the time() function:
- When the underlying clock_gettime function returned an error, the value
  returned via *timep was wrong.
- Reduced code size by 7 bytes.
- Don't suck in ldeaxi.
2024-09-12 09:14:57 +02:00
Bob Andrews
31a0d5cc40 Merge pull request #2503 from colinleroy/master
Optimize stpcpy's size and speed
2024-09-08 16:17:14 +02:00
Bob Andrews
0be5f8f9e1 Merge pull request #2508 from polluks/waitvsync
[ATMOS] waitvsync
2024-09-08 16:14:51 +02:00
Bob Andrews
e6ff8d9301 Merge pull request #2510 from polluks/better_waitvsync
Faster waitvsync
2024-09-08 16:09:23 +02:00
coronax
838c8b48b7 Set the clock id to CLOCK_REALTIME when calling clock_gettime.
Previously, time() allocated stack space for the clock id argument, but didn't actually set a value.
2024-09-07 23:27:54 -05:00
Colin Leroy-Mira
55d3a6ea39 Optimize stpcpy's size and speed 2024-09-07 21:24:53 +02:00
Stefan
461554e616 Update waitvsync.s 2024-09-07 19:17:00 +02:00
Stefan
f5e434c6c8 Update waitvsync.s 2024-09-07 19:14:59 +02:00
Stefan
be5a9f92ec oops 2024-09-07 18:51:20 +02:00
Stefan
b355620939 Optimise waitvsync.s 2024-09-07 18:49:53 +02:00
Stefan
38f54875d0 Add files via upload 2024-09-07 17:06:45 +02:00
Colin Leroy-Mira
622793e343 Apple II: Move _exit out of STARTUP segment 2024-08-25 22:14:45 +02:00
Oliver Schmidt
feb5026823 Added option to disable the force-to-uppercase behavior of the apple2 target. (#2474)
* Added option to disable the force-to-uppercase behavior of the apple2 target.

* Fixed dangling spaces.
2024-08-07 18:27:09 +02:00
Bob Andrews
8b3625847d Merge pull request #2466 from SvenMichaelKlose/reformatted_doc_contributing
Make document human-readable and split out name clashes section.
2024-07-28 15:56:58 +02:00
karri
2ea216a521 Merge branch 'fix-joystick' of ssh://github/karrika/cc65 into fix-joystick 2024-07-20 13:18:16 +03:00
karri
19899022af Add support for different joysticks 2024-07-20 13:14:22 +03:00
Sven Michael Klose
d3e0f7b392 Make document human-readable and split out name clashes section.
In hope to reduce the pull request comment ping-pong.
2024-07-18 10:00:16 +02:00
Bob Andrews
03d824e13b Merge pull request #2464 from SvenMichaelKlose/stpcpy
Add stpcpy().
2024-07-16 01:47:11 +02:00
Sven Michael Klose
aed94d2dae Fix code style.
Have type, function name and argument declaration on a single line.
2024-07-16 01:33:48 +02:00