Hack-a-Day / basic-badge

2018 Hackaday Belgrade Hardware Badge
MIT License
36 stars 8 forks source link

Simple PEEK and POKE for BASIC #39

Closed szczys closed 6 years ago

szczys commented 6 years ago

I was discussing this with @vantonic last night. Would it be possible to implement simple RAM access in BASIC? I know we're limited to 16-bit numbers in interpreter. But since we don't have DIM and are limited to 26 variables, this would give a lot more flexibility.

Here's how it might work:

edit: I put in an 8-bit value before but meant 16-bit. To me it makes sense to use HEX so you don't need to type 65535 but really whatever is easiest to implement since we're at the deadline for this.

jaromir-sukuba commented 6 years ago

Implemented in 0.76. You can run

10 for a = 0 to 10 20 b = a * 3 30 poke a,b 40 next a 50 for a = 0 to 10 60 println peek a 70 next a

to print numbers 0...30

Currently, it doesn't support hexadecimal numbers.

szczys commented 6 years ago

Tested and working.