mirror of
https://github.com/adamdunkels/ubasic.git
synced 2026-11-23 04:59:48 +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
3
ubasic.h
3
ubasic.h
|
|
@ -32,6 +32,9 @@
|
|||
|
||||
#include "vartype.h"
|
||||
|
||||
typedef VARIABLE_TYPE (*peek_func)(VARIABLE_TYPE);
|
||||
typedef void (*poke_func)(VARIABLE_TYPE, VARIABLE_TYPE);
|
||||
|
||||
void ubasic_init(const char *program);
|
||||
void ubasic_run(void);
|
||||
int ubasic_finished(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue