1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-30 01:29:37 +00:00
Commit Graph

3092 Commits

Author SHA1 Message Date
mrdudz
1f2fdbd9b1 implemented conio peek functions for PCE target 2020-07-14 14:23:58 +02:00
Olli Savia
a43cac580e Tiny optimization 2020-07-13 10:14:21 +02:00
Oliver Schmidt
bcb8b49907 Removed executable bit. 2020-07-12 23:11:43 +02:00
Oliver Schmidt
04cc463452 Implemented some CONIO peek functions.
Please refer to https://github.com/cc65/cc65/pull/532 for background info.

I wrote in https://sourceforge.net/p/cc65/mailman/message/35873183/

===
cputs() wraps to the next line if the strings is too long to fit in the current line. I don't know if it's worth the effort to allow cpeeks() to continue reading from the next line. I'd like to discuss this aspect with the actual implementers.
===

This is still as unclear today as it was when I wrote the above. Therefore this change just doesn't add cpeeks() at all.

Since f8c6c58373 the Apple II CONIO implementation doesn't "need" revers() anymore - meaning that (nearly) every possible value can be placed in VRAM with a straight cputc() (without the need for a previous revers(1)).

The implementation of cpeekc() leverages that cputc() ability by always returning the value that can be fed into cputc() without a previous revers(1). Accordingly, cpeekrevers() always returns 0.

So after the sequence revers(1); cputc(x); a cpeekc() will return a value different from x! However, I don't see this behavior braking the cpeekc() contract. I see the cpeekc() contract being defined by the sequence textcolor(cpeekcolor()); revers(cpeekrevers()); cputc(cpeekc()); placing the very same value in VRAM that there was before. And that contract is fulfilled.
2020-07-12 22:19:55 +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
Greg King
410e4502ee Added a 160x192x2 TGI (graphics) driver to the VIC-20 library.
The driver requires a special linker configuration: "vic20-tgi.cfg".
The VIC-20 computer needs at least 8K of expansion RAM!

"tgidemo.c" needed to be adjusted because the VIC-20's vertical (y) range is greater than its horizontal (x) range -- the opposite of most other platforms.  Also, the circle demo would jam on the VIC-20.
2020-07-08 05:55:30 -04: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
Oliver Schmidt
37107174c6 Added waitvsync() for the Enhanced Apple //e.
The implementation is a bit tricky as it requires to take different code paths for the //e, the //c and the IIgs. Additionally the //c only provides a VBL IRQ flag supposed to be used by an IRQ handler to determine what triggered the IRQ. However, masking IRQs on the CPU, activating the VBL IRQ, clearing any pending VBL IRQs and then polling for the IRQ flag does the trick.
2020-06-18 21:44:57 +02:00
Oliver Schmidt
e0a0b2dc25 Streamlined machine detection. 2020-06-15 19:31:18 +02:00
Oliver Schmidt
6adf175691 Optimized get_ostype() return values for asm usage.
Making sure that all but //c machines have bit 6 clear allows to use BIT/BVS to detect the //c machines.
2020-06-15 19:31:18 +02:00
Oliver Schmidt
20a9c0c336 Replaced call to paddle read ROM routine with custom code.
As described e.g. in the Apple IIe Technote #6: 'The Apple II Paddle Circuits' it doesn't work to call PREAD several times in immediate succession. However, so far the Apple II joystick driver did just that in order to read the two joystick axis.

Therefore the driver now uses a custom routine that reads both paddles _at_the_same_time_. The code doing so requires nearly twice the cycles meaning that the overall time for a joy_read() stays roughly the same. However, twice the cycles in the read loop means half the resolution. But for the cc65 joystick driver use case that doesn't hurt at all as the driver is supposed to only detect neutral vs. left/right and up/down.

CPU accelerators are supposed to detect access to $C070 and slow down for some time automatically. However, the IIgs rather comes with a modified ROM routine. Therefore it is necessary to manually slow down the IIgs when replacing the ROM routine.
2020-06-06 15:15:13 +02:00
Oliver Schmidt
7b2e4d0c7f Reflect that the Apple //c supports only one joystick. 2020-06-04 23:24:24 +02:00
Oliver Schmidt
15e2afcdf3 Split libref.s into multiple files to prevent inclusion of unnecessary code. 2020-06-04 23:24:24 +02:00
Greg King
14c62f1368 Allowed the TGI API to support 256 colors. 2020-06-04 12:58:05 -04:00
jede
6521930880 Fixed the name of the driver 2020-05-28 08:50:20 -04:00
jede
6c2d578c61 Fix eor bug 2020-05-28 08:50:20 -04:00
jede
50192fc65e Change name of the driver (telestrat-joy.s renamed to telestrat.s 2020-05-28 08:50:20 -04:00
jede
1d358a4734 Fix bug 2020-05-28 08:50:20 -04:00
jede
e8b1d51d28 Fix typo 2020-05-28 08:50:20 -04:00
jede
cd7abdb58d Fix typo 2020-05-28 08:50:20 -04:00
jede
532240a2db Telestrat joystick management 2020-05-28 08:50:20 -04:00
Oliver Schmidt
5b56c6e3a2 Disable potentially enabled double-width graphics. 2020-05-04 22:23:01 +02:00
Greg King
cbf0c1d1dd Updated the cx16 library to the Commander X16's ROM prerelease 37. 2020-05-02 13:46:06 -04:00
Stefan
4a224878d8 Preserve the accu 2020-04-06 18:13:54 +02:00
Oliver Schmidt
0981c020b2 Shortened names and adjusted style. 2020-04-02 22:58:16 +02:00
Oliver Schmidt
411fe87f64 Fixed tolower() and toupper() to save high byte. 2020-04-02 22:14:22 +02:00
Oliver Schmidt
df015f4766 Adjusted tolower() and toupper() to https://github.com/cc65/cc65/pull/997
For some reason or another both the author of the PR in question and its reviewers didn't notice that the two functions in question were totally overlooked.
2020-04-02 11:15:53 +02:00
Oliver Schmidt
65dd931d22 Some style adjustments. 2020-04-02 10:42:06 +02:00
Oliver Schmidt
4cc95a2c6c Matched comment to the one in the C header file. 2020-04-02 09:45:11 +02:00
Oliver Schmidt
a53bd345d8
Adjusted comments due to recent change. 2020-03-26 12:29:56 +01:00
Jeremy Rand
62eb3137ab Update get_ostype.s
Do not check $fbbe when detecting the Apple //e card.  This byte is a version number for the Apple //e card according to misc technote #7 and it appears that the last version of the software that I am aware of has a 3 at this location.

Prior to this change, Apple //e cards which we not version 0 would be detected as an Apple //e enhanced.
2020-03-26 12:25:41 +01:00
Oliver Schmidt
b91ad02da1 Made use of 65C02 opcode (thx to polluks). 2020-03-05 14:38:36 +01:00
jede
0962a9f286 Fix 16 bits values 2020-02-13 05:46:46 -05:00
jede
026e57279d Fix bug in tgi_line : HRS(X) parameters are 16 bits. 2020-02-13 05:46:46 -05:00
IrgendwerA8
08705a3fdc Changes resulting from 2nd code review 2020-02-03 20:45:09 +01:00
IrgendwerA8
002d1801ec Changes resulting from code review. 2020-02-03 20:45:09 +01:00
IrgendwerA8
ce80624f62 ctype size optimization 2020-02-03 20:45:09 +01:00
mrdudz
a59402d5f5 store y first, then a. fix by willymanilly 2020-01-26 02:18:04 +01:00
Oliver Schmidt
0f08ae2c12 Minor cleanup. 2020-01-18 19:29:24 +01:00
Greg King
b66f7272af Updated the cx16 library to the ROM's prerelease 36. 2020-01-11 02:20:52 -05: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
Greg King
b56ba8f073 Added real-time clock functions to the cx16 library. 2019-12-27 18:07:37 -05:00
Greg King
f067c4530f Made the program-chaining exec() handle the X16 emulator's file-system. 2019-12-25 14:53:32 -05:00
Greg King
3fa253d31f Updated the cx16 library to the Commander X16 Kernal's prerelease 35. 2019-12-25 10:56:32 -05:00
Stefan
d1fd7ffc59 Update status.s 2019-11-20 12:54:47 +01:00
Stefan
9d4d00737e Update slow.s 2019-11-20 12:54:47 +01:00
Stefan
eeefd10f8f Update revers.s 2019-11-20 12:54:47 +01:00
Stefan
2c34723a97 Update isfast.s 2019-11-20 12:54:47 +01:00
Stefan
df752ff7a5 Update fast.s 2019-11-20 12:54:47 +01:00
Stefan
3f360fe3ee Update cputc.s 2019-11-20 12:54:47 +01:00
Stefan
06c98952fc Update conio.s 2019-11-20 12:54:47 +01:00
Stefan
4497998944 Update color.s 2019-11-20 12:54:47 +01:00
Stefan
d9a6fbac48 Fixed C16 #978 2019-11-20 12:54:47 +01:00
mc78
db971d8a65 Removed unnecessary #include <cc65.h> from convert.c
Adjusted block comments to predominant style
2019-11-19 14:08:00 +01:00
mc78
8d2617110f Removed additional exit constants definitions from cc65.h to stdlih.h. Guarded the definitions by #ifdef. Removed cc65.h includes from abort and assert implementations. 2019-11-19 14:08:00 +01:00
mc78
a139c4057c Removed CC65_ prefixes from exit statements in abort and assert code as well from definition 2019-11-19 14:08:00 +01:00
mc78
16a66f19e1 Replaced enum in cc65.h by defines. added comment that cc65 exit constants should not redefine 0 and 1 as they are reserved for exit_success and exit_failure 2019-11-19 14:08:00 +01:00
mc78
694dd9240f Added comment to debugger exit with error 2019-11-19 14:08:00 +01:00
mc78
3daecfb3dd Added enum for cc65 exit codes. replaced stdlib exit code names constants in libsrc with cc65 exit code named constants 2019-11-19 14:08:00 +01:00
Greg King
5da525e0ea Added a standard mouse driver to the cx16 library. 2019-11-16 14:51:24 -05:00
Greg King
d78133e1f0 Updated cx16 to match the Commander X16 ROMs and emulator, release 34. 2019-11-16 13:11:40 -05:00
Greg King
ac4866c027 Made assert() send SIGABRT when an assertion fails.
A signal handler can catch it, and do anything needed to make stderr work.
2019-11-10 12:46:01 -05:00
Piotr Fusik
d38417b347 Optimize sign extension. 2019-11-07 21:45:19 +01:00
Piotr Fusik
985371433b Swap the positive/negative paths to save a branch. 2019-11-07 21:45:19 +01:00
Piotr Fusik
421c3f2b4f Don't set carry when already set. 2019-11-07 21:45:19 +01:00
Piotr Fusik
2bec637637 Optimize a negation in signed division. 2019-11-07 21:45:19 +01:00
Richard Halkyard
0d21a2b5a4 Reformat comments to style guide rules 2019-11-02 11:21:50 +01:00
Fabrizio Caruso
2bd798fa13 Optimizations 2019-10-30 18:00:27 -04:00
Fabrizio Caruso
78d660da55 kbhit checks KBEDG and getc resets KBEDG 2019-10-30 18:00:27 -04:00
Fabrizio Caruso
43f24afe29 stz 2019-10-30 18:00:27 -04:00
Fabrizio Caruso
609f63ac74 Second tentative fix 2019-10-30 18:00:27 -04:00
Curt J. Sampson
1d39863a60 vic20/cputc: Fix incorrect CRAM_PTR at startup when using conio
To do this we add a constructor call to UPDCRAMPTR, which is the ROM
routine that fixes up CRAM_PTR to match the screen location pointed to
by SCREEN_PTR.

This adds two additional bytes to programs using cputc() or other
routines that call it. These are in theory recoverable, but the VIC-20
does not yet free space used by constructors after the constructors
have been called.

Thanks to <greg.king5@verizon.net> (GitHub: greg-king5) for
investigating the difference in the VIC-20 KERNAL from the C64 and
proposing this solution to the problem.[1]

[1]: https://github.com/cc65/cc65/issues/946#issuecomment-538502820
2019-10-25 16:03:38 -04: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
Greg King
9fa90e2265 Added VERA peek() and poke() to the cx16 library.
They simplify C programs' direct access to VERA's internal address space.
2019-10-24 05:15:42 -04:00
Fabrizio Caruso
1074d35a15 remove bra 2019-10-18 11:15:54 -04:00
Fabrizio Caruso
e4b60e1068 Remove useless tax 2019-10-18 11:15:54 -04:00
Fabrizio Caruso
da01286037 Tentative solution for cgetc in Lynx 2019-10-18 11:15:54 -04:00
Stephan Mühlstrasser
55444b8337 Removed redundant LDA
After the removal of the redundant AND in commit
704c8df04f also the
subsequent LDA became redundant.
2019-10-15 09:38:23 -04:00
Stephan Mühlstrasser
7547c4c77c Address review comments
- removed typo from comment
- removed redundant AND instruction
2019-10-15 09:38:23 -04:00
Stephan Mühlstrasser
eb2317d014 Restructured according to review
Restructured according to review in pull request #567.

The "inputc" function was moved in slightly modified form
to kbhit.s and replaces the old keyboard scanner.
cgetc() uses the new kbhit() to read a character.
2019-10-15 09:38:23 -04:00
Jeff Tranter
e2007d0743 New OSI input routine based on disassembly of ROM code. 2019-10-15 09:38:23 -04:00
Fabrizio Caruso
9a3e521358 small m and n fixed 2019-10-13 09:03:46 -04:00
Fabrizio Caruso
bac6f94929 Fix 127 (second left arrow) 2019-10-13 09:03:46 -04:00
Fabrizio Caruso
b91e233714 Fix left arrow (char 77=13+64) 2019-10-13 09:03:46 -04:00
Fabrizio Caruso
d04f7935c3 M N fixed 2019-10-13 09:03:46 -04:00
Fabrizio Caruso
0210d76694 Fix 4 2019-10-13 09:03:46 -04:00
Fabrizio Caruso
5eda1c256c Fix char 35 38 42 47 52 2019-10-13 09:03:46 -04:00
LRFLEW
e660a49347 [cx16] Update ROM banks to new mapping 2019-10-12 04:51:27 -04:00
Greg King
f3f15cfd25 Fixed problems with the Atari Lynx's TGI driver.
* The sprite-types for black and transparent backgrounds were swapped.
* A filler-byte for text output isn't printed.  (A hardware bug might not need that work-around in most cases.)
2019-10-12 04:01:03 -04:00
LRFLEW
216105f6df Update comments in rand.s 2019-10-09 17:09:05 +02:00
LRFLEW
3994fee595 Significantly faster rand() implementation 2019-10-09 17:09:05 +02:00
Fabrizio Caruso
fb260ef17f Init is no longer in crt0.s 2019-10-09 17:01:02 +02:00
Fabrizio Caruso
40cf719068 Use decimal for lcd size initialization 2019-10-09 17:01:02 +02:00
Fabrizio Caruso
915836b3ec Improve init code readability 2019-10-09 17:01:02 +02:00
Fabrizio Caruso
cdb8035cf0 Move screen init into crt0.s 2019-10-09 17:01:02 +02:00
Fabrizio Caruso
9bd92178b6 Fix Gamate RVS 2019-10-04 10:22:25 +02:00
Greg King
9dfc8f84bc Fixed cgetc().
The GETIN function doesn't protect CPU registers.
2019-10-01 05:30:36 -04:00
Greg King
2546c6ba1c Put the C64 code into cx16/_scrsize.s.
(I forgot that SCREEN is an official jumptable function.
2019-09-28 01:38:16 -04:00
Greg King
6cae84a25d Updated the cx16 start-up to the emulator's release 32.
Made the Kernal ROM be visible when programs start.
2019-09-28 00:54:27 -04:00
Greg King
18afc7c703 Created a target and a library for the Commander X16 prototype computer. 2019-09-27 03:38:51 -04:00
Oliver Schmidt
3b128ba59f Use MACHID to check for realtime clock.
There's no need to do guesswork to know if a realtime clock is present/active.
2019-09-10 09:49:06 +02:00
jede
3d63a8bb62 Cleaning 2019-07-31 18:07:28 +02:00
jede
3b07b8b8e3 Add cclear and cclearxy 2019-07-31 18:07:28 +02:00
jede
cceffbdb8c Fix bug $FF 2019-07-21 14:11:51 -04:00
jede
e7bb0aad19 Fix comment and gotox force colour change 2019-07-21 14:11:51 -04:00
jede
996537282c Cleaning import variables 2019-07-21 14:11:51 -04:00
jede
848df36f6b Optimize Clrscr 2019-07-21 14:11:51 -04:00
jede
0fe98a7ca8 Fix bgcolor and textcolor must return last color, jmp remove. 2019-07-21 14:11:51 -04:00
jede
f9e13abc11 jmp instead of jsr 2019-07-21 14:11:51 -04:00
jede
ede64f68a9 Fix bug with bgcolor and textcolor 2019-07-21 14:11:51 -04:00
jede
6f7f6b5119 Fix label, optimize code 2019-07-21 14:11:51 -04:00
jede
a0a6537bda Fix typo and optimize 2019-07-21 14:11:51 -04:00
jede
28eba8bff9 fix import 2019-07-21 14:11:51 -04:00
jede
7767a0e88e fix typo 2019-07-21 14:11:51 -04:00
jede
3d5811d8f5 Fix gotoy changecolor 2019-07-21 14:11:51 -04:00
jede
7f9e73a1ce Add textcolor and bgcolor.s 2019-07-21 14:11:51 -04:00
jede
14ac1a7ff6 Fix bug : gotoxy does not working because Y does not update the adress on the screen 2019-07-21 14:11:51 -04:00
Björn Esser
93b6efcb2f zlib: Use correct (un)signedness of char in prototypes and functions.
Also ensure we are using the same constness qualifiers.
2019-06-19 19:01:30 +02:00
Oliver Schmidt
6efb71bea7 Rearranged paravirt function vector.
- exit right below 6502 vectors.
- keep exit addr stable as it may be called from asm.
2019-05-30 00:10:17 +02:00
Oliver Schmidt
c6bbea0bb0 Renamed program start label. 2019-05-30 00:06:31 +02:00
bbbradsmith
9fcd91ebe9 sim65 header comment fix 2019-05-29 22:56:51 +02:00
bbbradsmith
fb7d4acd5c versionable header for sim65
load and run address now configured from header
fix error codes not to conflict with test
fix test/misc/endless.c which is supposed to fail if an endless loop does not occur
2019-05-29 22:56:51 +02:00
bbbradsmith
2f3cae0d2e movable sp for sim65 2019-05-29 22:56:51 +02:00
Oliver Schmidt
ac0b452834 Added '_' prefix to sin and cos.
Users complained that otherwise the names might clash with their functions.
2019-04-13 11:25:54 +02:00
Christian Groessler
03311e7268 atari5200: update docs for recent conio changes
also renames libsrc/atari5200/extra/conioscreen_20x12.s to
libsrc/atari5200/extra/conioscreen-20x12.s to be in line with
other optional link modules
2019-04-13 11:07:06 +02:00
Christian Groessler
78daf84f12 atari5200: name conio constructor 'initconio' 2019-04-12 12:49:38 +02:00
Christian Groessler
e1e6bec9ff atari5200: changes from discussions in #870
- rename screen_setup to initconio
- use Greg King's version of bgcolor()
2019-04-12 12:49:38 +02:00
Christian Groessler
d7eecb57f8 atari5200: get rid of conio_colors table
use system color variables instead; improve testcode/lib/atari5200/hello.c
test program
2019-04-12 12:49:38 +02:00
Christian Groessler
be6bba66a9 atari5200: conio now uses just four colors altogether
See discussion in PR #870.
2019-04-12 12:49:38 +02:00
Christian Groessler
79b9a8d2df atari5200: add screensize function 2019-04-12 12:49:38 +02:00
Christian Groessler
db01036e2e atari5200: add alternative conio screen (20x12 resolution) 2019-04-12 12:49:38 +02:00
Christian Groessler
ec5e38617a atari5200: implement bgcolor() and textcolor()
Includes some other small fixes/cleanups.
2019-04-12 12:49:38 +02:00
Christian Groessler
edd596b2a4 atari: split color.s into bordercolor.s and bgcolor.s 2019-04-12 12:49:38 +02:00
Oliver Schmidt
fc6a63a15e Avoid unintended file "shadowing".
3d8c3a4948 caused an unintended "shadowing" of files in /libsrc/runtime by files in /libsrc/common. Therefore the files in question are renamed (again) in /libsrc/common to make the files in /libsrc/runtime "visible" again.
2019-04-04 09:16:59 +02:00
IrgendwerA8
3d8c3a4948 Code review adaptations, removed "cc65_" prefix from functions 2019-03-29 22:53:04 +01:00
IrgendwerA8
db8bd84a82 Changes due to code review. 2019-03-29 22:53:04 +01:00
IrgendwerA8
399250a105 Optimized mul20 & mul40 and extracted to new library. 2019-03-29 22:53:04 +01: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
IrgendwerA8
e1a4910580 Code review changes and build fix. 2019-03-04 23:32:56 +01:00
IrgendwerA8
cc6559c3f6 Minor math optimizations 2019-02-28 19:48:29 +01:00