Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

a BASIC interpreter for CP/M and the RetroBrew SBC v2, based on the Z80 port of Palo Alto Tiny Basic

License

NotificationsYou must be signed in to change notification settings

dimitrit/tastybasic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

Tasty Basic is a basic interpreter for CP/M and RomWBW (Warthen, 2021), based onthe Z80 port of Palo Alto Tiny Basic (Gabbard, 2017; Rauskolb, 1976; Wang, 1976).

Tasty Basic Language

The Tasty Basic language is based on Palo Alto Tiny Basic, as described in the December 1976issue of Interface Age (Rauskolb, 1976). As such, Tasty Basic shares many of thesame limitations as Palo Alto Basic. All numbers are integers and must be less than orequal to 32767, and Tasty Basic supports only 26 variables denoted by letters A through Z.

In addition to Tiny Basic'sABS(n),RND(n) andSIZE functions, Tasty Basic also providesstatements and functions to read and write memory locations, and allows interaction with I/O ports.

Statements

Tasty Basic provides two statements to write to memory and I/O ports:

POKE m,n Writes the valuen to address locationm

OUT m,n Sends the value n to I/O portm

Additionally there are statements to define and read constant values:

DATA m[,n[,...]] Used to store constant values in the program code. Each DATA statement can define one or more numeric constants separated by commas.DATA statements may appear anywhere in the program.

READ m Reads the next available data value and assigns it to variablem, starting with the first item in the firstDATA statement.

RESTORE Resets theREAD pointer to the first item of the data list, allowingDATA values to be re-read.

CP/M Specific Statements

The CP/M version includes two additional statements that allow Tasty Basic programs to be savedto, and loaded from, disk:

LOAD "filename" Loads the Tasty Basic (.TBA) file with the givenfilename from the current disk drive into memory. Any existing programs and variables are cleared before the program is loaded.

SAVE "filename" Persists the program currently in memory in a file with the givenfilename on the current disk drive.

Refer toTasty Basic files for details of the.TBA file format.

Functions

Tasty Basic provides the following functions to read from and write to memory locations and I/O ports:

IN(m) Returns the byte value read from I/O portm

PEEK(m) Returns the byte value of address locationm

USR(i) Accepts a numeric expressioni , calls a user-defined machine language routine, and returns the resulting value.

User defined machine language routines

TheUSR(i) function enables interaction with user defined machine routines.The entry point for these routines is specified using a platform specific vectorpointing to a default location as shown below. User defined code may beplaced elsewhere in memory by updating the vector values.The valuei is passed to the routine in theDE register, which must alsocontain the result on return.

PlatformVector locationDefault value
CP/M$0BFE/$0BFF$0C00
RomWBW$13FE/$13FF$1400

Example

The following example shows the bit summation for a given value:

  0000             #IFDEF CPM  0C00             .ORG $0C00; ie. 3072 dec  0C00~            #ELSE  0C00~            .ORG $1400; ie. 5120 dec  0C00             #ENDIF  0C00               0C00 06 00       LD B,0  0C02 7A          LD A,D  0C03 CD 0E 0C    CALL COUNT  0C06 7B          LD A,E  0C07 CD 0E 0C    CALL COUNT  0C0A 58          LD E,B  0C0B 16 00       LD D,0  0C0D C9          RET  0C0E             COUNT:  0C0E B7          OR A  0C0F C8          RET Z  0C10 CB 47       BIT 0,A  0C12 28 01       JR Z,NEXT  0C14 04          INC B  0C15             NEXT:  0C15 CB 3F       SRL A  0C17 18 F5       JR COUNT  0C19               0C19             .END
10 REM -- CP/M VERSION20 REM -- SEE EXAMPLES DIRECTORY FOR OTHER PLATFORMS30 FOR I=0 TO 2440 READ A50 POKE 3072+I,A60 NEXT I70 INPUT P80 LET Q=USR(P)90 PRINT "THE BIT SUMMATION OF ",#5,P," IS ",#2,Q100 GOTO 70110 DATA 6,0,122,205,14,12,123,205,14,12,88,22,0,201120 DATA 183,200,203,71,40,1,4,203,63,24,245

Note that the Tasty Basic program above is CP/M specific. Examples for other platforms can be foundin theexamples directory.

Building Tasty Basic

Building Tasty Basic requires theuz80as Z80 assembler v1.12 or later (Giner, 2021).Alternatively, Windows users can use TASM (Telemark Assembler) (Anderson, 1998).

RomWBW version

Tasty Basic is part of the SBCv2 RomWBW distribution. Please refer to theRomWBW github repository for details.

CP/M version

The CP/M version of Tasty Basic can be built using the-dCPM flag:

uz80as -dCPM tastybasic.asm tbasic.com

The resultingtbasic.com command file can be run in CP/M. For example:

B>TBASIC ↵CP/M TASTY BASIC28902 BYTES FREEOK>10 PRINT "HELLO WORLD ", ↵>RUN ↵HELLO WORLD OK>BYE ↵B>

Example BASIC programs

A small number of example Tasty Basic programs are included in theexamples directory.Most of these programs are fromBASIC COMPUTER GAMES (Ahl, 1978), andhave been modified as required to make them work with Tasty Basic.

License

In line with Wang's (1976) original Tiny Basic source listing and later derived worksby Rauskolb (1976) and Gabbard (2017), Tasty Basic is licensed under GPL v3.For license details refer to the enclosedLICENSE file.

References

Ahl, D. H. (Ed.).(1978).BASIC COMPUTER GAMES. New York, NY: Workman Publishing
Anderson, T. N. (1998).The Telemark Assembler (TASM) User's Manual, Version 3.1. Issaquah, WA: Squak Valley Software
b1ackmai1er (2018).SBC V2. Retrieved October 6, 2018, fromhttps://www.retrobrewcomputers.org/doku.php?id=boards:sbc:sbc_v2:start
Gabbard, D. (2017, October 10).TinyBASIC for the z80 – TinyBASIC 2.0g. Retrieved September 29, 2108, fromhttp://retrodepot.net/?p=274
Giner, J. (2021, August 1).Micro Z80 assembler - uz80as. Retrieved September 19, 2021, fromhttps://jorgicor.niobe.org/uz80as/
Rauskolb, P. (1976, December).DR. WANG'S PALO ALTO TINY BASIC. Interface Age, (2)1, 92-108. Retrieved fromhttps://archive.org/stream/InterfaceAge197612/Interface%20Age%201976-12#page/n93/mode/1up
Wang, L-C. (1976).Palo Alto Tiny BASIC. In J. C. Warren Jr. (Ed.),Dr. Dobb's Journal of COMPUTER Calisthenics & Orthodontia (pp. 129-142). Menlo Park, CA: People's Computer Company
Warthen, W. (2021).RomWBW, Z80/Z180 System Software. Retrieved Octover 5, 2021, fromhttps://github.com/wwarthen/RomWBW

About

a BASIC interpreter for CP/M and the RetroBrew SBC v2, based on the Z80 port of Palo Alto Tiny Basic

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp