Coder Social home page Coder Social logo

spotlessmind1975 / ugbasic Goto Github PK

View Code? Open in Web Editor NEW
82.0 9.0 12.0 21.75 MB

An isomorphic BASIC language compiler for retrocomputers

License: Apache License 2.0

Makefile 0.34% C 80.82% Lex 0.22% Yacc 1.96% Assembly 14.03% Awk 0.01% PHP 0.02% Shell 0.04% BASIC 0.99% FreeBasic 0.15% C++ 1.43%

ugbasic's Introduction

ugBASIC

An isomorphic BASIC language compiler for retrocomputers by Marco Spedaletti ([email protected])

ABOUT THIS SOFTWARE

A cross compiler of BASIC dialect specialized in programs that are very efficient "by design" on various 8-bit platforms (based on MOS 6502/6510, Motorola 6809 and Zilog Z80), without the need for "fine tuning" them and without compromises of other dev-kits.

WHY SHOULD I USE "ugBASIC"?

  • Modern programming - all the most modern BASIC constructs are available, like dynamic strings, procedures, constants, functions, inclusion of libraries, ....
  • Multitasking - procedures can be called on a parallel way.
  • Fast execution - BASIC source code, graphical and audio resources are compiled directly in assembly, and optimized for the specific CPU, and all calculations are done on integer numbers, moreover it does not use any stack.
  • No ROM dependency - the executable take care of all the hardware, with no dependency from installed ROM that will be swapped out, if possible.
  • RAM optimizations - all RAM is available for code and data, and it is available a fast compression / decompression routine "out of the box".
  • Cross development - use your modern Linux or Windows PC to compile for about 20 different retro computers, from Commodore 64 to Amstrad CPC 664.
  • Modern IDE available - you can also use a modern IDE to develop.

For more information please look here.

SUPPORTED HARDWARE

This is a short list of supported hardware and output file formats:

  • Atari 400/800 (atari)
  • Atari 1200XL (atarixl)
  • Atari 600XL/800XL (atarixl)
  • Atari XE Video Game System (atarixl)
  • Commodore 128 (c128)
  • Commodore 64 (c64)
  • Commodore 64 REU (c64reu)
  • Commodore PLUS/4 (plus4)
  • Commodore VIC-20 (vic20)
  • Dragon 32 (d32)
  • Dragon 64 (d64)
  • Dragon 200-E (d64)
  • Olivetti PC128 Prodest (pc128op)
  • Thomson (mo5)
  • Amstrad CPC (cpc)
  • ColecoVision (coleco)
  • MSX (msx1)
  • SEGA SC-3000 (sc3000)
  • SEGA SG-1000 (sg1000)
  • TRS-80 Color Computer (coco)
  • ZX Spectrum 48K (zx)

The complete list of targets can be found here.

WHAT DOES "ug" MEAN?

It is an acronym.

  • The letter u stands for "micro" because it is a "minimal" language, which is translated as linearly as possible into assembly without abstractions. Note that the nature of isomorphism is like that it may not be "minimal" in terms of syntax. There may be redundancies, but the concept remains.
  • The letter g stands for "game", because the language was designed to write video games, even advanced ones. It has a number of primitives that hook directly to hardware characteristics. For example, there are instructions to synchronize the execution to the vertical blank, to manage animations, background music and so on.

LICENSE

Copyright 2021-2024 Marco Spedaletti

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

This program contains algorithms and software written by third parts. Please refer to the conditions present in that page also, if you wish to reproduce or reuse this software.

ugbasic's People

Contributors

dinoflorenzi avatar samuel-devulder avatar spotlessmind1975 avatar varmfskii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ugbasic's Issues

Add support for Coleco Adam

The Coleco Adam is a home computer and expansion device for the ColecoVision released in 1983 by American toy and video game manufacturer Coleco. It was an attempt to follow on the success of the company's ColecoVision video game console. The Adam was not very successful, partly because of early production problems, and was discontinued in early 1985.

Add support for CPU Motorola 6809

The Motorola 6809 ("sixty-eight-oh-nine") is an 8-bit microprocessor CPU with some 16-bit features. It was designed by Motorola's Terry Ritter and Joel Boney and introduced in 1978. Although source compatible with the earlier Motorola 6800, the 6809 offered significant improvements over it and 8-bit contempories like the MOS Technology 6502, including a hardware multiplication, 16-bit math, system and user stack registers allowing re-entrant code, improved interrupts, position-independent code and an orthogonal instruction set architecture with a comprehensive set of addressing modes.

ASSEMBLER: https://www.6809.org.uk/asm6809/
EMULATORS: http://atjs.mbnet.fi/mc6809/#Emu

Add support for CPU Motorola 68HC11

The 68HC11 (6811 or HC11 for short) is an 8-bit microcontroller (µC) family introduced by Motorola in 1984. Now produced by NXP Semiconductors, it descended from the Motorola 6800 microprocessor by way of the 6801. It is a CISC microcontroller. The 68HC11 devices are more powerful and more expensive than the 68HC08 microcontrollers, and are used in automotive applications, barcode readers, hotel card key writers, amateur robotics, and various other embedded systems. The MC68HC11A8 was the first microcontroller to include CMOS EEPROM.

Promotion from WORD/SWORD to POSITION

Actually, this kind of command is invalid:

 MOB airplane1, airplaneImage AT 0,0

It gives the following error, since there is no implicit cast from WORD to POSITION:

    E009 - Datatype mismatch (WORD, POSITION) at 20

It could result in a simplification in the sources if we must not introduce an explicit cast.

IMAGE LOAD doesn't work

The reading of images seems not working.
When reading a 4 colors image, the image seems without color informations.
When reading a 2 colors image, the image seems a monoblock.

Source listing on executable

It should be possibile to give an option to the compiler, in order to save an "hard copy" of the source inside the executable. The source should be, so, listable (on demand) at the very beginning of the execution.

Add support for Commodore 128

The Commodore 128, also known as the C128, C-128, C= 128] is the last 8-bit home computer that was commercially released by Commodore Business Machines (CBM). Introduced in January 1985 at the CES in Las Vegas, it appeared three years after its predecessor, the bestselling Commodore 64.

Add support for CPU Zilog EZ80

The Zilog eZ80 is an 8-bit microprocessor from Zilog, introduced in 2001. eZ80 is an updated version of the company's first product, the Z80 microprocessor.

Add support for CPU Electronic Arrays EA9002

Electronic Arrays 9002 (EA9002) was a microprocessor released in 1976. It was an 8-bit NMOS CPU, with an instruction set influenced by the Intel 4004. It had a 4096 byte address space, due to its use of 12-bit addressing.

MOB INIT with wrong starting position

Currently, when defining a MOB, we must not give the initial position.
However, the default value is not 0,0.
So this code:

 MOB id, resource

is not equivalent to:

 MOB id, resource AT (POSITION)0,(POSITION)0

Add support for CPU Fairchild F8

The Fairchild F8 is an 8-bit microprocessor system from Fairchild Semiconductor, announced in 1974 and shipped in 1975. The original processor family included four main 40-pin integrated circuits (ICs); the 3850 CPU which was the arithmetic logic unit, the 3851 Program Storage Unit (PSU) which contained 1 KB of program ROM and handled instruction decoding, and the 3852 Dynamic Memory Interface (DMI) or 3853 Static Memory Interface (SMI) to control additional RAM or ROM holding the user programs or data. The 3854 DMA was an optional system that added direct memory access into the RAM controlled by the 3852.

ASSEMBLER: https://dasm-assembler.github.io/

Translate guides

Translate in italian the following guides:

  • Basi del linguaggio
  • Gestione stringhe
  • Funzioni matematiche
  • Strutture di controllo
  • Procedure
  • Testi
  • Controlli (I/O)
  • Schermi
  • Primitive grafiche

Replace the the use of "tmpnam"

In temporary file generation, we should avoid to use tmpnam() and we should use mkstemp().
As an alternative, we should disable the warning on the compiler.

TI time missing for ATARI PAL

When using the TI variable under PAL system, the value returned is always zero.
Instead, under NTSC systems, the value is returned correctly.

Reduce prologue

It could be better to reduce the prologue, removing useless variables.

Add support for Camputers Lynx

The Lynx was an 8-bit British home computer that was first released in early 1983 as a 48 kB model. Several models were available with 48 kB, 96 kB or 128 kB RAM. It was possible to reach 192 kB with RAM expansions on board. John Shireff designed the hardware and Davis Jansons the firmware.

Add support for CPU Zilog Z180

The Zilog Z180 eight-bit processor is a successor of the Z80 CPU. It is compatible with the large base of software written for the Z80. The Z180 family adds higher performance and integrated peripheral functions like clock generator, 16-bit counters/timers, interrupt controller, wait-state generators, serial ports and a DMA controller. It uses separate read and write strobes, sharing similar timings with the Z80 and Intel processors.[3] The on-chip memory management unit (MMU) has the capability of addressing up to 1 MB of memory. It is possible to configure the Z180 to operate as the Hitachi HD64180.

Add support for CPU Intel 8051

The Intel MCS-51 (commonly termed 8051) is a single chip microcontroller (MCU) series developed by Intel in 1980 for use in embedded systems. The architect of the Intel MCS-51 instruction set was John H. Wharton. ntel's original versions were popular in the 1980s and early 1990s and enhanced binary compatible derivatives remain popular today. It is an example of a complex instruction set computer, and has separate memory spaces for program instructions and data.

Add support for Amstrad PCW

The Amstrad PCW series is a range of personal computers produced by British company Amstrad from 1985 to 1998, and also sold under licence in Europe as the "Joyce" by the German electronics company Schneider in the early years of the series' life. The PCW, short for Personal Computer Word-processor, was targeted at the wordprocessing and home office markets.

Add support for Cambridge Z88

The Cambridge Computer Z88 is an A4-size, lightweight, portable Z80-based computer with a built-in combined word processing/spreadsheet/database application called PipeDream (functionally equivalent to a 1987 BBC Micro ROM called Acornsoft View Professional), along with several other applications and utilities, such as a Z80-version of the BBC BASIC programming language.

Add support for Amstrad CPC

The Amstrad CPC (short for Colour Personal Computer) is a series of 8-bit home computers produced by Amstrad between 1984 and 1990. It was designed to compete in the mid-1980s home computer market dominated by the Commodore 64 and the Sinclair ZX Spectrum, where it successfully established itself primarily in the United Kingdom, France, Spain, and the German-speaking parts of Europe.

INFO: https://www.cpcwiki.eu/index.php/Technical_documentation
INFO: https://asmtradcpc.z80-8bits.fr/
EMULATORS: https://emulation.gametechwiki.com/index.php/Amstrad_CPC_emulators
COMPILER: z88dk-appmake +cpc

Add support for CPU Signetics 2650

The Signetics 2650 was an 8-bit microprocessor introduced in July 1975. It was "the most minicomputer-like" of the microprocessors available at the time. A combination of missing features and odd memory access limited its appeal, and the system saw little use in the market. Signetics became better known as a second-source supplier for the MOS 6502.

Add support for CPU NEC 78K0

78K0 Series (also known as 78K/0) is a long-running 8-bit single chip microcontroller, which is the basis of 78K0S and 78K0R Series. It contains 8× 8-bit registers ×4 banks. For 16-bit calculating instructions, it performs ALU operation twice. Each instructions are performed serially without instruction pipelining. It has 16-bit 64K Byte address space.

  • 8K0S Series
  • 78K0R Series
  • 178K0 Series
  • 178K0S Series
  • 78K4 Series
  • 78K7 Series
  • 78K6 Series
  • 78K1 Series
  • 78K3 Series

Add support for CPU RCA 1802

The COSMAC is an 8-bit microprocessor family introduced by RCA. It is historically notable as the first CMOS microprocessor. The first production model was the two-chip CDP1801R and CDP1801U, which were later combined into the single-chip CDP1802.[The 1802 represented the majority of COSMAC production, and today the entire line is known simply as the RCA 1802.

  • #117
  • CDP18S020
  • Cidelsa
  • COMIX-35
  • Cosmac Elf
  • Cosmac Elf 2000
  • Cosmac VIP
  • Cosmac VIP II 'ED'
  • Cosmac VIP II 'RCA'
  • Cosmicos
  • ETI 660
  • FRED 1
  • FRED 1.5
  • Infinite UC1800
  • MCDS
  • Membership Card
  • Microboard System
  • Microtutor
  • Microtutor II
  • MS 2000
  • Netronics Elf II
  • Oscom Nano
  • Pecom 32
  • Pecom 64
  • Pico/Elf V2
  • Quest Super Elf
  • RCA Coin Arcade
  • RCA Studio II
  • RCA Studio III
  • Victory MPT-02
  • RCA Studio IV
  • Telmac TMC-600
  • Telmac 1800
  • Telmac 2000
  • VELF
  • VIP2K
  • Visicom COM-100

ASSEMBLER: https://www.retrotechnology.com/memship/a18.html
(list to be converted in issues based on EMMA02 emulator : https://www.emma02.hobby-site.com/ )

Add support for CPU Atmel AVR

AVR is a family of microcontrollers developed since 1996 by Atmel, acquired by Microchip Technology in 2016. These are modified Harvard architecture 8-bit RISC single-chip microcontrollers. AVR was one of the first microcontroller families to use on-chip flash memory for program storage, as opposed to one-time programmable ROM, EPROM, or EEPROM used by other microcontrollers at the time. AVR microcontrollers find many applications as embedded systems. They are especially common in hobbyist and educational embedded applications, popularized by their inclusion in many of the Arduino line of open hardware development boards.

Add support for CPU Intel 8085

The Intel 8085 ("eighty-eighty-five") is an 8-bit microprocessor produced by Intel and introduced in March 1976. It is a software-binary compatible with the more-famous Intel 8080 with only two minor instructions added to support its added interrupt and serial input/output features. However, it requires less support circuitry, allowing simpler and less expensive microcomputer systems to be built.

Add support for CCE MC-1000

The CCE MC-1000 was an obscure Home computer produced in Brazil by CCE (Comércio de Componentes Eletrônicos). Not much is known about the machine, but it seems clear that it owned its heritage to the Belgian GEM 1000, and the Rabbit RX83 which were systems produced in Hong-Kong by the firm "Rabbit computers”. It was launched a year after the MC 4000, an Apple 2 clone.

Add support for CPU Microchip PIC

PIC (usually pronounced as "pick") is a family of microcontrollers made by Microchip Technology, derived from the PIC1650 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to Peripheral Interface Controller, and is currently expanded as Programmable Intelligent Computer.

Add support for Build Your Own Z80 Computer

Build Your Own Z80 Computer: design guidelines and application notes is a book written by Steve Ciarcia, published in 1981 by McGraw-Hill. The book explains step-by-step the process of building a computer from the ground up, using the Zilog Z80 8-bit Microprocessors, including building a power supply, keyboard, and interfaces to a CRT terminal and tape drive.

Add support for Bandai RX-78

The Bandai RX-78 is a Japanese 8-bit microcomputer manufactured by Bandai. It first appeared in 1983, and employed a SHARP LH0080A (Z80A clone) CPU. It ran at a clock speed of 4.1 MHz, and shipped with 30 KB of RAM.[1] Its 27-color display had a maximum resolution of 192×184 pixels. Its name comes from the RX-78-2 Gundam.

Add support for CPU Hudson HuC6280

The HuC6280 8-bit microprocessor is Japanese company Hudson Soft's improved version of the WDC 65C02 CPU, an upgraded CMOS version of the popular NMOS-based MOS Technology 6502 8-bit CPU manufactured for Hudson by Seiko Epson and NEC. The most notable product using the HuC6280 is NEC's TurboGrafx-16 video game console.

ASSEMBLER: ca65
EMULATOR: TurboEngine (freeware) http://www.emulator-zone.com/doc.php/pcengine/turbo-engine.html
INFORMATIONS: https://www.copetti.org/writings/consoles/pc-engine/

Add support for CPU Ricoh 2A03

The Ricoh 2A03 or RP2A03 (NTSC version) / Ricoh 2A07 or RP2A07 (PAL version) is an 8-bit microprocessor manufactured by Ricoh for the Nintendo Entertainment System video game console. It was also used as a sound chip and secondary CPU by Nintendo's arcade games Punch-Out!! and Donkey Kong

Add support for CPU Zilog Z8

The Zilog Z8 is a microcontroller architecture, originally introduced in 1979, which today also includes the Z8 Encore!, eZ8 Encore!, eZ8 Encore! XP, and eZ8 Encore! MC families. Signifying features of the architecture are up to 4,096 fast on-chip registers which may be used as accumulators, pointers, or as ordinary random-access memory (RAM). A 16-bit address space for between 1 kibibyte (KB) and 64 KB of either programmable read-only memory (PROM, OTP), read-only memory (ROM), or flash memory, are used to store code and constants, and there is a second 16-bit address space which can be used for large applications.

Add support for Aster CT-80

The Aster CT-80, an early (1982) home/personal computer developed by the small Dutch company MCP (later renamed to Aster Computers), was sold in its first incarnation as a kit for hobbyists. Later it was sold ready to use.

Add support for ABC 80

The ABC 80 (Advanced BASIC Computer 80) was a personal computer engineered by the Swedish corporation Dataindustrier AB (DIAB) and manufactured by Luxor in Motala, Sweden in the late 1970s and early 1980s. It was introduced on the market in August 1978.

Add support for Colour Genie

The EACA EG2000 Colour Genie was a computer produced by Hong Kong-based manufacturer EACA and introduced in Germany in August 1982. It followed their earlier Video Genie I and II computers and was released around the same time as the business-oriented Video Genie. The BASIC was compatible with the Video Genie I and II and the TRS-80, except for graphic and sound commands; most of the routines for Video Genie I BASIC commands were left over in the Colour Genie's BASIC ROM. Programs were provided to load TRS-80 programs into the Colour Genie. Colour Genie disks could be read in a TRS-80 floppy disk drive and vice versa, editing the pdrive commands.

Add support for CPU Motorola 68008

The Motorola 68008 is an 8/16/32-bit microprocessor introduced by Motorola in 1982. It is a version of 1979's Motorola 68000 with an 8-bit external data bus, as well as a smaller address bus. The 68008 was designed to work with low cost 8-bit memory systems. Because of its smaller data bus, it was roughly half as fast as a 68000 of the same clock speed. It was still faster than competing 8-bit microprocessors, because internally the 68008 behaves identically to the 68000 and has the same microarchitecture.

ASSEMBLER: https://linux.die.net/man/1/m68k-linux-gnu-as

Add support for array of bits

It could be useful to have a BIT datatype, usable with the arrays.
So we can define someting like:

DIM x AS BIT(16)

This will take just 2 bytes and by accessing to

x(2)

we will access to the 3rd bit of the first byte.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.