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
rumbledethumps
4d3153e10e
add rp6502 xregn
2024-02-17 16:02:57 -08:00
rumbledethumps
f42e6a26b2
xstack bump to 512
2024-02-17 15:47:51 -08:00
rumbledethumps
b8b263b38c
Merge branch 'cc65:master' into master
2024-02-17 14:54:12 -08:00
Alex Thissen
7d6f3d24d4
Changed sta (ptr1,x) to sta (ptr1)
...
Reset serial status on ser_close
Fixed error for saving serial state
2024-02-11 23:12:27 +00:00
Alex Thissen
8b172e05bc
Applied optimization as per review 42Bastian
2024-02-11 20:59:08 +00:00
Alex Thissen
1deb9e52ae
Replaced last literal value for SERCTL
2024-02-11 15:46:23 +00:00
Alex Thissen
acff429eb8
Added redeye check for SER_HS_SW handshake
2024-02-11 15:33:22 +00:00
Alex Thissen
6cf8ee8eb5
Removed baud rates from 150 and lower.
...
Fixed tab
Replaced uploader references to SERIAL_INTERRUPT
2024-02-10 23:19:05 +00:00
Alex Thissen
65bce9ecde
Implemented mark and space checks.
2024-02-10 23:19:04 +00:00
Alex Thissen
014f85f226
Fixed baud rates
2024-02-10 23:19:04 +00:00
Alex Thissen
788ae82d30
Fixes to serial driver implementation
2024-02-10 23:19:02 +00:00
Carlo Bramini
b04d79b1da
[SIM65] Support undocumented opcodes for 6502
...
This PR is mostly a complete rewrite of the emulator for 6502/65c02 opcodes.
It provides an easier to maintain implementation of the instructions, by using few macros rather than having hand-written code for each function.
All undocumented, previously missing opcodes for 6502 are also implemented.
The patch also includes a detailed documentation of those opcodes, for reference to developers.
This PR should fix one of the milestones listed here for the next version of CC65:
https://github.com/cc65/wiki/wiki/Before-the-next-release
2024-02-08 12:13:17 +01:00
Bob Andrews
a06431a8f9
Merge pull request #2402 from colinleroy/a-bit-of-65c02-optimisations
...
a BIT of 65C02 optimisations
2024-02-02 21:58:04 +01:00
Bob Andrews
eb503cc542
Merge pull request #2390 from colinleroy/implement-shifts-by-7
...
Implement aslax7/shlax7/asrax7/shrax7
2024-02-02 20:17:48 +01:00
Colin Leroy-Mira
1fab179cb4
a BIT of 65C02 optimisations
...
Use BIT immediate instead of AND when reloading A is required
afterwards.
Add an fread unit test as the optimisation touches fread.
Sprinkle a few zero page indexed while we're at it.
2024-02-02 19:45:49 +01:00
Colin Leroy-Mira
afd8ee627e
Remove useless branching code in fgets
2024-01-30 19:52:48 +01:00
Colin Leroy-Mira
2b97735d5d
Factorize file pointer check
2024-01-30 19:40:28 +01:00
Colin Leroy-Mira
1a5a7d67a7
Rewrite fputc in assembly
...
-36 bytes, -12% cycles
2024-01-30 17:19:13 +01:00
Colin Leroy-Mira
ba36071022
Rewrite fputs in assembly
...
-28 bytes, -1% cycles
2024-01-30 17:12:52 +01:00
rumbledethumps
9ffa2d05e6
rp6502 validate write_xstack count
2024-01-30 00:17:28 -08:00
rumbledethumps
dd95d20268
Merge branch 'cc65:master' into master
2024-01-29 08:45:56 -08:00
Colin Leroy-Mira
7d7cf2d1e0
Implement aslax7/shlax7/asrax7/shrax7
2024-01-29 07:59:11 +01:00
Bob Andrews
51b946bf25
Merge pull request #2387 from colinleroy/sim65-implement-remove
...
Implement __sysremove for sim65
2024-01-28 16:53:29 +01:00
Colin Leroy-Mira
0dd7b0c3a5
Implement __sysremove for sim65
...
This will allow using unlink()/remove() in sim65 programs
Use it to unlink fgets' test output file
2024-01-28 13:58:57 +01:00
Bob Andrews
8682095f9f
Merge pull request #2384 from colinleroy/asm-realloc
...
Rewrite realloc in asm
2024-01-27 00:28:17 +01:00
Colin Leroy-Mira
aa6f850b8d
Rewrite gets in assembler
...
+19 bytes if used alone, because it pulls in fgets, but as code is
factorized, -128 bytes in programs using both fgets and gets.
2024-01-26 20:29:17 +01:00
Colin Leroy-Mira
a8b870555e
Rewrite realloc in asm
...
-80 bytes, -39% cycles
2024-01-26 20:25:59 +01:00
Bob Andrews
65937684a0
Merge pull request #2380 from colinleroy/asm-fgetc
...
Rewrite fgetc in asm
2024-01-26 20:12:41 +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
476591e8b7
Rewrite fgetc in asm
...
-82 bytes, -20% cycles
2024-01-25 09:13:39 +01:00
Bob Andrews
ee3a542539
Merge pull request #2383 from colinleroy/pmemalign-size-opt
...
Optimize -36 bytes out of posix_memalign
2024-01-24 21:26:50 +01:00
Bob Andrews
a2d722639f
Merge pull request #2385 from polluks/master
...
Fixed comment
2024-01-24 21:17:19 +01:00
Bob Andrews
9ba270d97b
Merge pull request #2378 from colinleroy/fix-overflow-in-malloc-and-realloc
...
Fix malloc and realloc overflow
2024-01-24 21:15:31 +01:00
Stefan
34f37c873e
Fixed comment
2024-01-24 16:32:45 +01:00
Bob Andrews
ebf43ddb05
Merge pull request #2379 from colinleroy/add-return-minus-1-helper
...
add a return -1 helper
2024-01-24 15:53:19 +01:00
Colin Leroy-Mira
f0b5b02966
Swap in LC before destructors, ROM after
2024-01-24 12:28:57 +01:00
Colin Leroy-Mira
b87df9e1c6
Optimize -36 bytes out of posix_memalign
...
And add a unit test
2024-01-24 10:23:53 +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
5d49fde788
add a return -1 helper
2024-01-24 09:58:09 +01:00
Colin Leroy-Mira
3e01ac9b04
Fix malloc and realloc overflow
...
If user requests a size >= 65532, adding the heap admin size
overflows size. Fixes #2358 .
2024-01-24 09:54:54 +01:00
Bob Andrews
57e65a6bf6
Merge pull request #2348 from colinleroy/time-functions-pass-2
...
Convert more time functions to asm
2024-01-23 23:45:10 +01:00
Colin Leroy-Mira
2ba176372e
Add beep for apple2
2024-01-23 23:04:50 +01:00
Bob Andrews
7a7e98d799
Merge pull request #2371 from alexthissen/lynx-upload
...
Lynx upload fixes for IRQ and configuration
2024-01-22 15:50:40 +01:00
Colin Leroy-Mira
b23a7ec407
Save two bytes in pushax and popptr1
...
It's not because Y must equal zero on rts that we should'nt spare one byte
and one cycle.
2024-01-19 21:14:47 +01:00
Alex Thissen
ad90a3a421
Replaced references to __BLOCKSIZE__ with __BANK0BLOCKSIZE__
2024-01-18 18:57:57 +00:00
Alex Thissen
2e56dcc521
Fix for mising import
2024-01-18 18:13:39 +01:00
Alex Thissen
acce24fedc
Switched to __BANK0BLOCKSIZE__ instead of __BLOCKSIZE__ to make current lynx config files work
2024-01-18 18:13:02 +01:00
Alex Thissen
d906748691
Fix uploader implementation to reset IRQ bit for timer 4 (serial) interrupt
2024-01-18 17:37:09 +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
10282a9b74
Rewrite asctime() in assembler (-7 bytes)
2024-01-18 09:09:38 +01:00
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
rumbledethumps
2138f3c902
add clock() to RP6502
2024-01-10 21:24:55 -08: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