top of page
Search

[90] There and Back Again

  • Writer: Conlan Walker
    Conlan Walker
  • Aug 4, 2023
  • 2 min read

I am fed up with this, so I'm going back to SDL2. This realization only happened on Wednesday, so I made 2 things in between then and Monday.

One is some sort of primitive assembly preprocessor thing that hijacks the C preprocessor, and the other one is my own partially-broken Conway's Game of Life,

written in 6502 assembly.


I wrote the Game of Life clone to be used in skilldrick's easy6502 emulator thing:

ree

I say the program's partially-broken, as it's only the edges that aren't being updated properly.

ree

I spent a good 40 minutes rendering about 102 frames of this, but I only bothered to include 51 for this GIF (each frame takes about 17.5 seconds).

The reason it takes so long is because of a combination of slightly unoptimized code, and the fact that this emulator written in javascript is horrendously slow.

(I think at some point I measured the instructions per second to be no more than 8kHz or something.)



This is the actual 6502 source code:

And this is the preprocessor thing:



Now, for SDL2, I wanted to build it from source, so I could customize what subsystems, routines, et cetera are included. This is mainly to manage binary size.

Because I wanted to statically link it too, I had to go through a few more hoops, as the SDL wiki intentionally does not disclose how to compile the static version.

Here are the batch scripts I made that handle the build steps:

This one handles the CMake stuff:

This one handles the build stuff once the CMake stuff has finished:


I also reworked my copy_dat and countLines scripts:

copy_dat.bat:

countLines.py:


It might've taken 2 days, but I finally got it working exactly the way I wanted it to.

ree

I removed a lot of stuff, so here's a (probably incomplete) list of the stuff I removed:

  • Haptic subsystem

  • CPUInfo subsystem

  • Locale subsystem

  • Misc subsystem

  • Sensor subsystem

  • Filesystem subsystem

  • File subsystem (not to be confused with Filesystem)

  • Power subsystem

  • The HIDAPI subsystem

  • CD audio driver

  • Virtual-joystick driver

  • HIDAPI joystick driver

  • Raw input joystick driver

  • OpenGL support for embedded systems

  • OpenGL support

  • DirectSound support

  • DirectX 9 support

  • DirectInput support

  • Libudev support

  • 3DNow! assembly routines

  • AltiVec assembly routines

  • MMX assembly routines

  • SSE assembly routines

  • SSE2 assembly routines

Doing this shaves off about 20% of what SDL2's binary size would be otherwise, and it should do this without really affecting its functionality negatively.


To do a quick test to see if I set up SDL2 properly or not, I just made a small program that opens a window, before closing it after a second has passed:

Which seems to work just fine.

ree

My original goal was to keep the release's binary size under a few megabytes total, whose requirements seem to have been met.

ree

Next week, I'll probably re-implement my audio mixer.

 
 
 

Comments


bottom of page