Commit Graph

281 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 f8f901b05e remove dangling spaces 2022-04-17 16:06:22 +02:00
Jeff Tranter 2bf8be5b3b Fix some commonly made spelling errors in comments. 2022-02-21 15:44:31 -05: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
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
Greg King 9023e975df Stopped the C128 mouse drivers from blocking certain keys such as '1', '2', and 'Q'.
This extra fix is needed because the C128 keyboard scanner works a little differently than the C64 scanner works.
Fixes #696. Fixes #853.
2020-07-14 16:06:21 -04:00
Oliver Schmidt bcb8b49907 Removed executable bit. 2020-07-12 23:11:43 +02:00
mrdudz d1833cc441 Fix handling of charcodes 254 and 255, fixes issue #988 2020-07-08 00:48:39 +02:00
mrdudz a59402d5f5 store y first, then a. fix by willymanilly 2020-01-26 02:18:04 +01:00
mc78 244dc358e5 Changed the order in which lo/hi bytes of vdc addr are set according to willimanilys ((z64k) suggestions. Changed offset for vdc ramsize detection from 000 to 000. 2020-01-03 13:51:20 -05:00
mc78 390878e831 Added reservation of second byte for pagecount 2020-01-03 13:51:20 -05:00
mc78 2a42139674 Changes in INSTALL routine from emd/c128-vdc.s.
tmp1 was used at two places resulting in the bug that VDC_CSET was set to garbage on 16k VDC.
pagecount and curpage were not reset on INSTALL resulting in non-reentrant code on static linkage of emd driver.
2020-01-03 13:51:20 -05: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 7147e780e6 Added SER_ prefix. Whitespace cleanup 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
greg-king5 a08192b53e
Merge pull request #706 from xlar54/master
* tgi driver for c128 VIC-II

* Made the VIC-IIe TGI driver put its bitmap behind the ROMs.

* c128-hi.tgi doc
2018-08-29 10:34:05 -04: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
Greg King 5e67eee362 Made the VIC-IIe TGI driver put its bitmap behind the ROMs. 2018-07-29 23:46:03 -04:00
Scott Hutter 1981af0bbd tgi driver for c128 VIC-II 2018-07-23 15:54:15 -05:00
Olli Savia 3e94f7f55c Moved C128 specific definitions to cbm_kernal.inc 2018-07-01 09:58:39 +03: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 f7fbac4c6b Use common include file cbmkernal.inc 2018-06-27 21:39:24 +03:00
Oliver Schmidt 47e4b36180
Merge pull request #631 from blackystardust/master
Added C64 Chameleon accelerator code and documentation.
2018-04-27 20:47:03 +02:00
Marco van den Heuvel 97e69952c4 Removed extern keyword from function prototypes. 2018-04-27 09:16:25 -07:00
Greg King c92a3c5bd5 Improved the accelerator code. Fixed an infinite loop.
Removed the execute permissions from some files.
2018-04-26 05:46:34 -04:00
Marco van den Heuvel cc2bcb8a4d Changed c128 accelerator code and documention to include both C64 and C128 support. 2018-04-23 19:25:11 -07:00
Marco van den Heuvel 89c3ed6d7f Added C64/C128 SuperCPU accelerator functions and started on a generic framework for accelerators. 2018-04-09 19:36:53 -07:00
Greg King b844572159 Moved most of the tgi_colors.s files into the libsrc/common/ directory.
Only the Apple2 and Lynx platforms use different codes for the white color; they have their own files.
2018-03-27 07:28:46 -04:00
Marco van den Heuvel d34c93a464 Set X register to 0 so that 16bit promotion works as expected. 2018-03-20 14:05:55 -07:00
Marco van den Heuvel 5d4116f05f Added isfast function which returns a 1 when the C128 is in 2MHz mode. 2018-03-20 13:11:24 -07:00
Marco van den Heuvel b783280577 Replaced reu commands with defined constants. 2018-03-05 17:46:51 -08:00
Marco van den Heuvel 40e93dd931 Improved reu size detection. 2018-03-05 15:01:55 -08:00
Oliver Schmidt dacee3b9ed Removed IRQ support from TGI drivers.
All but one TGI drivers didn't use IRQs. Especially when the TGI driver kernel was the only .interruptor this meant quite some unnecessary overhead because it pulled in the whole IRQ infrastructure.

The one driver using IRQs (the graphics driver for the 160x102x16 mode on the Lynx) now uses a library reference to set up a JMP to its IRQ handler.
2018-02-02 18:15:45 +01:00
Oliver Schmidt 1976d6cd32 Removed IRQ support from joystick drivers.
All but one joystick drivers didn't use IRQs. Espsecially when the joystick driver kernel was the only .interruptor this meant quite some unnecessary overhead because it pulled in the whole IRQ infrastructure.

I was told that the one driver using IRQs (the DXS/HIT-4 Player joystick driver for the C64) can be reworked to not do it. Until this is done that driver is defunct.
2018-02-01 22:38:36 +01:00
mrdudz 892732f340 fix cpeeks() for C128 VDC 2017-12-12 17:05:24 +01:00
mrdudz 74b5540f76 copy cpeeks from generic version, this at least makes it work for 40 columns 2017-12-12 03:48:43 +01:00
mrdudz 9a609f6766 fix petscii conversion for C128 2017-12-11 21:53:00 +01:00
mrdudz 8902730756 cbm stuff from greggs pull request 2017-12-11 19:52:11 +01:00