Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

absolute vs zero page bug #9

Open
TobyLobster opened this issue Jan 27, 2022 · 2 comments
Open

absolute vs zero page bug #9

TobyLobster opened this issue Jan 27, 2022 · 2 comments

Comments

@TobyLobster
Copy link

The assembler chooses 'zero page,X' when it should choose 'absolute,X'. e.g. the "ORA absolute,X" instruction is assembled as "ORA zp,X" even though it isn't, when using a label thats defined later.

i.e. I think this will not produce the correct bytes:

"""
ORG $200
ORA label,X

label:
DB $ff
"""

@dj-on-github
Copy link
Owner

Confirmed..
root@deadhat:/home/dj/src/py6502/src# python2 small_example.py
LISTING
1 0000 :
2 0100 : org $100
3 0100 : start:
4 0100 : A9 10 lda #$10
5 0102 : A2 00 ldx #$00
6 0104 : 15 0F ora alab,x
7 0106 : loop:
8 0106 : 9D 00 10 sta $1000,x
9 0109 : E8 inx
10 010A : E9 01 sbc #$01
11 010C : 10 F8 bpl loop
12 010E : 60 rts
13 010F : alab:
14 010F : db $55

I'll look into it.
Thanks

@dj-on-github
Copy link
Owner

It's not just ORA

LISTING
1 0000 :
2 0300 : org $300
3 0300 : start:
4 0300 : A9 10 lda #$10
5 0302 : A2 00 ldx #$00
6 0304 : 35 0F and alab,x
7 0306 : loop:
8 0306 : 9D 00 10 sta $1000,x
9 0309 : E8 inx
10 030A : E9 01 sbc #$01
11 030C : 10 F8 bpl loop
12 030E : 60 rts
13 030F : alab:
14 030F : db $55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants