Updated BASIC and KERNAL disassembly

Basic and Machine Language

Moderator: Moderators

Bobbi
Vic 20 Afficionado
Posts: 347
Joined: Thu Oct 13, 2016 11:35 am
Location: Toronto
Occupation: Programmer

Re: Updated BASIC and KERNAL disassembly

Postby Bobbi » Fri Nov 04, 2016 6:41 am

The disassembly is a fascinating read!

Bobbi
Vic 20 Afficionado
Posts: 347
Joined: Thu Oct 13, 2016 11:35 am
Location: Toronto
Occupation: Programmer

Re: Updated BASIC and KERNAL disassembly

Postby Bobbi » Fri Nov 04, 2016 7:17 am

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

Code: Select all

SBC #':'
) 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.

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


EDIT: Reported the bug to the maintainer. BTW, the website for this assembler is http://www.floodgap.com/retrotech/xa/.

Bobbi
Vic 20 Afficionado
Posts: 347
Joined: Thu Oct 13, 2016 11:35 am
Location: Toronto
Occupation: Programmer

Re: Updated BASIC and KERNAL disassembly

Postby Bobbi » Fri Nov 04, 2016 7:37 am

If I replace all instances of ':' by $3a, then it assembles fine.

Code: Select all

sed s/\':\'/\$3a/g <combined_ROMs.asm >combined_ROMS2.asm
xa -M -o rom.img combined_ROMS2.asm


So that was the only issue.

groepaz
Vic 20 Nerd
Posts: 548
Joined: Wed Aug 25, 2010 5:30 pm

Re: Updated BASIC and KERNAL disassembly

Postby groepaz » Fri Nov 04, 2016 7:42 am

andre fachat is the author of xa, you should be able to contact him via 6502.org or sth

Bobbi
Vic 20 Afficionado
Posts: 347
Joined: Thu Oct 13, 2016 11:35 am
Location: Toronto
Occupation: Programmer

Re: Updated BASIC and KERNAL disassembly

Postby Bobbi » Fri Nov 04, 2016 7:55 am

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).

User avatar
srowe
Vic 20 Afficionado
Posts: 448
Joined: Mon Jun 16, 2014 3:19 pm

Re: Updated BASIC and KERNAL disassembly

Postby srowe » Fri Nov 04, 2016 12:25 pm

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;

User avatar
srowe
Vic 20 Afficionado
Posts: 448
Joined: Mon Jun 16, 2014 3:19 pm

Re: Updated BASIC and KERNAL disassembly

Postby srowe » Sat Apr 22, 2017 4:24 am

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.

basic_kernel.zip
(145.39 KiB) Downloaded 10 times


The latest copy is always available here http://eden.mose.org.uk/gitweb/?p=rom-reverse.git;a=summary

Bobbi
Vic 20 Afficionado
Posts: 347
Joined: Thu Oct 13, 2016 11:35 am
Location: Toronto
Occupation: Programmer

Re: Updated BASIC and KERNAL disassembly

Postby Bobbi » Sat Apr 22, 2017 1:04 pm

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.

User avatar
srowe
Vic 20 Afficionado
Posts: 448
Joined: Mon Jun 16, 2014 3:19 pm

Re: Updated BASIC and KERNAL disassembly

Postby srowe » Sat Apr 22, 2017 1:32 pm

There's some on GitHub

https://github.com/mist64/c64rom

sjgray
Vic 20 Hobbyist
Posts: 101
Joined: Thu May 03, 2007 6:46 pm
Location: Markham, ON, Canada

Re: Updated BASIC and KERNAL disassembly

Postby sjgray » Sat Apr 22, 2017 3:55 pm

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

Bobbi
Vic 20 Afficionado
Posts: 347
Joined: Thu Oct 13, 2016 11:35 am
Location: Toronto
Occupation: Programmer

Re: Updated BASIC and KERNAL disassembly

Postby Bobbi » Sat Apr 22, 2017 4:25 pm

Thank you --- I have some reading for the weekend now!!

User avatar
srowe
Vic 20 Afficionado
Posts: 448
Joined: Mon Jun 16, 2014 3:19 pm

Re: Updated BASIC and KERNAL disassembly

Postby srowe » Sun Apr 23, 2017 12:37 am

sjgray wrote:Here's another version with combined VIC/64 source:


This is very useful for comparing VIC vs C64 code. Any ideas which C64 ROM version this is?

Simon

sjgray
Vic 20 Hobbyist
Posts: 101
Joined: Thu May 03, 2007 6:46 pm
Location: Markham, ON, Canada

Re: Updated BASIC and KERNAL disassembly

Postby sjgray » Sun Apr 23, 2017 8:37 am

srowe wrote:
sjgray wrote:Here's another version with combined VIC/64 source:


This is very useful for comparing VIC vs C64 code. Any ideas which C64 ROM version this is?

Simon


It's version 3 as seen at line 17283.

Steve

User avatar
srowe
Vic 20 Afficionado
Posts: 448
Joined: Mon Jun 16, 2014 3:19 pm

Re: Updated BASIC and KERNAL disassembly

Postby srowe » Thu Jul 06, 2017 1:47 pm

Just a note that there is a new release of xa that fixes the issue mentioned above.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest