Latest version of ZXSimulator. A few small but helpful changes:
- Changed file reading to be a bit more efficient. It now determines size of file, allocates that memory, and reads it in
- This has sped up file loading a lot
- Before I was constantly resizing my internal store and copying from small to large which was mucking up the heap
- Now I can load larger BASIC files with less memory (i.e. BBQL can load 13K Battleship_bas)
- Need to figure out a better way to determine file size -- right now I read it twice (whats a good way to get file size via TRAPS?)
- PAUSE now can be aborted. I basically pause for 5 milliseconds and check for key presses (should likely eat those presses as well but am not)
- Listing was broken for rare case of double-wrap where the 3rd line left a single character
- Display wasn't quite centered -- fixed
- String concatenation and equality now works properly and won't muck up in lengthy expressions with mixed types
Here is the zip:
You will see that the source file has been zipped as the distribution has gotten a bit too big to fit into 128KB of MDV storage. So you have a zip file inside of a zip file :-/ You'll have to unzip src_zip if you wanna take a look of the C code for the simulator.
Note that I added a 4th program, my Battleship_bas game that I wrote as a teenager in the early 80's on my ZX81. I reclaimed it and left it mostly as is. I had to type it in since I was only able to load the tape onto a TS1000 and then took screen shots. I think I fixed all the typos. I changed a few lines where I was doing this:
Code: Select all
100 IF INKEY$="A" THEN GOTO 1000
110 IF INKEY$="B" THEN GOTO 2000
120 GOTO 100
To the code below as it works better with how INKEY$ is implemented via a QL TRAP.
Code: Select all
100 LET K$=INKEY$
105 IF K$="A" THEN GOTO 1000
110 IF K$="B" THEN GOTO 2000
120 GOTO 100
So without this you can be pressing a key and it just doesn't always registers it, especially on a fast machine (QLAY2 for me). So assigning the INKEY$ to the K$ variable seems to capture more key presses. I did the same thing in the Ball_bas program previously. Note that INKEY$ isn't all that great on a ZX81/TS1000 either.
I may change the Battleship_bas program like I did with the minesweeper game and tie both setting ships and picking spots to joystick port 1 so you don't have to use the keyboard. Still, I designed it this way (I think -- been almost 40 years) because that's how battleship works, giving coordinates. I must have decided that being able to have a moving/blinking cursor was also cool since setup is done that way.
BTW, there is a bug during setup that when you cross an already placed ship, the cursor will overwrite it. Oh, and if you try to set a ship off the board nothing happens...sometimes that can be confusing -- I should have added an error message.