Commit graph

10 commits

Author SHA1 Message Date
Danyil Bohdan
93bb242eb0 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.
2013-12-23 19:06:17 +02:00
Danyil Bohdan
f9ea3c6e6b Implemented line indexing for faster jumps/looping.
This required adding the ability to to get and set the
tokenizer's current position pointer from outside of it with
tokenizer_pos and tokenizer_goto (c.f. tokenizer_init).
The index itself is stored as a linked list, which makes it ripe
for further optimization. It is accessed with index_* routines.
The interpreter resorts to running the old, slower jump procedure
when jumping forward (to a line that hasn't been index).

New goto test.
2013-12-22 16:51:39 +02:00
Danyil Bohdan
9c45ed4588 Implemented comments with REM. 2013-12-22 14:23:14 +02:00
Danyil Bohdan
ea7a52e61f Moved VARIABLE_TYPE to vartype.h. VARIABLE_TYPE functions.
The functions in ubasic.c that used int for variable values and
the function expr() in tokenizer.c now use VARIABLE_TYPE.

Also added a new test in tests.c.
2013-12-21 23:59:44 +02:00
Danyil Bohdan
a519c98e6c Added file LICENSE.
License text taken from http://dunkels.com/adam/ubasic/license.html.
2013-12-21 22:46:35 +02:00
Danyil Bohdan
c865e86b8e Fixed assignment to 'a'. Added tests and VARIABLE_TYPE.
The VARIABLE_TYPE defines what type uBASIC's variables are.
2013-12-21 22:43:47 +02:00
Adam Dunkels
c8de545eda Update README.md 2013-09-04 23:39:58 +02:00
Adam Dunkels
de732f669d Updated the README file 2013-09-04 23:38:25 +02:00
Adam Dunkels
c299654d1c The uBASIC 0.1 source code 2013-09-04 23:35:28 +02:00
Adam Dunkels
bcb458da42 Initial commit 2013-09-04 14:34:35 -07:00