Skip to content
This repository has been archived by the owner on Nov 12, 2019. It is now read-only.

Commit

Permalink
Saving about 40% of assembly size by getting colors from predefined r…
Browse files Browse the repository at this point in the history
…egisters.
  • Loading branch information
tklein23 committed Feb 27, 2014
1 parent 5d1eaf2 commit bb7b6df
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions 2014-02-27/maze-generator/maze2asm.pl
Expand Up @@ -6,10 +6,14 @@
my $startaddr = 0x0200;

my %colmap = (
"X" => 0x00,
" " => 0x0e,
"X" => "X",
" " => "A",
);

printf "LDX #\$00\n"; # color of walls
printf "LDA #\$0e\n"; # color of free space
printf "\n";

while (my $line = <>) {
chomp $line;

Expand All @@ -18,10 +22,7 @@

for (my $i=0; $i<int(@pixels); $i++) {
if (defined($pixels[$i])) {
printf "LDA #\$%02x\n", $pixels[$i];
printf "STA \$%04x\n", $startaddr+$i;
printf "\n";

printf "ST%s \$%04x\n", $pixels[$i], $startaddr+$i;
}
}

Expand Down

0 comments on commit bb7b6df

Please sign in to comment.