Commit Graph

3529 Commits

Author SHA1 Message Date
Colin Leroy-Mira 03d5e5fba0 Rewrite mktime in assembly
-415 bytes,
-39% cycles,
Unit test expanded to cover more cases (there was a bug in 2100 before!)
2024-01-18 09:09:38 +01:00
Colin Leroy-Mira 348a9048b7 Convert _time_t_to_tm to asm
46 bytes size gain, -8% cycles on the unit tests
2024-01-18 09:09:31 +01:00
Bob Andrews 2127778239
Merge pull request #2336 from colinleroy/optimize-strdup
Optimize strdup
2024-01-08 22:13:43 +01:00
Colin Leroy-Mira df193c0947 Rework time functions a bit
- mktime: Work unsigned as time_t's type implies (shifting Y2K38 bug to 2106)
- mktime: Add unit tests
- gmtime/localtime: factorize
- gmtime/localtime: Add unit tests
- mktime/gmtime/localtime: Size optimisation (-130 bytes wrt master)
- mktime: Speed optimisation (from 23M cycles on the unit test to 2M)
2024-01-08 18:24:13 +01:00
Colin Leroy-Mira 3a439e0e1b Little strdup optimisation
-12 bytes on disk
-20 cycles per strdup
-6 cycles per strlen called from strdup
2024-01-07 14:25:06 +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
rumbledethumps 3905e43068 style update 2023-11-26 15:12:20 -08:00
rumbledethumps 502e13173a
Merge branch 'cc65:master' into master 2023-11-25 19:55:56 -08: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
rumbledethumps 564c85235f style update and add rp6502 doc 2023-11-17 11:08:51 -08:00
rumbledethumps b17c4d3434 add rp6502 target 2023-11-16 18:46:16 -08: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
Colin Leroy-Mira 6e035c864e Apple2 SSC: on IIgs, verify slot mode
If the slot is not in "Your Card" mode, there's no way it is an SSC
2023-10-15 16:58:59 +02:00
Colin Leroy-Mira 96e893795b Better check for 6551 2023-10-15 16:58:59 +02:00
Colin Leroy-Mira e138403727 Move cli in common out path 2023-10-14 14:36:09 +02:00
Colin Leroy-Mira 6e0bbb00ee Fix logic error on parameters checks 2023-10-14 14:36:09 +02:00
Colin Leroy-Mira c7db08b4e3 Move hardware check to ser_install 2023-10-14 14:36:09 +02:00
Colin Leroy-Mira e90a8f3123 Address code review comments 2023-10-14 14:36:09 +02:00
Colin Leroy-Mira 39d6080945 Do the IIgs check as documented 2023-10-14 14:36:09 +02:00
Colin Leroy-Mira e3759a3ead Spare cycles on IRQ path 2023-10-14 14:36:09 +02:00
Colin Leroy-Mira 65ce3a6792 Don't check firmware at $C200, as we don't use it
Just check that we're on a IIgs instead.
2023-10-14 14:36:09 +02:00
Colin Leroy-Mira 9e87e558d2 Fix register r/w timing 2023-10-14 14:36:09 +02:00
Brian Peek 32a20cf5ca remove abc ptrs 2023-10-06 19:53:18 -07:00
Colin Leroy-Mira 9667a5f991 Re-introduce necessary comments, wit a clearer wording 2023-10-03 18:35:23 +02:00
Colin Leroy-Mira 3c17c13357 Address latest comments 2023-10-03 18:34:22 +02:00
Colin Leroy-Mira 996a2659d5 Address code review comments 2023-10-03 18:34:22 +02:00
Colin Leroy-Mira e16a5e0dbe Add Apple IIgs serial driver 2023-10-03 18:34:22 +02:00
Colin Leroy-Mira 330b1ab3f9 Remove useless comments 2023-10-03 13:55:10 +02:00
Colin Leroy-Mira df4902157a Cleanup coding style a bit 2023-10-03 13:55:10 +02:00
Colin Leroy-Mira 4ff917816e Apple2: Always copy cmdline
Otherwise, the last exec() cmdline lingers around for the next exec("file", NULL).
2023-09-29 10:51:53 +02:00
Colin Leroy-Mira e3bc143f27 Another two bytes saved 2023-09-22 11:51:29 +02:00
Bob Andrews c82e877451
Merge pull request #2188 from colinleroy/serial-kernel-fix-driver-lifecycle
Serial kernel: Fix driver lifecycle
2023-09-21 00:34:09 +02:00
polluks2 2e9843b32d
optimisation scandisplay 2023-09-15 10:35:36 +02:00
Colin Leroy-Mira 3fc074014e Serial kernel: Fix driver lifecycle
- Make sure we don't install a driver on top of another one
- Make sure we don't uninstall a driver twice
- Make sure we uninstall a driver if needed at exit
2023-09-12 20:58:21 +02:00
Colin Leroy-Mira aa5ee8423a Clearer wording for the firmware check 2023-09-11 08:31:15 +02:00
Colin Leroy-Mira 38f7daf40e Make sure not to load ACIA driver on IIgs' Z8530
The Pascal Firmware Protocol Bytes ID are not enough to differentiate an SSC card from a IIgs serial firmware:
http://www.1000bit.it/support/manuali/apple/technotes/misc/tn.misc.08.html

