Jump to content
IGNORED

FS1


ClausB

Recommended Posts

Poring over the disassembly. Found the screen clear subroutine. It has to erase all the lines in the upper screen before drawing the next frame. It has to be as fast as possible so that you don't see a blank screen, ideally less than one video frame, or 1/60 sec. Otherwise it would flicker badly. It uses a string of 96 STA adr16,X instructions, one for each display line, looping with X from 39 to 0. That's 96x40 bytes at 4 cycles per byte. With a little overhead that's 17k cycles, almost exactly 1/60 sec. on the Apple. At 3 bytes per instruction that's a big piece of code for a 16K program so they used some tricks. They cut it in half by using self-modifying code. First called with DEX and BPL and then called again with DEX and BMI. That works because of the funny HGR memory map. Then they cut it into quarters and stuffed it into unused display lines in that map (some of those random pixels in the BMP above). Clever!

 

The TRS-80 version has fewer bytes to clear, just 50x14. They found the fastest way to do that was to borrow the stack pointer. PUSH DE writes two bytes in 11 cycles and increments the address automatically. So there are 25 of those one-byte instructions in a row, looped 14 times. It executes in only one eighth the time.

Edited by ClausB
  • Like 3
Link to comment
Share on other sites

On 2/13/2022 at 6:09 AM, ClausB said:

Typical Apple artifact colors. Screen shots above.

 

After figuring out the 7-bit to 8-bit thing, I would probably convert to mode E so the colors are consistent. The outside view is always monochrome and really just 140 pixels wide (2 bits per pixel).

In the end, I never saw much point in hi-res mode for Mercenary, when it ran so much smoother in (possibly mode E) 160x192. So the lines were more jagged looking, they were still just lines. The frame rate easily made up the difference. As a teenager back then with no real knowledge of the Atari's hardware, I wanted everything simulation-wise to be in high-res like the Apple, but after learning how much faster animation can be in Atari's colorful lower resolutions, I understood why. They should have done FS2 in a lower resolution too, and have a decent frame-rate. It's just lines...

Edited by Gunstar
Link to comment
Share on other sites

Not sure at the moment whether I want to get into FS2. I'm hitting a wall with FS1. It's going to be a case of the last 10% taking 90% of the effort.

 

Lines with slope > 1/2 draw OK now, but shallower lines draw too long with gaps. (That's also why there's junk on screen left.) The code is complex, having to deal with that 7-bit thing, and I haven't yet figured it out.

 

fs1.png.50859751214c37a469b0f58e4f89cd4c.png

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

Well, that train derailed. But this one has arrived!

 

fs1.png.cc04f4785137a903a0339ea22063fb85.png

 

The line drawing routine is an intricate web of code to build the 7-bit bytes before writing them to the screen. Since even and odd bytes are different in the Apple, that code web is quite involved and took me days to decipher and to adjust to Atari's 8-bit bytes.

 

A few details remain to fix, e.g. radar/map display.

Edited by ClausB
  • Like 14
Link to comment
Share on other sites

Thanks.

 

I'm not sure they didn't. This from the FS2 manual, page 85:

"Large portions of this program were derived from subLOGIC's AT-3DZ graphics package, AT-FS1 flight simulator..., and AT-PB1 pinball."

I'm guessing this was a search and replace error and should say A2-FS1. Or maybe they started porting it and shelved it in favor of FS2.

Edited by ClausB
Link to comment
Share on other sites

The shallow line routine has 7 entry points and 7 exit points, one for each pixel position in an even or odd byte. I call it a web because the paths from entry to exit cross, join, and split. My task was to find the 4 paths needed for each pixel position in the Atari and patch JMPs in just the right places to short circuit the web in all 4 paths. It made my head hurt and I had several false starts and partial successes. When I finally found a single patch for all 4 paths, I knew it would be right. It was quite a victory for my aged brain.

 

I want to share it now so you all can help shake out the last bugs.

 

AT-FS1b.COM

 

Edited by ClausB
  • Like 7
  • Thanks 5
Link to comment
Share on other sites

Well it seems to have turned out quite nice. Has the "off-grid" anomalies when flying too far away - exactly like the Apple II version.

t1.png.6e75f94066c21077ea8dd50b878f2cd2.png

 

Think it's a great contrast to play these earlier iterations then segue into something like X-Plane. Helps one fully appreciate the progress made throughout the decades.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Yes, I tried to change the bare minimum. One thing I came away with was great respect for Apple II game programmers for what they had to work with.

 

Yes, that contrast is why I chose to port the very first version. That and the historical importance. Though I was disappointed that this version lacks the overhead view, which the TRS-80 Version calls RADAR mode.

 

Which emulator did you use? Please try out the Flying Ace mode. Might be bugs there.

 

Someone please try it on real hardware.

 

I've been working on joystick support, in place of the A2 paddle code.

Edited by ClausB
  • Like 1
Link to comment
Share on other sites

3 hours ago, Keatah said:

I had to select Full Raw Keyboard Scan for the keyboard-mode.

Why isn't that the default mode in Altirra?

 

As a matter of fact, all interrupts are disabled in this port, because the A2 image overwrites all of low memory, so the Atari OS won't work.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

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