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

Strange behaviour of LITERAL #457

Closed
Eelkhoorn opened this issue Jan 28, 2023 · 7 comments
Closed

Strange behaviour of LITERAL #457

Eelkhoorn opened this issue Jan 28, 2023 · 7 comments
Assignees
Labels

Comments

@Eelkhoorn
Copy link
Collaborator

When used within a "if then" block LITERAL behaves strange.

HEX ABCD DUP
: test1 LITERAL ;
: test2 IF LITERAL THEN ;
test1 . ABCD ok ( this is expected)
-1 test2 . B4 ok ( ???)

@TG9541
Copy link
Owner

TG9541 commented Jan 28, 2023

Hoi @Eelkhoorn!

I'm not sure if that's what you intend to do... but the following code will show a more consistent behavior:

HEX ABCD
: test2 IF [ SWAP ] LITERAL THEN ; 

The result is now consistent with the input: -1 test2 . ABCD ok.

Without the SWAP you'd be using the address of the dummy IF jump target (patched by THEN).

@TG9541 TG9541 self-assigned this Jan 28, 2023
@Eelkhoorn
Copy link
Collaborator Author

Eelkhoorn commented Jan 28, 2023 via email

@TG9541 TG9541 closed this as completed Jan 28, 2023
@TG9541
Copy link
Owner

TG9541 commented Jan 29, 2023

@Eelkhoorn maybe the FC-table implementation in STM8-Modbus MBPROTO matches your use case: it allows patching a table at runtime and it's well tested. FC>XT is the access word and @?EXEC the execution word. You'll also find an extension mechanism with a default word.

@Eelkhoorn
Copy link
Collaborator Author

Eelkhoorn commented Jan 29, 2023 via email

@TG9541
Copy link
Owner

TG9541 commented Jan 29, 2023

Wow, that sounds interesting! If you get it working please share!

@Eelkhoorn
Copy link
Collaborator Author

Eelkhoorn commented Mar 27, 2023 via email

@TG9541
Copy link
Owner

TG9541 commented Mar 28, 2023

I'm looking forward to testing https://github.com/Eelkhoorn/stm8ef-mu !

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