Jump to content
Sign in to follow this  
RSS Bot

Atari_Ace's Blog - APX Pascal Architecture, part one

Recommended Posts

Bill Lange has been blogging about Atari Pascal since early February at https://insideataripascal.blogspot.com/, so here's my own small contribution after spending an afternoon poking around in APX Pascal and looking for the core interpreter.

If we look at the PASCAL runtime on the APX Pascal disk, it's a simple enough image. It loads itself from disk to $3300-$59ff and then starts running from $3300. So what does that initial bootstrap code do? Here's the preamble:

33A7: 00 3A             .WORD $3A00 ; source33A9: 00 A0             .WORD $A000 ; destination33AB: 00 20             .WORD $2000 ; count33AD: 00 1D             .WORD $1D00
And the subroutine looks like:
​332B: AD AD 33          LDA $33AD332E: 85 80             STA $803330: AD AE 33          LDA $33AE3333: 85 81             STA $813335: A9 00             LDA #03337: 85 82             STA $823339: 85 83             STA $83333B: 20 00 A2          JSR $A200…A200: 4C 12 B8          JMP $B812
This copies the word in $33AD ($1D00) to $80,$81 and zeros $82,$83 before invoking a routine at $A200, which vectors to $B812.

That routine does several things, including:
​A278: 00 A0             .WORD $A000A27A: 78 02             .WORD $0278
So we move the word at $80,$81 ($1D00) to $D0,D1, and set $CE,$CF to $A000 and $D2,D3 to $0278, before calling another block copier.
1F00: 4C 12 B8          JMP $B8121F03: 4C B1 AB          JMP $ABB11F06: 4C B6 AB          JMP $ABB6…1F72: 4C 87 B8          JMP $B8871F75: 4C 5F BC          JMP $BC5F
After we return from this the code continues with:
​B9EB: A2 21             LDX #$21B9ED: A0 00             LDY #0B9EF: B9 CA B9          LDA $B9CA,YB9F2: 99 92 00          STA $0092,YB9F5: C8                INYB9F6: CA                DEXB9F7: D0 F6             BNE $B9EFB9F9: A5 81             LDA $81B9FB: 85 AD             STA $ADB9FD: 85 B2             STA $B2B9FF: E6 B2             INC $B2BA01: 60                RTS
This copies the code at $B9CA into page zero, and patches the value at $81 ($1D) into $AD and the $B2 and then increments $B2, so we end up with the following:

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...