Jump to content
IGNORED

Atari_Ace's Blog - Dealer Demo, part 10: A complete kernel


RSS Bot

Recommended Posts

OK, let's finish off the kernel of Dealer Demo.

The next chunk is the COLD start routine, starting at $1C84, which is implemented as a primitive. Following that are a variety of standard Forth words dealing with mathematical operations and buffer and screen management. This leads up to TCIOV, a Dealer Demo primitive to invoke CIO routines. After the implementations of EMIT and KEY (labeled XEMIT and XKEY), we add a primitive BLKIO for invoking the disk handler, some SIO DCB constants (DCDNO, DCCOM, DCADD, DCSEC) and then the word RSLW which implements reading and writing to disk. After that we find the implementation of TYPE, and then more standard Forth words for implementing loops and conditions, digit formatting, listing words and screens.

That finishes off the core Forth kernel. To check our work, we should strip the left hand byte data from the listing and send it through an assembler. MADS is a popular assembler, but its syntax is a little different from the syntax we've been using, so we need to massage the output slightly, specifically we need to convert *= to ORG and drop the A from the shift accumulator operators. We should also not emit lines that are included just to list all the bytes for a line that generates more than three bytes of output. Those requirements yield this little bit of code.

And sure enough, it assembles without error.  We could also do some data validation of the $output data, but let's postpone that and instead focus on how the words we just decompiled differ from the published fig-Forth listing.

So what's different:
  • 2025: 27 20 TCIOV .WORD *+22027: 86 FF STX XSAVE2029: B5 00 LDA 0,X202B: A2 00 LDX #0202D: 20 56 E4 JSR CIOV2030: A9 00 LDA #02032: C0 80 CPY #$802034: D0 01 BNE TCIOV12036: 98 TYA2037: 48 TCIOV1 PHA2038: A6 FF LDX XSAVE203A: 4C 3B 0D JMP PUSHThis regularizes entering into CIO, move the top of the data stack to the accumulator and pushing the return status to the data stack.
 dd10.zip (25.01KB)
Number of downloads: 0


http://atariage.com/forums/blog/734/entry-15044-dealer-demo-part-10-a-complete-kernel/
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...