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

opt r+ does not see labels, creating incorrect code #10

Closed
ehn-pkalinowski opened this issue Jan 16, 2023 · 3 comments
Closed

opt r+ does not see labels, creating incorrect code #10

ehn-pkalinowski opened this issue Jan 16, 2023 · 3 comments

Comments

@ehn-pkalinowski
Copy link

ehn-pkalinowski commented Jan 16, 2023

example:

	org $2000
	mva #4 $80
@
	mva #4 $81
	lda $D20A
	dec $80
	bne @-

it gets compiled to

     4 FFFF> 2000-200C> A9 04 + 	mva #4 $80
     5 				@
     6 2004 85 81			mva #4 $81
     7 2006 AD 0A D2			lda $D20A
     8 2009 C6 80			dec $80
     9 200B D0 F7			bne @-

It looks OK in a LST file, but in fact bne jumps to the sta instruction, so when the loop ends $81 contains a random value.

@ehn-pkalinowski
Copy link
Author

the proposed solution - do not optimize when there is a label between pseudo commands.

@pkali
Copy link

pkali commented May 19, 2023

Just spotted such an example:

812 7280 D0 04 A9 01 85 88	    sne:mva #1 fs  ; finish it     
813 7286 85 A9		             mva #1 Erase```
   
   mads assumes A is #1 in the second line, which is not really correct...

tebe6502 added a commit that referenced this issue Sep 13, 2023
@tebe6502
Copy link
Owner

issue #10 fixed

tebe6502 added a commit that referenced this issue Sep 13, 2023
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

3 participants