[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  Electronics
. -> [Folder]  G-Pascal
. . -> [Subject]  G-Pascal for Ben Eater's 6502 breadboard PC

G-Pascal for Ben Eater's 6502 breadboard PC

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] bio   Forum Administrator
Date Sun 27 Feb 2022 01:15 AM (UTC)

Amended on Sun 27 Feb 2022 01:22 AM (UTC) by Nick Gammon

Message

Today I have released on-board code (to be installed on your EEPROM) for Ben Eater’s 6502 computer.

Full documentation is on my website here.

The code in the EEPROM includes:

  • A 6502 assembler which lets you try out your assembler programming without having to keep removing the EEPROM chip and programming it externally. The assembler supports:
  • A “tiny” Pascal compiler (G-Pascal) which allows you to program the board in a high-level language. Whilst there are limitations in what can be done in a few KB of memory, the compiler supports:
    • CONST, VAR, FUNCTION and PROCEDURE declarations
    • Local declarations (functions and variables within functions, etc.)
    • Recursive function and procedure calls
    • Arithmetic: multiply, divide, add, subtract, modulus
    • Logical operations: and, or, shift left, shift right, exclusive or
    • INTEGER and CHAR data types. (Integer are 3 bytes and thus range from 8388607 to -8388608)
    • Arrays
    • Interface with any memory address by using the MEM and MEMC constructs (to peek and poke memory locations)
    • Built-in functions to write to the LCD display.
    • Built-in functions to do pinMode, digitalRead and digitalWrite, similar to the Arduino. These interface with any available ports on the VIA chip.

    • Here is “hello world” for the LCD display:

      And for the serial monitor:

    • Detailed notes about the compiler here.

  • A text editor for keying in programs. It supports:
  • Support functions, such as:
    • RS232 interface for connecting a “dumb” terminal, or a PC/Mac
    • Support for the LCD interface described in Ben’s videos
    • Other support functions for use by your assembler code, such as multiplication and division, CRC calculations, binary-to-decimal conversion
    • Support for NMI (non-maskable interrupts) so that you can recover from runaway code
    • There is approximately 12k of space available on the EEPROM to add your own functions

Both the Pascal compiler and assembler are quite fast. Any program that will fit into memory will compile in a few seconds. For example, using a 1 MHz clock:

  • A 335-line assembler program testing all opcodes assembles in 9 seconds
  • A 651-line G-Pascal program (the Adventure game) compiles in 6 seconds

How much does it cost?

  • The software is open source
  • There is no fee
  • You do not need to register
  • You do not need to provide any personal details such as email address
  • The software can be downloaded from GitHub
  • The license (MIT License) is here

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 28 Feb 2022 02:55 AM (UTC)

Amended on Tue 08 Mar 2022 05:13 AM (UTC) by Nick Gammon

Message
Demonstration video here:


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


8,377 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]