Skip to content

Commit

Permalink
More Fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
mwenge committed Jul 14, 2024
1 parent 1f124b0 commit f922175
Show file tree
Hide file tree
Showing 10 changed files with 781 additions and 272 deletions.
Binary file modified out/iatheory_scrapbook.pdf
Binary file not shown.
68 changes: 58 additions & 10 deletions src/bonusphase.tex
Original file line number Diff line number Diff line change
@@ -1,9 +1,40 @@
\chapter{Congoatulations Hotshot}
\label{sec:bonus}

\lstset{style=6502Style}

This decidedly ropey mini-game has a few interesting features.
If you are a good boy, and transfer enough energy to the planets' cores, then you too can
get to play Iridis Alpha's decidedly ropey mini-game.

\begin{lstlisting}[escapechar=\%, caption=\icode{bonusPhaseEarned} is set once \icode{currCoreEnergyLevel} reaches 14.]
EnterBonusPhaseInterruptHandler%\index{EnterBonusPhaseInterruptHandler}%
UpdateCoreEnergyLevel
LDX currCoreEnergyLevel
..
UpdateCoreGraphic
DEC SCREEN_RAM + LINE23_COL13,X
LDA SCREEN_RAM + LINE23_COL13,X
CMP #$7F
BNE ReturnFromCoreEnergyLevel
LDA #$80
STA SCREEN_RAM + LINE23_COL13,X
INX
; Has currCoreEnergyLevel reached 14 yet?
CPX #14
; If so, you get to play the bonus phase.
BEQ MaybeEarnedBonusPhase

...
MaybeEarnedBonusPhase
LDA lowerPlanetActivated
BEQ EarnedBonusPhase
DEX
JMP FinalizeLevelAndReturn

EarnedBonusPhase
INC bonusPhaseEarned
ReturnFromCoreEnergyLevel
RTS
\end{lstlisting}

\section{Entry Sequence}
\begin{figure}[H]
Expand All @@ -12,6 +43,16 @@ \section{Entry Sequence}
\caption{The entry sequence\index{sequence}.}
\end{figure}

\begin{lstlisting}[escapechar=\%, caption=Good boys pass this test.]
MaybeGoToBonusPhase
LDA bonusPhaseEarned
BEQ ResumeMainGameAgain
SEI
JSR StoreStatusBarDetail
JSR ClearScreen3
JSR DisplayEnterBonusRoundScreen
\end{lstlisting}

The entry sequence\index{sequence} is an animated cascade of colored bars that appears to roll
down from the top of the screen\index{screen}. You might assume we achieve this effect by simply
drawing\index{drawing} a series of colored text-based lines in a tight loop. Not the case:
Expand Down Expand Up @@ -302,7 +343,7 @@ \section{Generating Maps}
with a map for the level we are simply referencing each of these rows by their
index in the array. Here is the data structure\index{structure} defining each of the 32 rows:

\begin{lstlisting}[basicstyle=\tiny,escapechar=\%]
\begin{lstlisting}[basicstyle=\tiny\ttfamily,escapechar=\%]
bonusPhaseMapRowDefinitions%\index{bonusPhaseMapRowDefinitions}%
.BYTE $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 ; 00
.BYTE $0D,$0D,$0E,$0E,$0E,$0E,$0E,$00,$00,$0B,$0B,$00,$00,$0D,$0D,$0D,$0D,$0D,$0E,$0E
Expand Down Expand Up @@ -341,7 +382,7 @@ \section{Generating Maps}

The one at index \icode{\$15} (21 in decimal\index{decimal}) is this guy:

\begin{lstlisting}[basicstyle=\tiny,escapechar=\%]
\begin{lstlisting}[basicstyle=\tiny\ttfamily,escapechar=\%]
bonusPhaseMapRowDefinitions%\index{bonusPhaseMapRowDefinitions}%
.BYTE $00,$10,$0B,$11,$00,$00,$10,$0B,$11,$00,$00,$10,$0B,$11,$00,$00,$10,$0B,$11,$00
\end{lstlisting}
Expand Down Expand Up @@ -534,7 +575,7 @@ \section{Generating Maps}
\begin{minipage}[b]{0.45\linewidth}
\centering
\begin{lstlisting}[basicstyle=\tiny,escapechar=\%]
\begin{lstlisting}[basicstyle=\tiny\ttfamily,escapechar=\%]
BonusPhaseFillTopLineAfterScrollUp%\index{BonusPhaseFillTopLineAfterScrollUp}%
LDX offsetForScrollUp%\index{offsetForScrollUp}%
LDY bonusPhaseMapDefinition%\index{bonusPhaseMapDefinition}%,X
Expand Down Expand Up @@ -575,7 +616,7 @@ \section{Generating Maps}
\hspace{0.5cm}
\begin{minipage}[b]{0.45\linewidth}
\centering
\begin{lstlisting}[basicstyle=\tiny,escapechar=\%]
\begin{lstlisting}[basicstyle=\tiny\ttfamily,escapechar=\%]
BonusPhaseFillBottomLineAfterScrollDown%\index{BonusPhaseFillBottomLineAfterScrollDown}%
LDX offsetForScrollDown%\index{offsetForScrollDown}%
LDY bonusPhaseMapDefinition%\index{bonusPhaseMapDefinition}%,X
Expand Down Expand Up @@ -670,7 +711,7 @@ \subsection{Choosing a Map}
The trick is that these segments aren't themselves
generated procedurally\index{procedurally}, we defined them in advance. We did this in \icode{bonusMapSegmentArray\index{bonusMapSegmentArray}}
given below. We've highlighted the segments used in our map in red:
given below.
\begin{lstlisting}[escapechar=\%]
bonusMapSegmentArray%\index{bonusMapSegmentArray}%
Expand Down Expand Up @@ -709,7 +750,7 @@ \subsection{Choosing a Map}
\end{lstlisting}
By way of example this is what the last segment in the list above looks like when
rendered as a section of our map:
rendered as a section of our map (remember to read from back to front):
\begin{figure}[H]
{
Expand Down Expand Up @@ -760,7 +801,13 @@ \subsection{Choosing a Map}
\section{Some Very Ugly Sprites\index{Sprites}}
For some reason the gilby sprite in the bonus phase is made impossibly ugly.
There is no escaping the obvious: the gilby sprite in the bonus phase is impossibly ugly. It's such a contrast with the
elegance of the main game's gilby sprite that for me it spoils the effect of the mini-game completely.
There is of course
a simple technical reason why the gilby sprite design is completely unsuitable for the vertical orientation used in the
bonus phase. Multi-coloured sprites cannot be defined in terms of single pixels - the building blocks are always two pixels
wide so it is by definition not possible to create an object oriented on the Y axis that does not look unappealingly blocky.
\begin{figure}[H]
{
Expand Down Expand Up @@ -844,7 +891,8 @@ \section{Some Very Ugly Sprites\index{Sprites}}
\end{figure}
\section{IBalls}
The main adversary in the bonus phase, these at least have the merit of being visually appealing. The blinking animation is
particularly pleasing, if a little eerie!
\begin{figure}[H]
{
\setlength{\tabcolsep}{1.0pt}
Expand Down
1 change: 0 additions & 1 deletion src/book.tex
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,6 @@
\subfile{src/torus} % draft
\subfile{src/mif}
\subfile{src/dna} % wip
\subfile{src/torus-animation} % draft
\subfile{src/bugs} %draft
\appendix
\chapter*{Appendices}
Expand Down
23 changes: 12 additions & 11 deletions src/bugs.tex
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,15 @@ \section{The Byte that Broke}
We must apologise to some of the earliest purchasers of IA, as well... it
seems that some data was corrupted during the production phase of the
data duplication, and the first few hundred copies of the game used to bug
out if you lost at the Bonus Phase All the buggy copies known of have
out if you lost at the Bonus Phase. All the buggy copies known of have
been replaced, and all current tapes are fine, but if you find you have a
buggy version you should send it back to those awfully nice Hewsons
people and they ll give you an unglitchified one,
people and they ll give you an unglitchified one.
\end{definition}

What happened is that the master tape had dropped the very last byte in the second
What happened is that the mastering process had dropped the very last byte in the second
section of game data on the tape.

\begin{figure}[H]
{
\begin{adjustbox}{width=10cm,center}
\surface{bugs/spool-sections-glitches.png}
\end{adjustbox}
}\caption[]{The problematic section of data highlighted in red.}
\end{figure}

\begin{figure}[H]
{
\setlength{\tabcolsep}{3.0pt}
Expand All @@ -53,6 +45,15 @@ \section{The Byte that Broke}
}\caption{Chunk \icode{BF00} is missing its last byte.}
\end{figure}

\begin{figure}[H]
{
\begin{adjustbox}{width=10cm,center}
\surface{bugs/spool-sections-glitches.png}
\end{adjustbox}
}\caption[]{The problematic section of data highlighted in red.}
\end{figure}


\begin{lstlisting}[caption=The data segment as it should be\, with \icode{\$A2} at \icode{\$BFFF},escapechar=\%]
$BFFF A2 07 LDX #$07
$C001 A9 08 LDA #$08
Expand Down
83 changes: 44 additions & 39 deletions src/dna.tex
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
\chapter{A Pause Mode for your Pause Mode}
\label{sec:dna}
\lstset{style=6502Style}

Any pause mode must surely be in need of a pause mode. Titled 'DNA' this little entertainment is
a cousin of Minter's previous work on Psychedelia for the C64 and Colorspace for the Atari 800
in 1984 and 1985. It isn't accessed directly from the game but instead is invoked by pressing the
asterisk key while playing 'Made in France'.

\begin{figure}[H]
\centering
\includegraphics[width=10cm]{src/dna/dnascreenshot.png}%
\caption{DNA: A pause mode within a pause mode.}
\end{figure}
\begin{lstlisting}[caption=Defining the text for the DNA screen\index{screen},escapechar=\%]
titleTextLine1%\index{titleTextLine1}% .TEXT " % % % DNA % % % "
titleTextLine2%\index{titleTextLine2}% .TEXT " CONCEIVED%\index{CONCEIVED}% AND EXECUTED%\index{EXECUTED}% B"
titleTextLine3%\index{titleTextLine3}% .TEXT "Y Y A K "
titleTextLine4%\index{titleTextLine4}% .TEXT " SPACE: CANCEL SCREEN TEX"
titleTextLine5%\index{titleTextLine5}% .TEXT "TF5 AND F7 CHANGE COLOURS"
titleTextLine6%\index{titleTextLine6}% .TEXT " LISTEN TO TALKING%\index{TALKING}% HEADS."
titleTextLine7%\index{titleTextLine7}% .TEXT ".BE NICE TO HAIRY ANIMALS%\index{ANIMALS}% "
\end{lstlisting}

\begin{figure}[H]

Expand All @@ -31,10 +28,15 @@ \chapter{A Pause Mode for your Pause Mode}
\end{figure}
\clearpage

Any pause mode must surely be in need of a pause mode. Titled 'DNA' this little entertainment is
a cousin of Minter's previous work on Psychedelia for the C64 and Colorspace for the Atari 800
in 1984 and 1985. It isn't accessed directly from the game but instead is invoked by pressing the
asterisk key while playing 'Made in France'.
\begin{lstlisting}[caption=Defining the text for the DNA screen\index{screen},escapechar=\%]
titleTextLine1%\index{titleTextLine1}% .TEXT " % % % DNA % % % "
titleTextLine2%\index{titleTextLine2}% .TEXT " CONCEIVED%\index{CONCEIVED}% AND EXECUTED%\index{EXECUTED}% B"
titleTextLine3%\index{titleTextLine3}% .TEXT "Y Y A K "
titleTextLine4%\index{titleTextLine4}% .TEXT " SPACE: CANCEL SCREEN TEX"
titleTextLine5%\index{titleTextLine5}% .TEXT "TF5 AND F7 CHANGE COLOURS"
titleTextLine6%\index{titleTextLine6}% .TEXT " LISTEN TO TALKING%\index{TALKING}% HEADS."
titleTextLine7%\index{titleTextLine7}% .TEXT ".BE NICE TO HAIRY ANIMALS%\index{ANIMALS}% "
\end{lstlisting}

Minter first shared it as a tiny 11K demo in a UK Compunet forum in the summer of
1986. It followed shortly after 'Torus', an oscillator-based demo, shared at the same time and which we
Expand Down Expand Up @@ -102,16 +104,14 @@ \chapter{A Pause Mode for your Pause Mode}

\begin{minipage}[b]{0.75\linewidth}
\centering
\begin{lstlisting}[caption=\icode{dnaCurrentPhase\index{dnaCurrentPhase}} is set by the 'Q' key.,escapechar=\%]
\begin{lstlisting}[caption=\icode{dnaCurrentPhase\index{dnaCurrentPhase}} is
set by the 'Q' key. ,basicstyle=\scriptsize\ttfamily,escapechar=\%]
LDX dnaCurrentSpritesPosArrayIndex%\index{dnaCurrentSpritesPosArrayIndex}%
..
; Add in the phase to our index to the X position
; of the sprite on the right hand chain. If the
; result is greater than the number of values
; in the array ($27) subtract it out again.
; This means the 'Phase' setting acts as an
; offset into the X Position array picking up
; previous values of X Pos from the left hand chain.
; Add in the phase to our index to the X position of the
; sprite on the right hand chain. If the result is greater
; than the number of values in the array ($27) subtract it
; out again.
TXA
..
ADC dnaCurrentPhase%\index{dnaCurrentPhase}%
Expand All @@ -134,8 +134,11 @@ \chapter{A Pause Mode for your Pause Mode}
\begin{minipage}[b]{0.25\linewidth}
\centering
\includegraphics[width=3cm]{dna/dnaphase.png}%
\vspace{5cm}
\vspace{2cm}
\end{minipage}
In essence, the 'Phase' setting acts as an offset into the X
Position array picking up previous values of X Pos from the left hand
chain.

In the table below we've selected a few frames from the first second or two showing how the array fills up and how values from
the array are selected for the X position of the left and right chains. Notice how the 'Phase' setting of 5 effectively means
Expand All @@ -155,35 +158,35 @@ \chapter{A Pause Mode for your Pause Mode}
} &
\makecell[l]{
\lstinputlisting[linewidth=4.5cm,framexleftmargin=-0.1cm,framexrightmargin=-0.22cm,
basicstyle=\tiny,escapechar=!,backgroundcolor=\color{white},frame=single,framerule=0pt]{dna/initial/frame46.tex}
basicstyle=\tiny\ttfamily,escapechar=!,backgroundcolor=\color{white},frame=single,framerule=0pt]{dna/initial/frame46.tex}
} &
\makecell[l]{
\lstinputlisting[linewidth=4.5cm,framexleftmargin=-0.1cm,framexrightmargin=-0.22cm,
basicstyle=\tiny,escapechar=!,backgroundcolor=\color{white},frame=single,framerule=0pt]{dna/initial/frame46r.tex}
basicstyle=\tiny\ttfamily,escapechar=!,backgroundcolor=\color{white},frame=single,framerule=0pt]{dna/initial/frame46r.tex}
} \\
\addlinespace
\makecell[l]{
\includegraphics[height=2.5cm]{dna/initial/frame58.png}%
} &
\makecell[l]{
\lstinputlisting[linewidth=4.5cm,framexleftmargin=-0.1cm,framexrightmargin=-0.22cm,
basicstyle=\tiny,escapechar=!,backgroundcolor=\color{white},frame=single,framerule=0pt]{dna/initial/frame58.tex}
basicstyle=\tiny\ttfamily,escapechar=!,backgroundcolor=\color{white},frame=single,framerule=0pt]{dna/initial/frame58.tex}
} &
\makecell[l]{
\lstinputlisting[linewidth=4.5cm,framexleftmargin=-0.1cm,framexrightmargin=-0.22cm,
basicstyle=\tiny,escapechar=!,backgroundcolor=\color{white},frame=single,framerule=0pt]{dna/initial/frame58r.tex}
basicstyle=\tiny\ttfamily,escapechar=!,backgroundcolor=\color{white},frame=single,framerule=0pt]{dna/initial/frame58r.tex}
} \\
\addlinespace
\makecell[l]{
\includegraphics[height=2.5cm]{dna/initial/frame67.png}%
} &
\makecell[l]{
\lstinputlisting[linewidth=4.5cm,framexleftmargin=-0.1cm,framexrightmargin=-0.22cm,
basicstyle=\tiny,escapechar=!,backgroundcolor=\color{white},frame=single,framerule=0pt]{dna/initial/frame67.tex}
basicstyle=\tiny\ttfamily,escapechar=!,backgroundcolor=\color{white},frame=single,framerule=0pt]{dna/initial/frame67.tex}
} &
\makecell[l]{
\lstinputlisting[linewidth=4.5cm,framexleftmargin=-0.1cm,framexrightmargin=-0.22cm,
basicstyle=\tiny,escapechar=!,backgroundcolor=\color{white},frame=single,framerule=0pt]{dna/initial/frame67r.tex}
basicstyle=\tiny\ttfamily,escapechar=!,backgroundcolor=\color{white},frame=single,framerule=0pt]{dna/initial/frame67r.tex}
} \\
\addlinespace
\bottomrule
Expand Down Expand Up @@ -303,17 +306,11 @@ \chapter{A Pause Mode for your Pause Mode}
\end{lstlisting}

When we compare the routines responsible for calculating the X Pos for Wave 2 and Wave 1 side by side on the next
page we can see many similarities between the two. They are both maintaining and updating an index into
\icode{newXPosOffsetsArray\index{newXPosOffsetsArray}} and using that to come up with a new X position. They both have to deal towards the end
of the routine\index{routine} with the need to ensure the index does not exceed \icode{\$40} and subtract \icode{\$40} from it if
it does. The output of \icode{CalculateValueOfNewXPosForWave2} is essentially the value stored in \icode{notionalNewXPosForWave2\index{notionalNewXPosForWave2}}
and this is what is used as the input above, in conjunction with \icode{newXPosForWave1\index{newXPosForWave1}}, to come up with the final
value for the X position for Wave 1. It is this value that gets added to the head of the working array \icode{dnaXPosDataHeadArray}
by \icode{DNA\_PropagatePreviousXPosToTheRight}.
page we can see many similarities between the two.

\begin{minipage}[b]{0.55\linewidth}
\begin{minipage}[b]{0.50\linewidth}
\centering
\begin{lstlisting}[escapechar=\%,basicstyle=\tiny, caption=Calculate a notional X Pos value for Wave 2. This routine\index{routine} is called by the one on the
\begin{lstlisting}[escapechar=\%,basicstyle=\tiny\ttfamily, caption=Calculate a notional X Pos value for Wave 2. This routine\index{routine} is called by the one on the
right\, its return value is \icode{notionalNewXPosForWave2\index{notionalNewXPosForWave2}}. ]
CalculateValueOfNewXPosForWave2
LDA dnaWave2Enabled%\index{dnaWave2Enabled}%
Expand Down Expand Up @@ -367,9 +364,9 @@ \chapter{A Pause Mode for your Pause Mode}
\end{lstlisting}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.55\linewidth}
\begin{minipage}[b]{0.50\linewidth}
\centering
\begin{lstlisting}[escapechar=\%,basicstyle=\tiny, caption=Calculate the new X Pos value for the head sprites\index{sprites}\, as well as propagate the
\begin{lstlisting}[escapechar=\%,basicstyle=\tiny\ttfamily, caption=Calculate the new X Pos value for the head sprites\index{sprites}\, as well as propagate the
values in \icode{dnaXPosDataHeadArray} to the right when required.]
CalculateValueOfNewXPosForWave1
DEC actualSpeed%\index{actualSpeed}%
Expand Down Expand Up @@ -435,6 +432,14 @@ \chapter{A Pause Mode for your Pause Mode}
\end{minipage}


They are both maintaining and updating an index into
\icode{newXPosOffsetsArray\index{newXPosOffsetsArray}} and using that to come up with a new X position. They both have to deal towards the end
of the routine\index{routine} with the need to ensure the index does not exceed \icode{\$40} and subtract \icode{\$40} from it if
it does. The output of \icode{CalculateValueOfNewXPosForWave2} is essentially the value stored in \icode{notionalNewXPosForWave2\index{notionalNewXPosForWave2}}
and this is what is used as the input above, in conjunction with \icode{newXPosForWave1\index{newXPosForWave1}}, to come up with the final
value for the X position for Wave 1. It is this value that gets added to the head of the working array \icode{dnaXPosDataHeadArray}
by \icode{DNA\_PropagatePreviousXPosToTheRight}.




Expand Down
Loading

0 comments on commit f922175

Please sign in to comment.