Jump to content
IGNORED

Atari_Ace's Blog - Dealer Demo, part 9: Strings are things


RSS Bot

Recommended Posts

We continue with decompiling Dealer Demo at $175D, seeing -TRAILING, (.") (PDOTQ), and then a handful of words leading to the word ERROR which decompiles incorrectly.

Looking closely, we see that the .WORD PDOTQ precedes strings in the listing, which are represented as a count, followed by the string contents. The code to decompile such a string manually is easy to implement, since we built most of the infrastructure already to decompile Forth name fields, namely:

    if (get_cstrq($val)) {      $i += cstr_buf(substr($buff, $i), $addr + $i, $size - $i);    }
where get_cstrq is:
1A1C: 9C 17             .WORD PDOTQ1A1E: 04 20 20          .BYTE 4,'  ? '1A21: 3F 20
Let's keep decompiling up through the word FORTH, which has .WORD DODOE, which we discussed last time, and then up through ABORT.

Among these words, what differences do we see?
  • EXPECT is implemented significantly differently. The Dealer Demo version is much shorter and simpler than the fig-Forth assembly version. The fig-Forth version has extra code to handle back spaces and carriage returns which are done elsewhere in the Dealer Demo kernel.
  • The null word (literally ascii 0), is largely the same, except it uses BSCR 1 - AND instead of 0 BSCR U/ DROP. The fig-Forth screen listing uses 7 AND unconditionally and has BSCR (blocks per screen) equal to 8, so it more closely follows the Dealer Demo listing. However, in the Dealer Demo, BSCR is one, so these gymnastics to figure out where to read the character from isn't really needed.
  • The word UPPER is dropped from Dealer Demo. This kernel (as are all Atari Forth kernels) is case sensitive so it isn't used.
  • ERROR is modified slightly before calling QUIT. Instead of always leaving IN and BLK on the data stack, we omit IN if reading from disk. Since QUIT doesn't use this data, this presumably is left for debugging reasons.
  • ABORT and QUIT use slightly different strings than the fig-Forth listing. ABORT ends with SEMIS, which isn't really needed since QUIT doesn't return. ABORT also calls some future word at $863A instead of CR, probably to run some Dealer Demo specific initialization.
Calling Invoking -refs in our tool shows CREAT, ERROR, WORD, ABORT and QUIT forward references can now be fixed up. CREATE was the missing word used in colon and constant definitions, so we now have largely filled in all the words that implement compilation.

I think that's enough for today. Our decompilation tool is now complete, we just need to keep applying it until we've cranked through the rest of the disk. The next post (or maybe two) should complete the kernel (which ends at byte $259f), and the post after that will describe the assembler (which ends at $2be4).
Attached File(s)
  • zip.gif dd9.zip (17.84KB)
    Number of downloads: 0


http://atariage.com/forums/blog/734/entry-15040-dealer-demo-part-9-strings-are-things/
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...