Akalabeth Preamble Files

27 thoughts
last posted March 30, 2014, 10:53 p.m.

11 earlier thoughts

0

In trying to work out what the above code is doing, my first thought is: where is it using all the data after the initial code?

My second thought is: where is it modifying the screen (if that's indeed what it's doing).

There are no absolute addresses so the only places that can be referring to either the data or the screen are the indirect loads and stores at $8048 and $804A respectively.

The

POKE 254,32
POKE 255,32

in the BASIC before the binary code is run put #$20 into $FE and $FF.

The following therefore initially puts $2000 in $06/$07.

8012: A9 00    LOOP1   LDA #$00
8014: 85 06            STA $06
8016: A5 FE            LDA $FE
8018: 85 07            STA $07

The following then adds the value in $F9 (initially #$00) to $06, carrying to $07.

801A: 18               CLC
801B: A5 06            LDA $06
801D: 65 F9            ADC $F9
801F: 85 06            STA $06
8021: A5 07            LDA $07
8023: 69 00            ADC #$00
8025: 85 07            STA $07

This then adds the 16-bit contents of $FA/$FB (initially $#0000) to $06/$07.

8027: 18               CLC
8028: A5 06            LDA $06
802A: 65 FA            ADC $FA
802C: 85 06            STA $06
802E: A5 07            LDA $07
8030: 65 FB            ADC $FB
8032: 85 07            STA $07

We then add the 16-bit contents of $FC/$FD (yet again, initially $#0000). We also (in 803B) store the new value of $06 in $08.

8034: 18               CLC
8035: A5 06            LDA $06
8037: 65 FC            ADC $FC
8039: 85 06            STA $06
803B: 85 08            STA $08
803D: A5 07            LDA $07
803F: 65 FD            ADC $FD
8041: 85 07            STA $07

Then we add whatever was in $FF ($#20 from the POKE) to what we just put in $07 and store in in $09.

8043: 18               CLC
8044: 65 FF            ADC $FF
8046: 85 09            STA $09

By this stage, 8048 has been changed so we have:

8048: B1 00            LDA $#00
804A: 91 06            STA ($06),Y

so we end up storing $#00 in whatever we have in $06/$7 + Y.

So this is where we're writing to $2000, the screen.

15 later thoughts