Skip to content

STA instruction is troubemaker #35

@PSLLSP

Description

@PSLLSP

I tried the tutorial and I noted a bug with STA instruction. This is an example from tutorial (##Indexed indirect: ($c0,X)###):

Address  Hexdump   Dissassembly
-------------------------------
$0600    a2 01     LDX #$01
$0602    a9 05     LDA #$05
$0604    85 0a     STA $0a
$0606    a9 06     LDA #$06
$0608    85 02     STA $02
$060a    a0 0a     LDY #$0a
$060c    8c 05 06  STY $0605
$060f    a1 00     LDA ($00,X)

First run, value $05 was written to address $0001. It is a bug:

A=$0a X=$01 Y=$0a
SP=$ff PC=$0611
NV-BDIZC
00110000

0000: 00 05 06 00 00 00 00 00 00 00 00 00 00 00 00 00 
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

RESET:

A=$00 X=$00 Y=$00
SP=$ff PC=$0600
NV-BDIZC
00110000

0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

Second run, note that value $05 is written to memory $000a: That is OK:

A=$a2 X=$01 Y=$0a
SP=$ff PC=$0611
NV-BDIZC
10110000

0000: 00 00 06 00 00 00 00 00 00 00 05 00 00 00 00 00 
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions