BASIC

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
User avatar
marcelk
Posts: 488
Joined: 13 May 2018, 08:26

Re: BASIC

Post by marcelk »

Some progress:
  • FOR-NEXT loops (no STEP)
  • Arrays. No need for DIM, the arrays grow vertically from top of memory towards the end of the program.
  • CLS: Clear screen
  • AT: Position cursor anywhere inside the screen (for Y it performs a lookup in the videoTable)
  • PUT: write an ASCII value (lacking string variables, this gives some flexibility)
  • MODE: will switch between video/speed modes (ignored on ROMv1)
It still needs thorough testing. The previous version had a malfunctioning GOSUB/RETURN.

photo_2018-07-22_20-57-50.jpg
photo_2018-07-22_20-57-50.jpg (237.96 KiB) Viewed 2063 times
photo_2018-07-22_20-57-58.jpg
photo_2018-07-22_20-57-58.jpg (249.79 KiB) Viewed 2063 times

Some nice POKEs:
  • POKE 42, x: Change background color for printing
  • POKE 43, x: Change pen color
  • POKE 257,200: Observe memory layout of BASIC, program, arrays, variables...
The attachment TinyBASIC.gt1 is no longer available
Attachments
TinyBASIC.gt1
(2.63 KiB) Downloaded 325 times
User avatar
marcelk
Posts: 488
Joined: 13 May 2018, 08:26

Re: BASIC

Post by marcelk »

Code: Select all

1 cls:rem Lines demo
2 a=rnd(160):b=8+rnd(120)
3 c=rnd(160):d=8+rnd(120)
4 x=c-a:y=d-b:q=rnd(64)
5 u=1  :ifx<0x=-x:u=-u
6 v=256:ify<0y=-y:v=-v
7 p=a+256*b:ify<xgoto9
8 t=x:x=y:y=t:t=u:u=v:v=t
9 d=-x:x=x+x:y=y+y
10 fort=dto0:pokep,q
11 d=d+y:ifd>0d=d-x:p=p+v
12 p=p+u:nextt:goto2
lines2.png
lines2.png (142.9 KiB) Viewed 2049 times
Post Reply