Commit Graph

380 Commits

Author SHA1 Message Date
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 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 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
mrdudz ffa83c32a4 clean-up of driver return codes 2023-02-26 20:03:41 +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 89c08dc6d4 extra underscores for _randomize and _swap 2022-08-29 20:52:35 +02:00
mrdudz 8e19d84cb4 detect number of RAM pages 2022-07-24 02:47:02 +02:00
mrdudz 3cb3d5dad3 cleanup 2022-07-21 03:45:40 +02:00
mrdudz 86091ac6bf some cleanup 2022-07-21 03:43:54 +02:00
mrdudz a55807f682 cleanup 2022-07-21 03:30:47 +02:00
mrdudz c6f23eefc8 remove dangling spaces 2022-07-21 03:20:44 +02:00
Jeff Tranter ba13ba32a1 Fix some commonly made spelling errors in comments. 2022-07-21 03:18:13 +02:00
Bob Andrews c0c89a81e4
Merge branch 'master' into rremd 2021-12-11 22:36:12 +01:00
Gabriele Gorla 6637e28831 saves 2 bytes in the standard c64 joystick driver
remove redundant code and add jmp to the common sequence
two more bytes could be saved at the expense of longer sequence with interrupts disabled by moving sei/cli
2021-11-23 21:34:49 +01:00
Greg King 5f145542b0 Exported the Commodore CHRIN and CHROUT Kernal functions, in the CBM libraries.
This commit complements commit 98f8064b83.
2021-03-03 17:39:53 -05:00
Polluks 9563541870 crt0 clean-up 2020-11-29 18:08:33 +01:00
Greg King a0d986faf8 Fixed the horizontal movement of the mouse pointer on platforms with the VIC-II display chip.
ca65's logical (Boolean) NOT operator was used where bitwise NOT should be used.  The effect was that all sprites were shifted to the left side of a screen when the mouse sprite was put on the left side.
2020-11-27 21:22:22 -05:00
Greg King dc14751954 Exported the direct Kernal entries that were moved from target headers to "cbm_kernal.inc". 2020-09-22 00:04:24 -04:00
compyx 81d3dedb41 Move comment block as requested 2020-07-24 15:24:28 -04:00
compyx 294b5d1cf1 C64 soft80 conio: shave off a few bytes and cycles 2020-07-24 15:24:28 -04:00
Oliver Schmidt bcb8b49907 Removed executable bit. 2020-07-12 23:11:43 +02:00
compyx 381a32d9aa C64 soft80-conio cgetc: save 14 cycles in `invertcursor`
By 'inverting' the loop, we can save 16 cycles by removing the `cpy #8`,
saving 16 cycles. But we need an extra `ldy #7` at the start of the
loop, so the total cycles saved is 14. Code size doesn't increase due to
the addition of the `ldy #7` negating the removal of the `cpy #xx`.
2020-07-11 17:46:29 +02:00
compyx 2c4dd5decf Shorten comment as requested 2020-07-11 11:59:45 +02:00
compyx e45e57d7ce C64 soft80 conio: save 4 bytes in `firstinit`
Also save 6 cycles as a very small bonus.
2020-07-11 11:59:45 +02:00
compyx fb7996b0ce Revert "C64 soft80 conio: save 6 bytes in `firstinit`"
This reverts commit 943e68be6a.
2020-07-11 11:59:45 +02:00
compyx 695b1b01d8 C64 soft80 conio: save 6 bytes in `firstinit`
As a bonus, save 6 cycles.
2020-07-11 11:59:45 +02:00
mrdudz d1833cc441 Fix handling of charcodes 254 and 255, fixes issue #988 2020-07-08 00:48:39 +02:00
Dirk Jagdmann aaecf3cfec replace JMP with BEQ to save 1 byte. 2020-06-22 23:55:45 +02:00
Dirk Jagdmann 070264acc4 remove tab characters. 2020-06-22 23:55:45 +02:00
Dirk Jagdmann 76091b96d4 C64 Kerberos extended memory driver 2020-06-22 23:55:45 +02:00
Richard Halkyard 0d21a2b5a4 Reformat comments to style guide rules 2019-11-02 11:21:50 +01:00
Curt J. Sampson 128991d868 libsrc/*/kplot.s: Use cbm_kernal.inc symbols, not hardcoded addrs
On C64, VIC-20 and Plus/4, the conio library PLOT routine uses direct
calls into the Kernal, including the Kernal PLOT routine that we're
replacing. These were previously hardcoded addresses; we change these
to use the symbols for those routines defined in cbm_kernal.inc. (This
changes no functionality.)

To do this, we need to import cbm_kernal.inc in a namespace so we
don't have a collision between the PLOT that we're defining and the
Kernal definition.

We also add a UPDCRAMPTR symbol (used by kplot for VIC-20 and C64) to
the direct entry kernal routines in in cbm_kernal.inc, and expand the
comments describing what the "direct entry" Kernal routines are.

<greg.king5@verizon.net> (GitHub: greg-king5) came up with this idea
and did initial testing of it.

This has been tested on VICE xvic, x64 and xplus4 emulators with a
program that does a cputs() call (github.com/0cjs/vic20cc65) to
confirm that it works the same way after as it did before.
2019-10-25 16:03:38 -04:00
Bas Wassink 96d0b00a76 Merge https://github.com/cc65/cc65
Pull to fix extra changes in PR #863
2019-03-24 20:49:53 +01:00
Bas Wassink 2eac69a943 Remove trailings spaces from CBM-related asm files 2019-03-22 22:54:05 +01:00
Olli Savia 7b4807a8f7 Changed prefix SWL_ to SER_ 2018-11-26 22:14:31 +01:00
Olli Savia aeff90ca90 Updated to use cbm_kernal.inc. Whitespace cleanups 2018-11-26 22:14:31 +01:00
Oliver Schmidt 40f42e977f Adjusted comments to match actual prototypes. 2018-11-06 11:13:23 +01:00
Oliver Schmidt fe5af26f9f Express assumption about struct timespec.
We basically cast a struct timespec pointer to a time_t pointer when we pass the clock_settime() paramter to localtime(). Explicitly express that in the source code.
2018-08-18 01:29:40 +02:00
Oliver Schmidt eb9872c684 Added clock_settime() for some CBMs.
The CIA TOD only stores the time but not the date. Therefore the date set by clock_settime() ist just stored inside the C library for retrieval via clock_gettime().

The "very special" handling of 12AM/PM is based on https://groups.google.com/d/msg/comp.sys.cbm/ysVYSX4AMbc/vHrXCWEhCOUJ saying:

==========

24hr: Wr => Rd => Nx
--------------------
  0 : 92 => 12 => 01   <= Switch from 00 to 01 (24-hour notation)
  1 : 01 => 01 => 02
  2 : 02 => 02 => 03
 11 : 11 => 11 => 92
 12 : 12 => 92 => 81   <= Switch from 12 to 13 (24-hour notation)
 13 : 81 => 81 => 82
 14 : 82 => 82 => 83
 23 : 91 => 91 => 12

1. column ("24hr"): hour to be tested (decimal)
2. column ("Wr"):   hour written to TOD register (BCD)
3. column ("Rd"):   hour read from TOD register (BCD) immediately after writing the value in column 2 to see the conversion between AM/PM, if any
4. column ("Nx"):   next hour (BCD) after the hour switch

==========

Thanks Paul!
2018-08-18 01:29:40 +02:00
Oliver Schmidt cb7ec508f6 Fixed 12 AM/PM handling.
Midnight is 12 AM and noon is 12 PM (see https://en.wikipedia.org/wiki/12-hour_clock). Therefore we need to subtract 12 hours in exactly those two hours.
2018-08-18 01:29:40 +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
Olli Savia 635a99c083 TAB to space conversion 2018-06-30 16:25:43 +03:00
Olli Savia 96e6a0a114 Common include file is now cbm_kernal.inc 2018-06-29 22:58:16 +03:00
Olli Savia 42e9b971c5 Merge remote-tracking branch 'upstream/master' into cbmkernal_stage2 2018-06-29 22:50:02 +03:00
Olli Savia f7fbac4c6b Use common include file cbmkernal.inc 2018-06-27 21:39:24 +03:00
Oliver Schmidt 86945a1270
Merge pull request #687 from polluks/patch-12
Smaller driver code
2018-06-21 22:37:29 +02:00
Stefan 6a70d1dab1
Removed unused label 2018-06-21 20:30:14 +00:00
greg-king5 4980fade74
Made LINE plot single-point lines correctly. 2018-06-21 08:18:53 -04:00
Stefan 23534beaa6
Smaller driver code 2018-06-21 00:25:33 +00:00
Stefan 472a107358
Make NMI ready 2018-05-14 23:22:09 +00:00