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

Incorrect opcode allowed #172

Closed
em00k opened this issue Sep 16, 2018 · 5 comments
Closed

Incorrect opcode allowed #172

em00k opened this issue Sep 16, 2018 · 5 comments
Assignees
Labels

Comments

@em00k
Copy link

em00k commented Sep 16, 2018

The following code compiles without an error but what happens is e is loaded with lsb of memory address ._c and d lsb of memory address ._c

c=10
b=20
ASM 
 ld e,(._c)
 ld d,(._b)
END ASM 

While this works correctly

c=10
b=20
ASM 
 ld de,(._c)  ; ._c and ._b are store as a byte next to each other
END ASM 
@boriel
Copy link
Owner

boriel commented Sep 23, 2018

Well, that's the expected behavior. :-/
c and b variables are truncated to byte. From the ASM point of view ._c and ._d are just labels an there's no type information. Perhaps some #pragma or something could be used...

@boriel
Copy link
Owner

boriel commented Aug 2, 2019

Re-reading your issue, do you mean that in the first ASM block both d and e registers are getting the value of (._c)??

@em00k
Copy link
Author

em00k commented Jan 10, 2021

as mentioned in the chat, this should throw an error :

image

but it assembles

image

image

@boriel boriel added the bug label Jan 10, 2021
@boriel boriel self-assigned this Jan 10, 2021
@boriel
Copy link
Owner

boriel commented Jan 10, 2021

Confirmed! It's a bug. Let's fix it! :-)

boriel added a commit that referenced this issue Jan 10, 2021
This fixes issue #172
boriel added a commit that referenced this issue Jan 11, 2021
This fixes issue #172
@boriel
Copy link
Owner

boriel commented Jan 11, 2021

Fixed. Thanks for your report! :-)

@boriel boriel closed this as completed Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants