Updated BASIC and KERNAL disassembly
Moderator: Moderators
-
- Vic 20 Afficionado
- Posts: 355
- Joined: Thu Oct 13, 2016 11:35 am
- Location: Toronto
- Occupation: Programmer
Re: Updated BASIC and KERNAL disassembly
The disassembly is a fascinating read!
-
- Vic 20 Afficionado
- Posts: 355
- Joined: Thu Oct 13, 2016 11:35 am
- Location: Toronto
- Occupation: Programmer
Re: Updated BASIC and KERNAL disassembly
Incidentally, it doesn't assemble using xa65 for Linux (my usual asm.)
Here is the error log if you are interested. The -M flag tells the assembler to allow colons within comments, which is otherwise an error.
Looking at this closer it seem the lines that fail have a colon literal (for example) so I am going to guess this is actually a bug in how xa65 handles colons in the input!
The branch out of range errors are more interesting. I will have to look at those and see if they are false positives.
I will have to see who, if anyone, maintains xa65. It seems the package has a Debian maintainer.
EDIT: Reported the bug to the maintainer. BTW, the website for this assembler is http://www.floodgap.com/retrotech/xa/.
Here is the error log if you are interested. The -M flag tells the assembler to allow colons within comments, which is otherwise an error.
Looking at this closer it seem the lines that fail have a colon literal (for example
Code: Select all
SBC #':'
The branch out of range errors are more interesting. I will have to look at those and see if they are false positives.
I will have to see who, if anyone, maintains xa65. It seems the package has a Debian maintainer.
Code: Select all
bobbi@fluffy:~/VIC20$ xa -M -o foo combined_ROMs.asm
SBC #':' ; subtract ":"
combined_ROMs.asm:line 2204: c5d6:Syntax error
combined_ROMs.asm:line 2204: c5d6:Syntax error
CMP #TK_DATA-':' ; compare with the token for DATA-':'
combined_ROMs.asm:line 2208: c5da:Syntax error
combined_ROMs.asm:line 2208: c5da:Syntax error
SBC #TK_REM-':' ; subtract the token for REM-':'
combined_ROMs.asm:line 2216: c5e1:Syntax error
combined_ROMs.asm:line 2216: c5e1:Syntax error
CMP #':' ; compare with ":"
combined_ROMs.asm:line 2710: c809:Syntax error
combined_ROMs.asm:line 2710: c809:Syntax error
LDX #':' ; set look for character = ":"
combined_ROMs.asm:line 2980: c908:Syntax error
combined_ROMs.asm:line 2980: c908:Syntax error
LDA #':' ; set ":"
combined_ROMs.asm:line 3774: cc6d:Syntax error
combined_ROMs.asm:line 3774: cc6d:Syntax error
ADC #':' ; add character ":" ($30+$0A, result is 10 less that value)
combined_ROMs.asm:line 8061: def6:Syntax error
combined_ROMs.asm:line 8061: def6:Syntax error
CMP #':' ; compare with ":"
combined_ROMs.asm:line 8955: e392:Syntax error
combined_ROMs.asm:line 8955: e392:Syntax error
combined_ROMs.asm:line 4058: cdd1:Branch out of range error
combined_ROMs.asm:line 4062: cdd5:Branch out of range error
combined_ROMs.asm:line 4844: d0fc:Branch out of range error
combined_ROMs.asm:line 5041: d1c2:Branch out of range error
Break after 20 errors
-
- Vic 20 Afficionado
- Posts: 355
- Joined: Thu Oct 13, 2016 11:35 am
- Location: Toronto
- Occupation: Programmer
Re: Updated BASIC and KERNAL disassembly
If I replace all instances of ':' by $3a, then it assembles fine.
So that was the only issue.
Code: Select all
sed s/\':\'/\$3a/g <combined_ROMs.asm >combined_ROMS2.asm
xa -M -o rom.img combined_ROMS2.asm
Re: Updated BASIC and KERNAL disassembly
andre fachat is the author of xa, you should be able to contact him via 6502.org or sth
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
-
- Vic 20 Afficionado
- Posts: 355
- Joined: Thu Oct 13, 2016 11:35 am
- Location: Toronto
- Occupation: Programmer
Re: Updated BASIC and KERNAL disassembly
The maintainer email address I have is ckaiser@floodgap.com.
I don't know whether Andre still maintains it (it dates back to the 90s I believe, or even 80s).
I don't know whether Andre still maintains it (it dates back to the 90s I believe, or even 80s).
Re: Updated BASIC and KERNAL disassembly
I use xa and have already reported the issue. I run with a local patch but I think it caused a unit test to fail so hasn't been included.
Code: Select all
--- xa-2.3.6/src/xa.c.org 2014-07-10 20:22:32.000000000 +0100
+++ xa-2.3.6/src/xa.c 2014-08-14 21:01:33.757777896 +0100
@@ -1056,7 +1056,7 @@
do {
c=s[j]=l[i++];
- if (c=='\"')
+ if (c=='"' || c=='\'')
hkfl^=1;
if (c==';' && !hkfl)
comcom = 1;
Re: Updated BASIC and KERNAL disassembly
I've been steadily working through the remaining gaps in this, there are major updates to the RS-232 and screen routines. There's still some work to do, I could do with a maths wizard taking a look at some of the BASIC floating point routines and the low-level tape routines are incomplete.
The latest copy is always available here http://eden.mose.org.uk/gitweb/?p=rom-r ... ;a=summary
The latest copy is always available here http://eden.mose.org.uk/gitweb/?p=rom-r ... ;a=summary
-
- Vic 20 Afficionado
- Posts: 355
- Joined: Thu Oct 13, 2016 11:35 am
- Location: Toronto
- Occupation: Programmer
Re: Updated BASIC and KERNAL disassembly
Thank you so much for this!
I refer to your annotated disassembly quite a bit!!
Has anyone ever done this for the C64 ROMs? I am guessing they are not that different, but it would be interesting to compare and account for the differences.
I refer to your annotated disassembly quite a bit!!
Has anyone ever done this for the C64 ROMs? I am guessing they are not that different, but it would be interesting to compare and account for the differences.
Re: Updated BASIC and KERNAL disassembly
Here's another version with combined VIC/64 source:
https://github.com/sjgray/cbm-edit-rom/ ... rtKirk.asm
My site, but contributed by Edilbert. Included in one of my github projects.
Steve
https://github.com/sjgray/cbm-edit-rom/ ... rtKirk.asm
My site, but contributed by Edilbert. Included in one of my github projects.
Steve
-
- Vic 20 Afficionado
- Posts: 355
- Joined: Thu Oct 13, 2016 11:35 am
- Location: Toronto
- Occupation: Programmer
Re: Updated BASIC and KERNAL disassembly
Thank you --- I have some reading for the weekend now!!
Re: Updated BASIC and KERNAL disassembly
This is very useful for comparing VIC vs C64 code. Any ideas which C64 ROM version this is?sjgray wrote:Here's another version with combined VIC/64 source:
Simon
Re: Updated BASIC and KERNAL disassembly
It's version 3 as seen at line 17283.srowe wrote:This is very useful for comparing VIC vs C64 code. Any ideas which C64 ROM version this is?sjgray wrote:Here's another version with combined VIC/64 source:
Simon
Steve
Re: Updated BASIC and KERNAL disassembly
Just a note that there is a new release of xa that fixes the issue mentioned above.
- Mike
- Herr VC
- Posts: 4870
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Updated BASIC and KERNAL disassembly
Hi, Simon,
in line 263 of your (at the time I write this most recent) Super Expander source, it reads:
Some time ago I also had stumbled across this, as that one leads to unexpected behaviour of the [RESTORE] key with MINIMON. MINIMON itself plays nice as it checks for the A0CBM signature and lets a cartridge take precedence, however the BRK vector is also diverted and tapping [RESTORE] on its own now breaks into the monitor.
In the original course of action, the KERNAL BRK routine calls the lead out of the KERNAL NMI routine to do the BASIC warmstart, not the other way round. One can only think that indirect JMP in the SE code is a brainf*rt ... it really should have been JMP $A2C2 instead:
(... of course fixing it that way is only possible with a soft loaded copy of SE ...)
...
On a related note, I have a suggestion for your latest RS 232 fix (the one in BLK5). You set the warmstart entry to point to $0000, ...
... as some software could however divert the NMI vector or re-initialise it to the KERNAL default, you should rather point that entry to $FEC7 instead.
This continues the original NMI code after $FEC4 JMP ($A002), so when the KERNAL or some other program (like MINIMON) checks for the A0CBM signature, the KERNAL vectors are reset but at least it does not crash.
Greetings,
Michael
in line 263 of your (at the time I write this most recent) Super Expander source, it reads:
Code: Select all
263 JMP (CBINV) ; ?? handle restore via BRK vector ??
In the original course of action, the KERNAL BRK routine calls the lead out of the KERNAL NMI routine to do the BASIC warmstart, not the other way round. One can only think that indirect JMP in the SE code is a brainf*rt ... it really should have been JMP $A2C2 instead:
(... of course fixing it that way is only possible with a soft loaded copy of SE ...)
...
On a related note, I have a suggestion for your latest RS 232 fix (the one in BLK5). You set the warmstart entry to point to $0000, ...
Code: Select all
* = $A000
.WORD RSCOLD
.WORD 0 ; unused
.BYT "A0",'C'+$80,'B'+$80,'M'+$80
This continues the original NMI code after $FEC4 JMP ($A002), so when the KERNAL or some other program (like MINIMON) checks for the A0CBM signature, the KERNAL vectors are reset but at least it does not crash.
Greetings,
Michael