Loading a2(e).ssc.ser on a IIgs succeeds, then goes to limbo when one tries to use the serial port.

Check first byte on the slot's firmware in addition to the four existing ones, as it's supposed to be $2C (BIT instruction) on an SSC card, and $EF (65C816 SEP instruction) on the IIgs' serial firmware (ROM revisions 0, 1, 3).
2023-09-11 08:31:15 +02:00
Bob Andrews 043590c971
Merge pull request #2182 from colinleroy/add-ntohs
Add ntohs/htons and ntohl/htonl
2023-09-08 18:47:09 +02:00
Colin Leroy-Mira a90aa57510 Address Oliver's comments 2023-09-07 16:48:56 +02:00
Colin Leroy-Mira 734541ee05 Serial: Optimize SER_GET
There is no need to TryToSend before getting the character. We
send bytes during SER_PUT, and if interrupted during sending, we
still try to do it at the beginning of the next SER_PUT.
2023-09-07 07:14:01 +02:00
Colin Leroy-Mira a89a311abf Serial: Micro-optimisation for apple2enh
On 65C02 we can spare one cycle on sta (abs); we also
not have to care about the 6502 false reads
2023-09-07 07:13:59 +02:00
Colin Leroy-Mira e8f5ad2471 Serial: Optimize SER_PUT
We don't need to reload SendFreeCnt if we don't jsr TryToSend.
2023-09-07 07:13:57 +02:00
Colin Leroy-Mira 89af42e5cb Serial: Optimize SER_IRQ
Apple2 and Atmos have Index in X, but can still use it for the
best-case path as long as we reload it in the worst-case part
(when we assert flow control).
Also, standardize the free space to trigger flow control to 32
characters left (compare with RecvFreeCnt before decrement)
2023-09-07 07:13:54 +02:00
Colin Leroy-Mira 3f3b6123b9 Serial: Optimize TryToSend
We don't need to reload SendFreeCnt each time we loop to wait
for the ACIA to be ready.
2023-09-07 07:13:48 +02:00
Colin Leroy-Mira dfe7562f76 Add ntohs, htons, ntohl, htons. 2023-09-07 07:03:34 +02:00
Bob Andrews 870581a4d4
Merge pull request #2174 from colinleroy/conio-65c02-optimisations
Conio: 65c02 optimisations
2023-09-04 18:00:23 +02:00
Bob Andrews 16e90187e8
Merge pull request #2163 from bbbradsmith/init-bss
INIT segment definitions should be consistent, and bss is the appropriate semantic type
2023-09-03 00:30:44 +02:00
Colin Leroy-Mira 8a140e6503 Conio: 65c02 optimisations
cputc: -2 cycles per char, -2 cycles per carriage return
cputs: -5 cycles per char, -3 cycles on cputsxy
vcprintf: -6 cycles per char
2023-09-02 12:44:53 +02:00
Colin Leroy-Mira a2c115fc3e Build libs with debug symbols 2023-08-26 15:35:28 +02:00
bbbradsmith 2431fb7d85 correct INIT segment semantic is bss, make this consistent across all default cfg 2023-08-19 13:08:46 -04:00
Colin Leroy-Mira 148be69f97 Optimize and fix comments (thanks to Oliver Schmidt) 2023-08-19 14:11:36 +02:00
Colin Leroy-Mira 1f68846116 Avoid using mli.s to initcwd 2023-08-19 14:11:36 +02:00
jede 480600093c fix pla/pha instead of tmp1 2023-05-25 18:09:03 +02:00
jede 1ca9d7e9e7 fix tab 2023-05-23 23:15:23 +02:00
jede 1377ba0d36 fix compute length for read and write for telestrat target 2023-05-23 23:08:56 +02:00
bbbradsmith 76328da682 librsc/Makefile: ../lib directory must be created globally before make lib targets in parallel
prevents conflict of individual targets each trying to create ../lib
enable -j2 in make lib windows action
2023-05-08 20:57:50 -04:00
Bob Andrews c9857d9962
Merge pull request #2069 from jefftranter/bootstrap-fix
Source listing in bootstrap.s is incorrect.
2023-05-07 13:49:12 +02:00
Bob Andrews 0d0369983a
Merge pull request #2100 from bbbradsmith/split2092-libtest
libtest target alternative to lib
2023-05-06 11:30:05 +02:00
bbbradsmith df749abbfb libtest target alternative to libs
saves me about 20 minutes if I only want to run tests
2023-05-05 21:56:52 -04:00
Jeff Tranter 17706208e8 Add support for 48x12 video mode on Challenger 1P.
Tested on real C1P hardware.
2023-05-05 18:02:42 -04:00
Jeff Tranter 387d455cb4 Revised patch.
Uses code in source listing. Tested on a real OSI C1P machine.
2023-05-03 11:16:22 -04:00
Jeff Tranter 4d97e30b55 Source listing in bootstrap.s is incorrect.
The OSI C1P alternative boot file format works, but the code in the
source listing does not match the ASCII-coded hex translation (which
is actually used). This is confusing to anyone trying to maintain the
code.

Also, the source code did not assemble when ASM is defined.

Also removed use of branch macros and an unnecessary "<" operator.

With these changes the source file should correctly match what
is used at run time.
2023-05-01 09:49:41 -04:00
Jeff Tranter 3a5fbd34da Add KIM-1 functions to write to the 7-segment LED display and get
keypresses from the keypad.
Includes sample program illustrating how to use them.
Tested on real KIM-1 hardware.
2023-03-29 18:40:10 -04:00
Jeff Tranter 806ffe5675 Fixes and improvements to KIM-1 i/o routines.
Tested on real KIM-1 hardware.

read.s:
- Remove commented out line.
- Remove unused check for bell character.
- Remove echo of newline (hardware always echoes entered characters).
- This fixes gets() and fgets() so they return when CR is entered.

write.s:
- Fix check for adding return after linefeed (failed to work because OUTCHR changes A)
- Remove unused check for bell character.

kim1.inc:
- Add symbol for monitor entry

crt0.s:
- Jump to KIM-1 monitor by address rather than using BRK (which relies on vector being set in RAM)
2023-03-27 17:56:25 -04:00
jede c8c6fc6a40 add xfseek 2023-03-17 23:10:15 +01:00
Bob Andrews c226e58a3c
Merge pull request #2007 from groessler/something_to_pull
fix for issue #1973 (printf("%c", '\0') doesn't _write '\0' to fd 0)
2023-03-04 13:30:18 +01:00
mrdudz ffa83c32a4 clean-up of driver return codes 2023-02-26 20:03:41 +01:00
Christian Groessler fedfc3443d fix for issue #1973 (printf("%c", '\0') doesn't _write '\0' to fd 0) 2023-02-24 02:12:19 +01:00
mrdudz 8ac5e2f7b6 fix devicestr call, so related posix function work on cbm targets 2023-01-28 15:08:14 +01:00
Christian Groessler 60f56c43c7 some documentation fixes 2023-01-18 11:55:52 +01:00
Christian Groessler 67564d83c8 libsrc/atari/sound.s: fix indentation 2023-01-16 18:01:11 +01:00
Mariano Dominguez 40656ffb6e more style 2023-01-15 17:05:24 -08:00
Mariano Dominguez 6236e82850 change storage to pager zero
fix bug that kills keyboard.
2023-01-15 17:00:05 -08:00
Mariano Dominguez 27ecb555ea
Rename sound to _sound.
remove extra comments.
2023-01-10 11:16:36 -08:00
Mariano Dominguez 196962adac remove lasy pesky space 2023-01-06 10:54:16 -08:00
Mariano Dominguez c3e1ae3478 last trailing space 2023-01-05 21:36:44 -08:00
Mariano Dominguez 8c97b54f5d more trailing spaces :( 2023-01-05 21:34:43 -08:00
Mariano Dominguez 658c1ad711 only missing space 2023-01-05 21:33:40 -08:00
Mariano Dominguez 85f657b35e missing space 2023-01-05 21:30:31 -08:00
Mariano Dominguez 4e8b18c035 missing tab 2023-01-05 21:29:33 -08:00
Mariano Dominguez 29a80065cc fix tab indentation 2023-01-05 21:27:54 -08:00
Mariano Dominguez 30df733c31 remove dangling spaces 2023-01-05 21:20:16 -08:00
Mariano Dominguez fa05294054 add newline for style 2023-01-05 21:16:58 -08:00
Mariano Dominguez f9024d132a add sound command
this behives the same as BASIC

sound(voice, pitch, distortion, volume)
2023-01-05 21:12:58 -08:00
Rutger van Bergen ae23e47eb5
Merge branch 'cc65:master' into master 2022-12-26 13:57:10 +01:00
Oliver Schmidt 1daa445310 Fixed recently introduced addressing mode bug. 2022-12-22 22:09:23 +01:00
Oliver Schmidt d90c7e9853 Introduced the notion of a standard serial driver.
There's no target with more than one serial driver (and I don't see that change anytime soon) so it's a no-brainer to apply the standard driver concept to serial drivers.
2022-12-22 18:13:24 +01:00
mrdudz d6c37a757d Merge branch 'master' into underscores 2022-11-19 17:11:11 +01:00
Rutger van Bergen 2b07204952
Merge branch 'cc65:master' into kim1 2022-09-19 20:03:23 +02:00
Rutger van Bergen cb8cb876ec Add documentation, make capitalization uniform 2022-09-19 19:56:57 +02:00
Oliver Schmidt 5493c9e7c2
Don't empty the Receive Data Register on filling the Transmit Data Register
The Receive Data Register and the Transmit Data Register share share a single address. Accessing that address with STA abs,X in order to fill the Transmit Data Register causes a 6502 false read which causes the Receive Data Register to be emptied.

The simplest way to work around that issue - which I chose here - is to move the base address for all ACIA accesses from page $C0 to page $BF. However, that adds an additional cycle to all read accesses. An alternative approach would be to only modify the single line `sta ACIA_DATA,x`.
2022-09-08 17:11:30 +02:00
polluks2 446a785f95
Don't hide errors in error handling
You don't want the low byte, see grep _ERR_ libsrc/tgi/*
2022-09-02 11:55:54 +02:00
mrdudz 5bda57de87 add extra underscore to _bzero, add a test for bzero/memset 2022-08-29 23:20:48 +02:00
mrdudz 3b03a96375 add underscores to _poserror and _stroserror 2022-08-29 21:06:48 +02:00