Super Merryo Trolls

Making The Fog Source Code

You may think it's crude, but AppleSoft BASIC was all we needed to accomplish the task of converting the drawing of the fog into the code we used inside Merryo Trolls.

 5 L = 6114
 6 F$ = "prg/bits/fogimport.s"
 10 D$ =  CHR$ (4)
 20  HOME : PRINT : PRINT D$;"bload px/world4.fog,a";L;",b$500,l$7800,t$c1"
 25  PRINT "Converting (this may take awhile, so grab a snack or do some BBSing.)"
 30  PRINT D$;"open ";F$
 35  PRINT D$;"write ";F$
 47  PRINT "* This source actually written by a basic program."
 48  PRINT "* ... So watch your ass."
 50  PRINT : PRINT "FogTabls";
 60  FOR T = 0 TO 9
 70  PRINT " DA ";
 80  FOR U = 0 TO 7
 85  PRINT "FogT";U + (T * 8);",";
 90  NEXT U: PRINT : NEXT T
 93  PRINT : PRINT "BackLoop";
 100  FOR X = 0 TO 79
 103  PRINT " iny": PRINT " iny": PRINT " iny": PRINT " nop"
 105  PRINT : PRINT "FogT";X;
 106 Z = X + 1: IF Z = 80 THEN Z = 0
 110  FOR Y = 0 TO 191
 115 U =  PEEK (L + (X * 2) + (Y * 160))
 118 V =  PEEK (L + (Z * 2) + (Y * 160))
 119  IF U > 0 AND V = 0 THEN  GOTO 125
 120  NEXT Y: GOTO 145
 125  PRINT " ldx ForeFld+";46080 - (Y * 240);",y"
 130  PRINT " lda FogTable,x"
 136  PRINT " sta ForeFld+";46080 - (Y * 240);",y"
 140  NEXT Y
 145  PRINT " tyx"
 150  FOR Y = 0 TO 191
 155 U =  PEEK (L + (X * 2) + (Y * 160))
 160 V =  PEEK (L + (Z * 2) + (Y * 160))
 165  IF U = 0 AND V > 0 THEN  GOTO 175
 170  NEXT Y: GOTO 190
 175  PRINT " ldal BackFld+";46080 - (Y * 240);",x"
 180  PRINT " sta ForeFld+";46080 - (Y * 240);",x"
 185  NEXT Y
 190  NEXT X
 194  PRINT " jmp BackLoop"
 195  PRINT : PRINT D$;"close ";F$
 200  PRINT "Done!": END

This program created the code for moving the stripes, and a jump table so we could start drawing the fog from any stripe.