mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-10-25 14:26:11 +00:00
mode7: Update doc
This commit is contained in:
parent
71de0a5475
commit
42101a9a37
@ -2,7 +2,7 @@
|
|||||||
\usepackage{graphicx}
|
\usepackage{graphicx}
|
||||||
\usepackage{url}
|
\usepackage{url}
|
||||||
\usepackage{hyperref}
|
\usepackage{hyperref}
|
||||||
|
\usepackage{fancyvrb}
|
||||||
|
|
||||||
\begin{document}
|
\begin{document}
|
||||||
|
|
||||||
@ -105,6 +105,7 @@ systems were common.
|
|||||||
While the demo itself fits in 8k, it decompresses to a larger size and uses
|
While the demo itself fits in 8k, it decompresses to a larger size and uses
|
||||||
a full 48k of RAM;
|
a full 48k of RAM;
|
||||||
this would have been very expensive in 1977.
|
this would have been very expensive in 1977.
|
||||||
|
See Figure~\ref{fig:map} for a diagram of the memory map.
|
||||||
|
|
||||||
Also in 1977 you would probably be loading this from cassette tape.
|
Also in 1977 you would probably be loading this from cassette tape.
|
||||||
It would be another year before Woz's single-sided
|
It would be another year before Woz's single-sided
|
||||||
@ -208,6 +209,49 @@ the actual Apple II (an Apple IIe platinum edition).
|
|||||||
% http://www.deater.net/weave/vmwprod/mode7_demo/
|
% http://www.deater.net/weave/vmwprod/mode7_demo/
|
||||||
|
|
||||||
|
|
||||||
|
\begin{figure}[tb]
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=2in]{figures/hidden_vmw.png}
|
||||||
|
\end{center}
|
||||||
|
\caption{VMW logo hidden in the executable data.\label{fig:vmw}}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\begin{figure}[tb]
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\columnwidth]{figures/mode7_demo_title.png}
|
||||||
|
\end{center}
|
||||||
|
\caption{The title screen.\label{fig:title}}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\begin{figure}[tb]
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\columnwidth]{figures/m7_screen1.jpg}
|
||||||
|
\caption{Bouncing ball on infinite checkerboard.\label{fig:ball}}
|
||||||
|
\end{center}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\begin{figure}[tb]
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\columnwidth]{figures/m7_screen4.jpg}
|
||||||
|
\caption{Spaceship flying over an island.\label{fig:tb1}}
|
||||||
|
\end{center}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\begin{figure}[tb]
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\columnwidth]{figures/m7_screen3.jpg}
|
||||||
|
\end{center}
|
||||||
|
\caption{Spaceship with starfield.\label{fig:stars}}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\begin{figure}[tb]
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\columnwidth]{figures/m7_screen2.jpg}
|
||||||
|
\end{center}
|
||||||
|
\caption{Rasterbars, stars, and credits. Stealth Susie was a particularly
|
||||||
|
well-traveled guinea pig.
|
||||||
|
\label{fig:credits}}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
|
||||||
\section{The Demo}
|
\section{The Demo}
|
||||||
@ -230,13 +274,6 @@ Upon loading, execution starts at address \$2000
|
|||||||
|
|
||||||
\subsection{DECOMPRESSER}
|
\subsection{DECOMPRESSER}
|
||||||
|
|
||||||
\begin{figure}[tb]
|
|
||||||
\begin{center}
|
|
||||||
\includegraphics[width=2in]{figures/hidden_vmw.png}
|
|
||||||
\end{center}
|
|
||||||
\caption{VMW logo hidden in the executable data.\label{fig:vmw}}
|
|
||||||
\end{figure}
|
|
||||||
|
|
||||||
The binary is encoded with the LZ4 algorithm.
|
The binary is encoded with the LZ4 algorithm.
|
||||||
We flip to hi-res Page 2 and decompress there so the user continues to get
|
We flip to hi-res Page 2 and decompress there so the user continues to get
|
||||||
a show of random noise.
|
a show of random noise.
|
||||||
@ -274,12 +311,6 @@ copy in the faded versions on the fly.
|
|||||||
|
|
||||||
\subsection{TITLE SCREEN}
|
\subsection{TITLE SCREEN}
|
||||||
|
|
||||||
\begin{figure}[tb]
|
|
||||||
\begin{center}
|
|
||||||
\includegraphics[width=\columnwidth]{figures/mode7_demo_title.png}
|
|
||||||
\end{center}
|
|
||||||
\caption{The title screen.\label{fig:title}}
|
|
||||||
\end{figure}
|
|
||||||
|
|
||||||
Once decompression is done, execution continues at address \$4000.
|
Once decompression is done, execution continues at address \$4000.
|
||||||
We switch to low-res mode for the rest of the demo.
|
We switch to low-res mode for the rest of the demo.
|
||||||
@ -450,13 +481,6 @@ We managed to take this algorithm and speed it up in the following ways:
|
|||||||
|
|
||||||
\subsection{BOUNCING BALL ON CHECKERBOARD}
|
\subsection{BOUNCING BALL ON CHECKERBOARD}
|
||||||
|
|
||||||
\begin{figure}
|
|
||||||
\begin{center}
|
|
||||||
\includegraphics[width=\columnwidth]{figures/m7_screen1.jpg}
|
|
||||||
\caption{Bouncing ball on infinite checkerboard.\label{fig:ball}}
|
|
||||||
\end{center}
|
|
||||||
\end{figure}
|
|
||||||
|
|
||||||
The first scence starts out viewing an infinite checkerboard.
|
The first scence starts out viewing an infinite checkerboard.
|
||||||
Any demo would be incomplete without some sort of bouncing geometric solid,
|
Any demo would be incomplete without some sort of bouncing geometric solid,
|
||||||
in our case a pink sphere.
|
in our case a pink sphere.
|
||||||
@ -472,90 +496,72 @@ This gives some sound for those viewing the demo without a Mockingboard.
|
|||||||
|
|
||||||
\subsection{TFV SPACESHIP FLYING}
|
\subsection{TFV SPACESHIP FLYING}
|
||||||
|
|
||||||
\begin{figure}[tb]
|
|
||||||
\begin{center}
|
|
||||||
\includegraphics[width=\columnwidth]{figures/m7_screen4.jpg}
|
|
||||||
\end{center}
|
|
||||||
\caption{Spaceship flying over an island.\label{fig:tb1}}
|
|
||||||
\end{figure}
|
|
||||||
|
|
||||||
|
This next scene has a spaceship flying over an island.
|
||||||
The spaceship, water splash, and shadows are all sprites.
|
The spaceship, water splash, and shadows are all sprites.
|
||||||
They are all drawn in software as the Apple II has no sprite hardware.
|
They are all drawn in software as the Apple II has no sprite hardware.
|
||||||
|
The path the ship takes is pre-recorded; this is adapted from the
|
||||||
This is the TFV game engine flying-spaceship code, with the keyboard
|
Talbot Fantasy~7 game engine with the keyboard code replaced by a hard-coded
|
||||||
routines replaced to read from memory instead (sort of like a script
|
script of actions to take.
|
||||||
of what to do when).
|
|
||||||
|
|
||||||
\subsection{STARFIELD}
|
\subsection{STARFIELD}
|
||||||
|
|
||||||
\begin{figure}[tb]
|
The spaceship takes to the stars.
|
||||||
\begin{center}
|
This is typical starfield code.
|
||||||
\includegraphics[width=\columnwidth]{figures/m7_screen3.jpg}
|
Only 16 stars are modeled, and the movement code re-uses the
|
||||||
\end{center}
|
same fast-multiply routine described previously.
|
||||||
\caption{Spaceship with starfield.\label{fig:stars}}
|
|
||||||
\end{figure}
|
|
||||||
|
|
||||||
|
The star positions require random number generation, but this is not
|
||||||
The starfield is your typical starfield code. Only 16 stars are modeled.
|
fast on the 6502.
|
||||||
It re-uses the fast-multiply code from the mode7 graphics.
|
Originally we had a 256-byte blob of pre-generated ``random'' values
|
||||||
|
included in the code.
|
||||||
Random number generation is not fast on the 6502, so we cheat.
|
This wasted space, so now instead we just use our code at address
|
||||||
Originally we had a 256-byte blob of "random" values generated earlier.
|
at \$5000 as if it were a block of random numbers.
|
||||||
|
This was arbitrarily chosen, and it is not as random as it could be
|
||||||
This wasted space, so now instead we just treat the executable code
|
as seen when the ship enters hyperspace the lower right quadrant has fewer
|
||||||
at \$5000 as if it were a block of random numbers. This was arbitrarily
|
starts than one could desire.
|
||||||
chosen, I tried different areas of memory until I got one where the
|
A simple state machine controls star speed, ship movement, hyperspace,
|
||||||
stars seemed to move in a pleasing pattern.
|
background color (for the blue flash) and the eventual sequence of sprites
|
||||||
|
as the ship vanishes into the distance.
|
||||||
A simple state machine controls if the stars move or not, whether the
|
|
||||||
background is cleared or not (the streak effect) and what color the
|
|
||||||
background is (for the blue flash).
|
|
||||||
|
|
||||||
The ship moving to the distance is just done with different sized sprites.
|
|
||||||
|
|
||||||
\subsection{RASTERBARS/CREDITS}
|
\subsection{RASTERBARS/CREDITS}
|
||||||
|
|
||||||
\begin{figure}[tb]
|
Once the ship has departed, it is time for the credits as the stars
|
||||||
\begin{center}
|
continue to run.
|
||||||
\includegraphics[width=\columnwidth]{figures/m7_screen2.jpg}
|
|
||||||
\end{center}
|
|
||||||
\caption{Rasterbars, stars, and credits.\label{fig:credits}}
|
|
||||||
\end{figure}
|
|
||||||
|
|
||||||
|
The text is written to the bottom 4 lines of the screen and appears
|
||||||
|
to be surrounded by low-res graphics blocks.
|
||||||
|
Mixed graphics/text would generally not be possible on the Apple II, although
|
||||||
|
with careful cycle counting and mode switching groups such as FrenchTouch
|
||||||
|
have achieved this effect.
|
||||||
|
I was lazy and instead used inverse-mode space characters which appear the same
|
||||||
|
as white graphics blocks.
|
||||||
|
|
||||||
The credits happen with the starfield continuing to run.
|
The rasterbar effect is not really rasterbars, it's just a colorful assortment
|
||||||
|
of horizontal lines drawn at a location determined with a sine lookup table.
|
||||||
|
Horizontal lines can take a surprising amount of time to draw, so this
|
||||||
|
was optimized using inlining and a few other methods.
|
||||||
|
|
||||||
The text is written in the bottom 4 lines of the screen. Some inverse-mode
|
The rotating text is done by just rapidly rotating the output string through
|
||||||
space characters are used to try to make it look like graphics are surrounding
|
the ASCII table, with the clicking effect again by hitting the speaker
|
||||||
the text. It's actually possible with careful cycle counting to switch
|
at address \$C030.
|
||||||
modes fast enough to have actual mixed graphics/text (See the FrenchTouch
|
The list of people to thank ended up being extremely critical to fitting in 8kB,
|
||||||
demos) but I was too lazy to attempt that here.
|
as unique text strings do not compress well.
|
||||||
|
I apologize to everyone whose moniker got compressed beyond recognition,
|
||||||
The rasterbar effect isn't really rasterbars, it's just a rainbow assortment
|
and I am still not totally happy with the centering of the text.
|
||||||
of lines being drawn with a SINEWAVE lookup table.
|
|
||||||
|
|
||||||
It's the same rasterbar code from my chiptune player demo. I ended up
|
|
||||||
optimizing it a lot via inlining and a few other ways because it turned
|
|
||||||
out just drawing a horizontal line can take a very long time.
|
|
||||||
|
|
||||||
The rotating text is just taking the output string and rapidly rotating the
|
|
||||||
character values through the ASCII table.
|
|
||||||
|
|
||||||
The annoying clicking noise is the same speaker effect caused by hitting
|
|
||||||
\$C030.
|
|
||||||
|
|
||||||
Choosing who to thank ended up being extremely critical to fitting in 8kB,
|
|
||||||
as unique text strings do not compress well. I'm also still not satisfied
|
|
||||||
with how the centering looks.
|
|
||||||
|
|
||||||
|
\section{Obtaining the Code}
|
||||||
|
|
||||||
More details, disk image, and full source can be found at the website:
|
More details, disk image, and full source can be found at the website:
|
||||||
\url{http://www.deater.net/weave/vmwprod/mode7_demo/}
|
\url{http://www.deater.net/weave/vmwprod/mode7_demo/}
|
||||||
|
|
||||||
\begin{table}
|
%\section{Appendix: Memory Map}
|
||||||
\begin{center}
|
|
||||||
\begin{verbatim}
|
|
||||||
|
|
||||||
|
|
||||||
|
\begin{figure}
|
||||||
|
\begin{center}
|
||||||
|
\begin{scriptsize}
|
||||||
|
\begin{BVerbatim}
|
||||||
------------- $ffff
|
------------- $ffff
|
||||||
| ROM/IO |
|
| ROM/IO |
|
||||||
------------- $c000
|
------------- $c000
|
||||||
@ -587,10 +593,12 @@ More details, disk image, and full source can be found at the website:
|
|||||||
------------- $0100
|
------------- $0100
|
||||||
| zero pg |
|
| zero pg |
|
||||||
------------- $0000
|
------------- $0000
|
||||||
|
\end{BVerbatim}
|
||||||
\end{verbatim}
|
\end{scriptsize}
|
||||||
\end{center}
|
\end{center}
|
||||||
\caption{Memory Map (not to scale)}
|
\caption{Memory Map (not to scale)\label{fig:map}}
|
||||||
\end{table}
|
\end{figure}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
Loading…
Reference in New Issue
Block a user