Emulator Patch Submissions

The Uzebox now have a fully functional emulator! Download and discuss it here.
Post Reply
braddock
Posts: 26
Joined: Fri Jul 31, 2009 12:09 pm

Emulator Patch Submissions

Post by braddock »

I'm not sure what the regular patch submission channel is, so I started this thread.

Here is a patch to get the current development Beta4 emulator version to compile under linux. It should work under either Linux 386/i686 or Win/Cygwin - you just need to uncomment/edit the three lines noted at the top for your platform.

Apply this to tools/emulator directory (or do it manually, it isn't very long).

Code: Select all

Index: avr8.cpp
===================================================================
--- avr8.cpp	(revision 77)
+++ avr8.cpp	(working copy)
@@ -1882,18 +1882,20 @@
     case SPI_READ_SINGLE_BLOCK:

         SPDR = SDReadByte();

         #ifdef USE_SPI_DEBUG

+        {

             // output a nice display to see sector data

             int i = 512-spiByteCount;

             int ofs = i&0x000F;

             static unsigned char buf[16];

             if(i > 0 && (ofs == 0)){

-                printf("%0.4X: ",i-16);

-                for(int j=0; j<16; j++) printf("%0.2X ",buf[j]);

+                printf("%.4X: ",i-16);

+                for(int j=0; j<16; j++) printf("%.2X ",buf[j]);

                 printf("| ");

                 for(int j=0; j<16; j++) printf("%c",ascii(buf[j]));

                 SPI_DEBUG("\n");

             }

             buf[ofs] = SPDR;

+        }

         #endif

         spiByteCount--;

         if(spiByteCount == 0){

Index: uzem.cpp
===================================================================
--- uzem.cpp	(revision 77)
+++ uzem.cpp	(working copy)
@@ -184,7 +184,12 @@
         return 1;

     }

     else if(sddrive){

+#if defined(__WIN32__)

         uzebox.SDMapDrive(sddrive);

+#else

+        printerr("Error: -sddrive is only supported under Windows.  Sorry Penguins.");

+        return 1;

+#endif

     }

     else if(sdimage){

         uzebox.SDLoadImage(sdimage);

Index: avr8.h
===================================================================
--- avr8.h	(revision 77)
+++ avr8.h	(working copy)
@@ -33,7 +33,7 @@
     #include <windows.h> // win32 memory mapped I/O

     #include <winioctl.h>

 #else

-    #include <sys/mmap.h> // unix memory mapped I/O

+    #include <sys/mman.h> // unix memory mapped I/O

 #endif

 

 #ifndef GUI

Index: makefile
===================================================================
--- makefile	(revision 77)
+++ makefile	(working copy)
@@ -2,18 +2,31 @@
 # Public Domain - use at your own risk

 # Note: targets Win32 environment 

 

-TARGET = uzem.exe

-DEBUG_TARGET = uzemdbg.exe

-GCCBASE = c:\minGW

-MTOOLS = utils/mtools.exe

+### UNCOMMENT THIS SECTION FOR LINUX

+EXE_EXT =  # Use under linux

+GCCBASE = # For Linux

+CLIBS = 

+

+### UNCOMMENT THIS SECTION FOR CYGWIN

+#EXE_EXT = .exe # For windows

+#GCCBASE = c:\minGW # For windows

+#CLIBS = -lmingw32

+

+TARGET = uzem$(EXE_EXT)

+DEBUG_TARGET = uzemdbg$(EXE_EXT)

+MTOOLS = utils/mtools$(EXE_EXT)

 SDCARDDRIVE = g

 

-CPPFLAGS = -O3 -I$(GCCBASE)\include -march=i686

-CPPFLAGS += -I$(GCCBASE)/include/SDL -D_GNU_SOURCE=1 -DGUI=1

-LFLAGS += -L$(GCCBASE)/lib -lmingw32 -lSDLmain -lSDL

+SDL_INCLUDE=/usr/include/SDL

 

+CPPFLAGS = -ggdb -O1 -I$(GCCBASE)/include -I$(SDL_INCLUDE) -march=x86-64

+CPPFLAGS += -I$(GCCBASE)/include/SDL -D_GNU_SOURCE=1 -DGUI=1 #-DUSE_SPI_DEBUG=1 

+LFLAGS += -L$(GCCBASE)/lib $(CLIBS) -lSDLmain -lSDL

+

 UZEMOBJECTS = uzem.o avr8.o uzerom.o

 

+all: release

+        

 $(UZEMOBJECTS): %.o: %.cpp %.h

 	g++ -c $< -o $@ $(CPPFLAGS) $(UZEMFLAGS)

     

@@ -25,8 +38,6 @@
 debug: clean-obj $(UZEMOBJECTS)

 	g++ $(UZEMOBJECTS) -o $(DEBUG_TARGET) $(LFLAGS) $(UZEMFLAGS)

     

-all: release

-        

 SDCardDemo:

 	make -C ../demos/SDCardDemo all

 	cp ../demos/SDCardDemo/SDCardDemo.hex .

@@ -38,4 +49,4 @@
 	-@rm $(UZEMOBJECTS) 

     

 clean: clean-obj

-	-@rm $(TARGET) $(DEBUG_TARGET) 
\ No newline at end of file
+	-@rm $(TARGET) $(DEBUG_TARGET) 


User avatar
Jhysaun
Posts: 214
Joined: Tue Nov 04, 2008 12:32 am

Re: Emulator Patch Submissions

Post by Jhysaun »

I've seen those before, but I never knew what to do with them.

It sounds like you patch works, so Im not sure if this will be of any help to you, but heres how I got the stable release to compile under linux:
viewtopic.php?f=9&t=383#p3195

Do you think you can explain how to apply this patch to the code. I googled "reading patches" which got me info about girls scouts and I tried "Code Patches" which gave me info about barcodes.

Thanks

>J
Lerc wrote:I intend to use my powerful skills of procrastination to ensure that when I get to making things, the chips will be available.
DavidEtherton
Posts: 252
Joined: Tue Dec 02, 2008 12:38 am
Location: Carlsbad, California (USA)

Re: Emulator Patch Submissions

Post by DavidEtherton »

You'd need to dig up a unix patch utility to apply it, or just stare at the line numbers and do it by hand. + in the left hand margin means add a line, - means delete.

-Dave
Post Reply