1
0
mirror of https://github.com/cc65/cc65.git synced 2026-04-19 09:28:25 +00:00
Commit Graph

386 Commits

Author SHA1 Message Date
mrdudz 5fc15a7a60 test #2674 2025-06-23 17:09:06 +02:00
Bob Andrews 2e7ee0f105 Merge pull request #2711 from mrdudz/plus4tgi
TGI Documentation and Comments fix
2025-06-23 13:40:41 +02:00
Colin Leroy-Mira ec0595ad28 Remove useless code
LOSCR is a valid and safe softswitch on any Apple II.
Thanks Oliver S!
2025-06-19 14:07:43 -04:00
mrdudz 55742003d6 add some more comments 2025-06-17 21:40:04 +02:00
Colin Leroy-Mira 990d65e4e4 Apple2: Setup IRQ/RST vectors in LC if needed
Programs running under DOS3.3 need to setup correct
reset and IRQ vectors in the language card.
2025-06-15 14:12:01 -04:00
Colin Leroy-Mira 0122307399 Apple2: Dynamic IIe check on a2_lo_tgi 2025-06-01 12:53:36 +02:00
Colin Leroy-Mira a9ab23ad51 Make waitvsync available on apple2 2025-06-01 12:53:36 +02:00
Colin Leroy-Mira d3ef3e1b62 Apple2: Don't depend on apple2enh definition for characters
Up, Down and Del, as well as Open-Apple, exist on
non-enhanced Apple //e.
2025-05-31 19:43:53 +02:00
Colin Leroy-Mira c75c305c59 Apple2: Fix inconsistency (use bit like everywhere else) 2025-05-31 15:43:23 +02:00
Colin Leroy-Mira d03529067a Apple2: don't define _allow_lowercase and uppercasemask on APPLE2ENH 2025-05-31 15:42:02 +02:00
Colin Leroy-Mira 89daccaa43 Apple2: automatically enable lowercase starting from //e 2025-05-31 15:42:02 +02:00
Colin Leroy-Mira f8c51ffd3d Spare a few bytes 2025-05-31 12:04:47 +02:00
Colin Leroy-Mira e444f4c40e Apple2: Safely check for 80-columns card
Check the Pascal ID bytes for an 80-columns card
to avoid blindly jumping into a $C300 that could be
totally unrelated.
2025-05-27 23:38:56 +02:00
Colin Leroy-Mira 816666615b Apple2: Make 80-columns support dynamic on apple2 target
Add a machinetype identifier to help us quickly identify
Apple //e (bit 7) and //e enhanced (bit 6).

Use it in conio functions for 80-columns code instead of
relying entirely on the __APPLE2ENH__ target.

Move videomode() to the apple2 target, and have it return
an error if 80-columns hardware is not available - this
is a lie for now, it is considered available on //e enhanced,
which may not be true, and not available on //e, which
may also be not true. An ulterior patch will make that
check correctly.

Adapt the box/line drawing characters so that one can use
MouseText on the apple2 target if it is available, by
defining DYN_DRAW_BOX. No change by default: MouseText is
considered available on apple2enh and not available on
apple2.
2025-05-27 19:03:20 +02:00
Colin Leroy-Mira cd92e4f0af Apple2: Set mousecard IRQ rate when possible 2025-05-26 14:58:13 +02:00
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
Stefan A. Haubenthal 774e275965 Fixed many comments 2025-03-24 20:52:55 +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
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
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
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
Colin Leroy-Mira 86317711e0 IIgs SCC: Rework branches to X-indexed variables
and general cleanup/commenting
2024-02-23 01:20:47 +01:00
Colin Leroy-Mira 8b71fafb84 IIgs SCC: Allow choosing 115200bps as the card allows it
Of course, that won't work full speed with the standard
IRQ-based RX. But that will allow users to setup the port
at this speed without duplicating the setup part of the
code. Up to them to add hooks to disable IRQs and read
directly in a tight asm loop.
2024-02-23 01:20:47 +01:00
Colin Leroy-Mira 3fd78208ba Disable IRQ if opening at 115200 bps 2024-02-19 19:31:47 +01:00
Colin Leroy-Mira 7a12399b39 Allow choosing 115200bps as the card allows it
Of course, that won't work full speed with the
standard IRQ-based RX. But that will allow users
to setup the port at this speed without duplicating
the setup part of the code. Up to them to add hooks
to disable IRQs and read directly in a tight asm
loop.
2024-02-19 19:31:47 +01:00
Bob Andrews ba6f9f5d3f Merge pull request #2381 from colinleroy/asm-fgets
Rewrite fgets in asm
2024-01-26 19:36:57 +01:00
Colin Leroy-Mira f0b5b02966 Swap in LC before destructors, ROM after 2024-01-24 12:28:57 +01:00
Colin Leroy-Mira 1f820d0ae8 Rewrite fgets in asm
-104 bytes, -1% cycles
2024-01-24 10:16:26 +01:00
Colin Leroy-Mira 2ba176372e Add beep for apple2 2024-01-23 23:04:50 +01:00
Colin Leroy-Mira 166a4b25f7 Apple2: implement sleep using MONWAIT
Also publish detect_iigs(), set_iigs_speed() and get_iigs_speed(). Refactor to only store one ostype variable.
2024-01-18 16:17:10 +01:00
Colin Leroy-Mira 75461e1319 Apple2: implement stat(2) and statvfs(3) 2024-01-01 19:12:51 +01:00
Colin Leroy-Mira 1093d169ad Fix BSS obliteration by mliparam during exec().
Using mliparam at this time could lead to corruption at the
start of the new executed program if BSS is real full and
mliparam is over $BB00.
The fix is to open the file from the loader stub instead of doing
it before the C library shutdown.
2023-12-14 16:47:33 +01:00
Colin Leroy-Mira f1b0fbebd5 Remove all indexed accesses to SCC registers
Some IIgs models had issues sending bytes out.
Also make channel tests clearer.
2023-11-24 18:37:43 +01:00
Colin Leroy-Mira 86d498b7b3 Implement SER_HS_NONE on Apple IIgs serial driver 2023-11-10 21:56:43 +01:00
Colin Leroy-Mira fe115fb621 Revert "Apple 2 SSC: Handle SER_HS_NONE with no performance impact"
This reverts commit 0eafb6d1d5.
This was buggy, as we sta Stopped when asserting flow, and this stops
SER_GET.
2023-11-05 11:34:51 +01:00
Colin Leroy-Mira 8a797095c1 Apple 2 SSC: Handle SER_HS_NONE with no performance impact 2023-11-05 11:34:51 +01:00
Colin Leroy-Mira 94239525ca Apple2 SSC: Implement no flow control 2023-11-05 11:34:51 +01:00
Oliver Schmidt 3c864fc7d8 Minimal style adjustment 2023-10-15 17:00:15 +02:00
Colin Leroy-Mira 882f6fd103 Fix ACIA check so we don't enable RX/TX with IRQs on 2023-10-15 16:58:59 +02:00
Colin Leroy-Mira 3107f34ec9 Put back 6551 test as a last verification 2023-10-15 16:58:59 +02:00