mirror of
https://github.com/adamdunkels/ubasic.git
synced 2026-11-21 20:19:45 +00:00
New instructions PEEK and POKE to call outside routines.
To use PEEK and POKE initialize uBASIC from your program with ubasic_init_peek_poke(program, &peek, &poke) where "peek" is a function peek(VARIABLE_TYPE addr) that returns VARIABLE_TYPE and "poke" is a procedure void poke(VARIABLE_TYPE addr, VARIABLE_TYPE value). Use "PEEK addr, var" to set the value of the variable var to the result of calling peek(addr). Use "POKE addr, value" to call poke(addr, value); The argument name "addr" is arbitrary; it doesn't mean you should necessarily use it to pass your routines a memory address.
This commit is contained in:
parent
f9ea3c6e6b
commit
93bb242eb0
6 changed files with 85 additions and 2 deletions
|
|
@ -51,6 +51,8 @@ enum {
|
|||
TOKENIZER_RETURN,
|
||||
TOKENIZER_CALL,
|
||||
TOKENIZER_REM,
|
||||
TOKENIZER_PEEK,
|
||||
TOKENIZER_POKE,
|
||||
TOKENIZER_END,
|
||||
TOKENIZER_COMMA,
|
||||
TOKENIZER_SEMICOLON,
|
||||
|
|
@ -61,6 +63,7 @@ enum {
|
|||
TOKENIZER_ASTR,
|
||||
TOKENIZER_SLASH,
|
||||
TOKENIZER_MOD,
|
||||
TOKENIZER_HASH,
|
||||
TOKENIZER_LEFTPAREN,
|
||||
TOKENIZER_RIGHTPAREN,
|
||||
TOKENIZER_LT,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue