Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ Electronics ➜ G-Pascal ➜ Code before Ben Eater version?

Code before Ben Eater version?

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


Posted by Robbbates   (6 posts)  Bio
Date Wed 01 May 2024 03:03 AM (UTC)
Message
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
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 01 May 2024 05:29 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


1,487 views.

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

Go to topic:           Search the forum


[Go to top] top

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