Back to photostream

8BASIC theory 6/6: Statements III

8BASIC (C) is a BASIC interpreter developed by manufacturer G.G in 2010 for the homemade Z80/AM95 8 bit NANO COMPUTER.

 

 

 

38 "INPUT A " ; ask the user to enter the numeric value of variable A

39 "INPUT T$" ; ask the user to enter the string value of variable T$

40 " CLS " ; clears (blank) the 16-segment LED displays and reset (0) the 7-segment ones

41 " CLEAR " ; reset variables to their default type value

42 "PRINT A " ; display the numeric value of variable A

43 "PRINT T$" ; display the string value of variable T$

44 "PRINT+T$" ; display and scroll the strings T$ and consecutives till encountering # char

45 "PAUSE T " ; suspend the program execution. Value of T is the time in ms to pause

46 "BEEP T,F" ; generate a tone. T is the tone duration (ms). F is the tone number (max 7)

47 " IN (A) " ; assign to variable A the binary value input from the 8 bit parallel port

48 " OUT (A)" ; output binary value of variable A to the 8 bit parallel port

49 "A=PEEK X" ; assign to variable A the byte value at the X memory location

50 "POKE X,A" ; write byte value of variable A into X memory location

51 "SYS X " ; branch (and jump back) to the machine language program at the X location

 

Each statement is precompiled as much as possible to make the interpreter run faster and it always occupies 16 bytes.

 

Statements allow you extreme flexibility. For example a FOR...TO..NEXT cycle can be easily written as:

 

LET I=+1.00000

LET U=+1.00000

LET T=number of cycles

N:

 

cycle

 

I=I+U

IFT>=I:N

END

 

Due to the internal RAM memory structure, the maximum size of the 8BASIC program has been set to 488 lines, which will fit the first 8K RAM chip.

2,146 views
0 faves
0 comments
Uploaded on December 24, 2010
Taken on December 24, 2010