Jubatian / cuzebox

CUzeBox emulator
GNU General Public License v3.0
12 stars 2 forks source link

Debug console #6

Open danboid opened 3 years ago

danboid commented 3 years ago

I asked on the UB forums if it would be possible to add serial support to cuzebox and told it would be a lot of work to add but artcfox posted some patches for cuzebox to add a debug console to cuzebox. It would be good to see something like this upstreamed into cuzebox.

http://uzebox.org/forums/viewtopic.php?f=9&t=11147&sid=2bcafd90f295365b47f0f4e0497a7e79

Note I've not actually the current patch as it seems to be Windows only and I run Linux so I'm not sure how well it works yet but I like the concept.

danboid commented 2 years ago

User Artcfox posted the following patch to the Uzebox forum to add Linux whisper console output to cuzebox.

To use this patch, add the following DEFINES to your program:

#define UZEMH _SFR_IO8(25)
#define UZEMC _SFR_IO8(26)

You can then print an s and a newline, for example, to the cuzebox console using:

_SFR_IO8(0X1a)='s';
_SFR_IO8(0X1a)='\n';

The patch:

diff --git a/cu_avr.c b/cu_avr.c
index a5832ab..77172d4 100644
--- a/cu_avr.c
+++ b/cu_avr.c
@@ -597,6 +597,14 @@ static void  cu_avr_write_io(auint port, auint val)

  access_io[port] |= CU_MEM_W;

+ if (port == 0x3A){
+   // emulator-only whisper support
+   printf("%c", cval);
+ }else if (port == 0x39){
+   // emulator-only whisper support
+   printf("%02x", cval);
+ }
+
  switch (port){

   case CU_IO_PORTA:   /* Controller inputs, SPI RAM Chip Select */

I have asked Artcfox if he wants to commit this change to the repo himself on the Uzebox forum.

http://uzebox.org/forums/viewtopic.php?f=9&t=11147&start=10