Converting Programs from Pbasic to Zbasic

Total Page:16

File Type:pdf, Size:1020Kb

Converting Programs from Pbasic to Zbasic Guide to Converting Programs from PBasic to ZBasic Version 1.1 Copyright © 2008 Elba Corp. All rights Reserved. Publication History August 2008 – First draft release September 2008 – First public release November 2008 – Minor corrections Disclaimer Elba Corp. makes no warranty regarding the accuracy of or the fitness for any particular purpose of the information in this document or the techniques described herein. The reader assumes the entire responsibility for the evaluation of and use of the information presented. The Company reserves the right to change the information described herein at any time without notice and does not make any commitment to update the information contained herein. No license to use proprietary information belonging to the Company or other parties is expressed or implied. Trademarks ZBasic, ZX-24, ZX-24a, ZX-24n, ZX-24p, ZX-40, ZX-40a, ZX-40n, ZX-40p, ZX-44, ZX-44a, ZX-44n, ZX- 44p, ZX-1280, ZX-1280n, ZX-1281 and ZX-1281n are trademarks of Elba Corp. Other brand and product names are trademarks or registered trademarks of their respective owners. ii Table of Contents Introduction ............................................................................................................................................. 1 General Issues ........................................................................................................................................1 I/O Ports and Pins ...................................................................................................................................2 Defining and Using Constants..................................................................................................................4 Using Numeric Constants ........................................................................................................................5 Defining and Using Variables...................................................................................................................6 Expressions, Operators and Order of Operations.....................................................................................8 Defining and Using Subroutines...............................................................................................................9 Defining and Using Functions ..................................................................................................................9 PBasic Statements, Commands and Directives...................................................................................... 11 BRANCH.......................................................................................................................................... 11 BUTTON .......................................................................................................................................... 12 COUNT ............................................................................................................................................ 12 DATA ............................................................................................................................................... 12 DEBUG ............................................................................................................................................ 13 DEBUGIN......................................................................................................................................... 13 DO…LOOP ...................................................................................................................................... 13 DTMFOUT........................................................................................................................................ 13 END ................................................................................................................................................. 13 FOR…NEXT .................................................................................................................................... 13 FREQOUT........................................................................................................................................ 13 GOSUB ............................................................................................................................................ 14 GOTO .............................................................................................................................................. 14 HIGH................................................................................................................................................ 15 IF…THEN......................................................................................................................................... 15 INPUT .............................................................................................................................................. 15 LOOKDOWN.................................................................................................................................... 16 LOOKUP .......................................................................................................................................... 16 LOW................................................................................................................................................. 17 NAP ................................................................................................................................................. 17 ON…GOSUB ................................................................................................................................... 18 ON…GOTO...................................................................................................................................... 18 OUTPUT .......................................................................................................................................... 18 PAUSE............................................................................................................................................. 18 PULSIN ............................................................................................................................................ 19 PULSOUT ........................................................................................................................................ 19 PWM................................................................................................................................................ 20 RANDOM ......................................................................................................................................... 20 RCTIME ........................................................................................................................................... 20 READ............................................................................................................................................... 21 RETURN .......................................................................................................................................... 21 REVERSE........................................................................................................................................ 21 SELECT…CASE .............................................................................................................................. 22 SERIN.............................................................................................................................................. 22 SEROUT .......................................................................................................................................... 22 SHIFTIN ........................................................................................................................................... 23 iii SHIFTOUT ....................................................................................................................................... 23 SLEEP ............................................................................................................................................. 23 STOP ............................................................................................................................................... 24 TOGGLE .......................................................................................................................................... 24 WRITE ............................................................................................................................................. 24 XOUT............................................................................................................................................... 25 PBasic Conversion Example.................................................................................................................. 26 Conversion Phase 1 ......................................................................................................................... 27 Conversion Phase 2 ......................................................................................................................... 32 PBasic Conversion Helper Code............................................................................................................ 34 iv This page is intentionally blank. v Guide to Converting Programs from PBasic to ZBasic Introduction The original BASIC programming language was designed in 1964 by John Kemeny and Thomas Kurtz at
Recommended publications
  • BASIC Session
    BASIC Session Chairman: Thomas Cheatham Speaker: Thomas E. Kurtz PAPER: BASIC Thomas E. Kurtz Darthmouth College 1. Background 1.1. Dartmouth College Dartmouth College is a small university dating from 1769, and dedicated "for the educa- tion and instruction of Youth of the Indian Tribes in this Land in reading, writing and all parts of learning . and also of English Youth and any others" (Wheelock, 1769). The undergraduate student body (now nearly 4000) outnumbers all graduate students by more than 5 to 1, and majors predominantly in the Social Sciences and the Humanities (over 75%). In 1940 a milestone event, not well remembered until recently (Loveday, 1977), took place at Dartmouth. Dr. George Stibitz of the Bell Telephone Laboratories demonstrated publicly for the first time, at the annual meeting of the American Mathematical Society, the remote use of a computer over a communications line. The computer was a relay cal- culator designed to carry out arithmetic on complex numbers. The terminal was a Model 26 Teletype. Another milestone event occurred in the summer of 1956 when John McCarthy orga- nized at Dartmouth a summer research project on "artificial intelligence" (the first known use of this phrase). The computer scientists attending decided a new language was needed; thus was born LISP. [See the paper by McCarthy, pp. 173-185 in this volume. Ed.] 1.2. Dartmouth Comes to Computing After several brief encounters, Dartmouth's liaison with computing became permanent and continuing in 1956 through the New England Regional Computer Center at MIT, HISTORY OF PROGRAMMING LANGUAGES 515 Copyright © 1981 by the Association for Computing Machinery, Inc.
    [Show full text]
  • Development of Time Shared Basic System Processor for Hewlett Packard 2100 Series Computers by John Sidney Shema a Thesis Submit
    Development of time shared basic system processor for Hewlett Packard 2100 series computers by John Sidney Shema A thesis submitted to the Graduate Faculty in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE in Electrical Engineering Montana State University © Copyright by John Sidney Shema (1974) Abstract: The subject of this thesis is the development of a low cost time share BASIC system which is capable of providing useful computer services for both commercial and educational users. The content of this thesis is summarized as follows:First, a review of the historical work leading to the development of time share principles is presented. Second, software design considerations and related restrictions imposed by hardware capabilities and their impact on system performance are discussed. Third, 1000D BASIC operating system specifications are described by detailing user software capabilities and system operator capabilities. Fourth, TSB system organization is explained in detail. This involves presenting TSB system modules and describing communication between modules. A detailed study is made of the TSB system tables and organization of the system and user discs. Fifth, unique features of 1000D BASIC are described from a functional point of view. Sixth, a summary of the material presented in the thesis is made. Seventh, the recommendation is made that error detection and recovery techniques be pursued in order to improve system reliability. In presenting this thesis in partial fulfillment of the requirements, for an advanced degree at Montana State University, I agree that permission for extensive copying of this thesis for scholarly purposes may be granted by my major professor, or, in his absence, by the Director of Libraries.
    [Show full text]
  • Basic: the Language That Started a Revolution
    TUTORIAL BASIC BASIC: THE LANGUAGE THAT TUTORIAL STARTED A REVOLUTION Explore the language that powered the rise of the microcomputer – JULIET KEMP including the BBC Micro, the Sinclair ZX80, the Commodore 64 et al. ike many of my generation, BASIC was the first John Kemeny, who spent time working on the WHY DO THIS? computer language I ever wrote. In my case, it Manhattan Project during WWII, and was inspired by • Learn the Python of was on a Sharp MZ-700 (integral tape drive, John von Neumann (as seen in Linux Voice 004), was its day L very snazzy) hooked up to my grandma’s old black chair of the Dartmouth Mathematics Department • Gain common ground with children of the 80s and white telly. For other people it was on a BBC from 1955 to 1967 (he was later president of the • Realise how easy we’ve Micro, or a Spectrum, or a Commodore. BASIC, college). One of his chief interests was in pioneering got it nowadays explicitly designed to make computers more computer use for ‘ordinary people’ – not just accessible to general users, has been around since mathematicians and physicists. He argued that all 1964, but it was the microcomputer boom of the late liberal arts students should have access to computing 1970s and early 1980s that made it so hugely popular. facilities, allowing them to understand at least a little And in various dialects and BASIC-influenced about how a computer operated and what it would do; languages (such as Visual Basic), it’s still around and not computer specialists, but generalists with active today.
    [Show full text]
  • BASIC Programming with Unix Introduction
    LinuxFocus article number 277 http://linuxfocus.org BASIC programming with Unix by John Perr <johnperr(at)Linuxfocus.org> Abstract: About the author: Developing with Linux or another Unix system in BASIC ? Why not ? Linux user since 1994, he is Various free solutions allows us to use the BASIC language to develop one of the French editors of interpreted or compiled applications. LinuxFocus. _________________ _________________ _________________ Translated to English by: Georges Tarbouriech <gt(at)Linuxfocus.org> Introduction Even if it appeared later than other languages on the computing scene, BASIC quickly became widespread on many non Unix systems as a replacement for the scripting languages natively found on Unix. This is probably the main reason why this language is rarely used by Unix people. Unix had a more powerful scripting language from the first day on. Like other scripting languages, BASIC is mostly an interpreted one and uses a rather simple syntax, without data types, apart from a distinction between strings and numbers. Historically, the name of the language comes from its simplicity and from the fact it allows to easily teach programming to students. Unfortunately, the lack of standardization lead to many different versions mostly incompatible with each other. We can even say there are as many versions as interpreters what makes BASIC hardly portable. Despite these drawbacks and many others that the "true programmers" will remind us, BASIC stays an option to be taken into account to quickly develop small programs. This has been especially true for many years because of the Integrated Development Environment found in Windows versions allowing graphical interface design in a few mouse clicks.
    [Show full text]
  • An ECMA-55 Minimal BASIC Compiler for X86-64 Linux®
    Computers 2014, 3, 69-116; doi:10.3390/computers3030069 OPEN ACCESS computers ISSN 2073-431X www.mdpi.com/journal/computers Article An ECMA-55 Minimal BASIC Compiler for x86-64 Linux® John Gatewood Ham Burapha University, Faculty of Informatics, 169 Bangsaen Road, Tambon Saensuk, Amphur Muang, Changwat Chonburi 20131, Thailand; E-mail: [email protected] Received: 24 July 2014; in revised form: 17 September 2014 / Accepted: 1 October 2014 / Published: 1 October 2014 Abstract: This paper describes a new non-optimizing compiler for the ECMA-55 Minimal BASIC language that generates x86-64 assembler code for use on the x86-64 Linux® [1] 3.x platform. The compiler was implemented in C99 and the generated assembly language is in the AT&T style and is for the GNU assembler. The generated code is stand-alone and does not require any shared libraries to run, since it makes system calls to the Linux® kernel directly. The floating point math uses the Single Instruction Multiple Data (SIMD) instructions and the compiler fully implements all of the floating point exception handling required by the ECMA-55 standard. This compiler is designed to be small, simple, and easy to understand for people who want to study a compiler that actually implements full error checking on floating point on x86-64 CPUs even if those people have little programming experience. The generated assembly code is also designed to be simple to read. Keywords: BASIC; compiler; AMD64; INTEL64; EM64T; x86-64; assembly 1. Introduction The Beginner’s All-purpose Symbolic Instruction Code (BASIC) language was invented by John G.
    [Show full text]
  • Thomas E. Kurtz Professor of Mathematics and Computer
    Thomas E. Kurtz Professor of Mathematics and Computer Science, Emeritus An Interview Conducted by Daniel Daily Hanover, New Hampshire June 20, 2002 July 2, 2002 DOH-44 Special Collections Dartmouth College Hanover, New Hampshire Thomas Kurtz Interview INTERVIEWEE: Thomas Kurtz INTERVIEWER: Daniel Daily PLACE: Hanover, NH DATE: June 20, 2002 DAILY: Today is June 20, 2002 and I am speaking with Professor Emeritus Thomas Kurtz. Professor Kurtz, one of the first questions I would like to ask is what brought you to Dartmouth and specifically the math department here? KURTZ: It was primarily the attraction of the geographical area. I was a graduate student at Princeton and, incidentally, at one point I lived less than a block from the Kemenys [John G. and Jean Kemeny], but I didnʼt know them down there because we were in different spheres. I think by that time he was a junior faculty member of philosophy and I was a lowly graduate student in mathematics. At any rate, in the summer of 1955, my first wife and I and our family came up to Hanover to visit people who we knew down at Princeton, particularly Bob [Robert] and Anita Norman who had moved up here. He had taken a position in the math department -- or was here for the summer at least -- and [J.] Laurie and Joan Snell, whom we knew quite well at Princeton. So we came up and spent a week…I donʼt know…and thought, “Gee, this is a lovely part of the country.” I had previously thought, “Well, obviously I am going to go out west where men are men and women are glad of it type of thing in the mountains." Then, I think it was about March of the year I was scheduled to finish my degree at Princeton and I had mentioned something about wanting to go to Dartmouth because one of my friends had said that Kemeny was in town recruiting.
    [Show full text]
  • Beginning Microsoft® Small Basic
    ® Beginning Microsoft Small Basic ® ® ® ™ Plus a Porting Guide to Microsoft Visual Basic , C# , and Java © PHILIP CONROD & LOU TYLEE, 2010 Kidware Software PO Box 701 Maple Valley, WA 98038 http://www.computerscienceforkids.com http://www.kidwaresoftware.com Copyright © 2010 by Philip Conrod & Lou Tylee. All rights reserved Kidware Software PO Box 701 Maple Valley, Washington 98038 1.425.413.1185 www.kidwaresoftware.com www.computerscienceforkids.com www.biblebytebooks.com All Rights Reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Printed in the United States of America ISBN-13: 978-1-937161-19-4 Book Cover Illustration by Kevin Brockschmidt Copy Editor: Stephanie Conrod This copy of the Beginning Microsoft Small Basic book and the associated software is licensed to a single user. Copies of the course are not to be distributed or provided to any other user. Multiple copy licenses are available for educational institutions. Please contact Kidware Software for school site license information. This guide was developed for the course, “Beginning Microsoft Small Basic,” produced by Kidware Software, Maple Valley, Washington. It is not intended to be a complete reference to the Small Basic language. Please consult the Microsoft website for detailed reference information. This guide refers to several software and hardware products by their trade names. These references are for informational purposes only and all trademarks are the property of their respective companies and owners. Microsoft, Visual Studio, Small Basic, Visual Basic, Visual J#, and Visual C#, IntelliSense, Word, Excel, MSDN, and Windows are all trademark products of the Microsoft Corporation.
    [Show full text]
  • Radio Shack Collection
    http://oac.cdlib.org/findaid/ark:/13030/c8d50t54 No online items Guide to the Radio Shack collection Finding aid prepared by Jack Doran and Sara Chabino Lott Processing of this collection was made possible through generous funding from the National Archives’ National Historical Publications & Records Commission: Access to Historical Records grant. Computer History Museum 1401 N. Shoreline Blvd. Mountain View, CA, 94043 (650) 810-1010 [email protected] October 2019 Guide to the Radio Shack X4114.2007 1 collection Title: Radio Shack collection Identifier/Call Number: X4114.2007 Contributing Institution: Computer History Museum Language of Material: English Physical Description: 34.59 Linear feet24 record cartons, 4 software boxes, and 1 manuscript box Date (bulk): Bulk, 1979-1985 Date (inclusive): 1973-1993 Abstract: The Radio Shack collection contains materials related to Tandy Corporation/Radio Shack’s microcomputer, the TRS-80. The Manuals series consists of manuals published by Tandy and others concerned with the TRS-80 and also programs authored by Radio Shack and other companies. The Software series consists largely of hand labeled disks containing utilities, operating system tools, games, and write up language programs. The Periodicals series consists of print periodicals about the TRS-80 and its programs published by Tandy and other companies. Processing Information Collection surveyed by Rita Wang, 2016. Collection processed by Jack Doran, October 2019. Access Restrictions The collection is open for research. Publication Rights The Computer History Museum (CHM) can only claim physical ownership of the collection. Copyright restrictions may apply and users are responsible for satisfying any claims of the copyright holder. Requests for copying and permission to publish, quote, or reproduce any portion of the Computer History Museum’s collection must be obtained jointly from both the copyright holder (if applicable) and the Computer History Museum as owner of the material.
    [Show full text]
  • Uving Languages PROMAL Reviewed
    December 1967 Vol. 3. 1'10. 11 IS5M 0885-4017 newstand price: $2.00 photocopy charge per page: $0.15 Releasing the power to everyone. ---------_ .. _-_._---------------------_ .. _--------- PROMAL is such a tanguage. Maybe the easiest way to look at the philosophy of the language is to analyze a small program. where irs easy to see we're not in Basic anymore (the text follOwing a ";" on a program line is a comment, similar to a REM in Appiesoft ): Uving PROG~AM CALC ; floating poin~ caicuiatlon bench_ark for PRf1l'IRL Languages ; (basad on June 1984 Byte. p. 33 6) INCLUDE UBIlARV ; fo~ som" e)(tr;:; PRDnFlI. functIQr.s INCLUDE DJO/PI<T II'![ ; for ' prlnt curnmt :'Ine · ro:.:~ir. e DATA RER:.. F; = 2.71328 : define a feu varlll.i:lles DAlR REAL 8 " :;.1~159 RERL C PROMAL Reviewed WORD COUNT : t nc lu d~('g our l oop tounter DAT A WORD NREPS -" SGOO ; and numbe r of r epe ~. ::ons by Dennis Doms BEG IN ; CALC OUTPUT ·Starting calculations a: • ; pr,n: sta r ting tJ. me If there is one factor affecting the development of software for the Apple Ii. PRTHIE it's the search for a true high-level (that is. higher than assembly language) ?JT CR : follow loll ~ h car ~ cage return development language for the computer. Applesofi Basic. the high-tevel [ = 1.0 : s tart ", l',n C " 1 . 0 language supplied in ROM with the Appte. lacks certain features that make FOR COUNT :: 1 TO NR[ O;-S ; then manIpuLate 1: 3.
    [Show full text]
  • June 1994 Number 6
    June1994 $2.95 The Journal of Washington Apple Pi, Ltd. Artists on Exhibit p. 18 Bits and Bytes Revisited p.21 Mangia~ A software review p.45 ~·----- ,-.............. Washington Apple Pi General Meeting 4th Saturday, July 23 • 9:00 a.m. Community & Cultural Center Northern VA Community College • 8333 Little River Turnpike Annandale, Virginia From the Beltway CI-495) take Exit 6 west on VA 236 approx. 1 mile. Turn left into the campus of Northern Virginia Comm. College. Loop around to the rear ..A.. parking lots, and walk to 11111 the Community & Cultural - Center Building. Northern Virginia Community College There is abundant free parking adjacent to the Community & Cultural Center. New Adob' Illustrator 5.5 is packed with so much value, ifll blow your mind! Brand new Adobe Illustrator•• 5.5 for easy way to save time and money on complex • QuickTim e'" movie tips and techniques Macintosh® is a powerhouse of value! Herc's printing jobs. • 220 typefaces from the Adobe Type Library just a taste of what you get: Import any file with Adobe"' AcrobatTM • Hundreds of professional clip art samples New text features give you more control. software-an $890 value! • O n-line Adobe Illustrator Technical Notes Version 5.5 is just bursting with advanced text With Adobe Acrobat software, you can now • Tryout versions of Adobe Dimensions'," Adobe Photoshop'" and Adobe Premiere•• software, features. Li ke the new Spell C hecker that finds bring virtually any fi le into Adobe lllustracor. and fixes costly typos. And the Tabs filter that Then change colors or curves- even edit text.
    [Show full text]
  • Zbasic Inventor
    The official BASIC Newsletter Upgrades Introduction to A Call for ZBasic Zedcor offers upgrades to users General Purpose at a surprisingly fair price. Subroutines The latest release of the various versions of ZBasic and the This newsletter is for people Many of us would like to reference manual is: that use Zedcor's BASIC obtain Public Domain ZBasic Compiler. ZBasic operates on routines so you don't have to re- Amstrad (CPIM) 3.1 many computers including; create the wheel every time you Apple II DOS 3.3 3.11 IBM PC's, Macintoshes, write a program. Can you CPIM-80 TM 3.1 Apple //s, CP/M machines and imagine the time it would save? Kayproo Graphics 3.1 more. MSDOSTmlIBM PC 3.02 continued page 19 Macintosh' 3.03 "Z" is also the result of TRS-80(1,3 and 4) 3.1 hundreds of requests from ZBasic users. ZBasic Inventor ZBasic Manual: 3rd Edition It is an efficient way to Since ZBasic is a living, distribute important information growing language, there will to programmers including: always be enhancements, bug fixes and improvements. • The latest Upgrade notices • Programming tricks Customer suggestions are • Fixes and Patches continued on page 15 • Program Examples • The latest from Zedcor • Program announcements • Dear Dr. Z column • Technical Support notes Introduction 1 • User Forum Dr. Z 8 • Notes from the Developers Subscription 20 continued on page 9 Applications 19 Apple // 2 Andrew Gariepy, President TRS-CP/M 2 MSDOS 3 As most of you know, Andrew Macintosh 3 Gariepy created the first Updates 1 version on a TRS-80 computer, Users Group 18 back in 1979.
    [Show full text]
  • BASIC to Livecode Conversion Procedure Fmpro Migrator - BASIC to Livecode Conversion Procedure
    FmPro Migrator - BASIC to LiveCode Conversion Procedure FmPro Migrator - BASIC to LiveCode Conversion Procedure 1 BASIC to LiveCode Conversion 1.1 Introduction - BASIC to LiveCode Conversion 4 1.2 Step 1 - Create FmPro Migrator Project File 8 1.3 Step 2 - Select Conversion Options & Convert BASIC Files 12 2 VB6 to LiveCode Conversion 2.1 VB6 to LiveCode - Form and Script Conversion 18 BASIC to LiveCode Conversion FmPro Migrator - BASIC to LiveCode Conversion Procedure - 3 Introduction - BASIC to LiveCode Conversion This document provides an explanation of the steps required to convert BASIC scripts to LiveCode scripts using FmPro Migrator Platinum Edition. This document also includes VB6 to LiveCode conversion info, showing how to convert the VB6 .frm files and .bas script files into LiveCode stacks. Revision 03 9/7/2013 [Updated LiveCode graphics screenshots.] About the BASIC to LiveCode Conversion Process The BASIC to LiveCode conversion process is designed to convert all of the BASIC files within a source directory, including all subdirectories. FmPro Migrator is designed to read BASIC files having a variety of file extensions (including: bas, vba, vbs or txt) during the conversion process. Each file within the source directory is read into memory and analyzed on a line by line basis. Keywords and operators are read and converted to the equivalent keywords and operators in LiveCode. BASIC Code Processing Features 1) Traversal of the files and subdirectories of the selected source directory. Re-creation of the same file and directory structure within the selected destination directory. Quickly convert all of the .bas files within the source directory and subdirectories.
    [Show full text]