| |
Mr SQL
Registered: Feb 2023 Posts: 159 |
C64 Compatibility with C128 in depth
Very educational video on 8-bit show and tell:
http://www.youtube.com/watch?v=Ial2VSAu7tw
Robin illustrates using the built-in dissembler/Editor Assembler to correct hotspots where the C128 is incompatible with the C64.
The C128 is still closely compatible for having enhancements to the same hardware. I remember when the CoCo III came out the GIME did not fully emulate the 6847 VDG creating more incompatibilities, particularly with the semigraphics modes.
Interesting commentary at the end of the video regarding the C64 mode being better for game development. |
|
... 25 posts hidden. Click here to view all posts.... |
| |
Mr SQL
Registered: Feb 2023 Posts: 159 |
Quote: Spotting the problem in the basic program requires zero C64 knowledge, just basic programming 101
OK I took another look and it still looks like a difference on the C128 where bit 6 gets set for memory location 1 unless shift lock is pressed.
Instead of the default of 00110111 or 55 on the C64, Robin get's 01110111 or 119 which is 55+64 indicating the 6th bit is on.
Why is the C128 changing that default? My guess would be bit 6 is reserved for something else on the C128.
His BASIC code looks ok:
10 PRINT PEEK(1):GOTO 10
Is there another section with a BASIC Programming error? |
| |
ws
Registered: Apr 2012 Posts: 251 |
well he actually should have checked for the specific bit, not just compare the entire value. bad practice.
IF PEEK(1) AND 16 = 0 THEN PRINT "BIT 4 IS 0"
IF PEEK(1) AND 16 = 16 THEN PRINT "BIT 4 IS 1"
(given that we count the 8 bits as 0 to 7) |
| |
Mr SQL
Registered: Feb 2023 Posts: 159 |
Quote: well he actually should have checked for the specific bit, not just compare the entire value. bad practice.
IF PEEK(1) AND 16 = 0 THEN PRINT "BIT 4 IS 0"
IF PEEK(1) AND 16 = 16 THEN PRINT "BIT 4 IS 1"
(given that we count the 8 bits as 0 to 7)
Agree this is a best practice for checking the bits individually, but he is checking the default value for the byte at location zero. There are many different ways to program so I can't say his method is wrong.
This still looks like a genuine bug for the default not matching. I took a look at the C64 memory map I linked earlier and it agrees with Robin on the default value, the two highest bits should be off on the C64:
"Default: $37, %00110111" or decimal 55.
Interesting why bit 6 (bit 7 if counting 0 to 7) should be set on the C128. And why does shift-lock turn it back off?? |
| |
Mr SQL
Registered: Feb 2023 Posts: 159 |
Meant to say location 1 :) |
| |
ws
Registered: Apr 2012 Posts: 251 |
Relying on default values is never a good idea. Always check individual bits. Bit 6 and 7 of $0001 were formerly unused on the C64 so i guess using it to add some extra features for the extended C128 keyboard was a tolerable change? Thats perhaps why the caps-lock key needed to have an extra bit while not influencing other cruical registers? Just wild guessing.
It is described here http://www.zimmers.net/anonftp/pub/cbm/maps/C128_Mapping.pdf
(Pages 17/18 in the book, 14/15 in the pdf) |
| |
Mr SQL
Registered: Feb 2023 Posts: 159 |
Quote: Relying on default values is never a good idea. Always check individual bits. Bit 6 and 7 of $0001 were formerly unused on the C64 so i guess using it to add some extra features for the extended C128 keyboard was a tolerable change? Thats perhaps why the caps-lock key needed to have an extra bit while not influencing other cruical registers? Just wild guessing.
It is described here http://www.zimmers.net/anonftp/pub/cbm/maps/C128_Mapping.pdf
(Pages 17/18 in the book, 14/15 in the pdf)
I like that Compute manual, great reference book!
This change looks very redundant, it seems like that bit is used just to make it easier to tell if shift-lock is on without using the keyboard matrix. Maybe they should have deactivated it for closer C64 compatibility.
I think that could be a trap for C64 programmers using a C128. I remember it taking some time to figure out how to check for shift-lock on the 64, If I had a C128 instead I might have ended up using that feature in C64 mode to see if shift-lock was on and then the code would never have worked on an actual C64.
The shift-lock key is a very cool key because it's the only toggle switch on the machine besides the power switch. |
| |
MagerValp
Registered: Dec 2001 Posts: 1082 |
You seem to be missing the point. Robin intentionally wrote a buggy program to demonstrate the incompatibility. Of course it works if you properly check the bit. |
| |
oziphantom
Registered: Oct 2014 Posts: 502 |
it's the "caps lock" not "shift lock" key.
It's a tricky one as you could fix it with writing $6F to 0, but then if the person just so happens to have caps lock engaged it would damage the CPU.
Can't Bit 4 change as well? Does a datacassette nominally put out a 1 or tri-state unless being actively driven by Tape data? |
| |
Fungus
Registered: Sep 2002 Posts: 750 |
Quote: it's the "caps lock" not "shift lock" key.
It's a tricky one as you could fix it with writing $6F to 0, but then if the person just so happens to have caps lock engaged it would damage the CPU.
Can't Bit 4 change as well? Does a datacassette nominally put out a 1 or tri-state unless being actively driven by Tape data?
How would setting the data port to output or input damage the CPU? That sounds wrong to me.
Yes Robin said he intentionally wrote the program to demonstrate the bug. You misinterpret things when you glaze over stuff thinking you're right by default and the other person is wrong.
Of course not checking bits exclusively is bad practice, Robin knows that too. But older programmers made stuff for the C64 without any consideration for things like the 128, or even different versions of the C64. Hence why a lot of graphics look like crap on C64C and SIDs sound like crap on the 8580, or vice versa. Shouldn't even be on a horse about such things imo.
I missed the fact initially that the C128 has more stuff connected to the CPU port. I don't program the 128, nor do I care about it or issues related to it because my personal opinion is that it should have never been made and is an abomination. It's a miracle the thing even works (and sometimes doesn't). |
| |
Martin Piper
Registered: Nov 2007 Posts: 739 |
It depends on how "CAPLK SENSE" is driven: http://www.zimmers.net/anonftp/pub/cbm/schematics/computers/c12..
CPU U6 pin 24 (P6)
If that pin is set to output by the DDR (which is normally input) and if it drives a logic level driven opposite to the input logic level from caps lock, it might drain quite a bit of current. |
Previous - 1 | 2 | 3 | 4 - Next |