Code before Ben Eater version?

Posted by Robbbates on Wed 01 May 2024 03:03 AM — 2 posts, 6,694 views.

#0
Would you happen to have the code before you implemented the serial with VIA? I'd like to implement a version using the UART, but there seems to be a lot of things changed in many places in the code, specifically using the serial_in_byte_received related function. It's hard to dig out what's trying to be done in each instance. I'd like to roll it back and then

Robb
Australia Forum Administrator #1
The original code can be found here: http://www.gammon.com.au/GPascal/source/

If you look at the code here:

https://github.com/nickgammon/G-Pascal/blob/3292b3938a9c83d360fb26d42783fa3207455a16/src/hardware.inc#L212

You can see the minor changes that are made for the emulator, which I used for a lot of testing.

You basically need to replace:

  • CHRIN - gets a character from serial (blocks)
  • write_char - writes a character to serial
  • GETIN - same as CHRIN
  • serial_available - (non-blocking) see if a character is available from serial


That's it!

In the emulator CHRIN was slightly different to GETIN. CHRIN read an entire line (it made typing a line of text easier) whereas GETIN read a single character.


Look for the ".if EMULATOR" directive.