BatteryCheck PS1 - DevBlog - Smooth scrolling tilemap!

I do not have as much time to work on it as I would like but I have something cool to show! The PS1 has quite a slow CPU compared to the other consoles I have worked on which means it needs a few more optimizations. Rewriting this from scratch helps...and also that this is still in the "techdemo" stage. One of the main issues I am having now is that calculating and drawing the tilemap layers is taking more than 1 frame of time...meaning we have frame drops and slowdown when everything is shown!

By only drawing two of the three main level layers we stay below the time we have to draw a frame and scrolling is smooth as butter....just like it is on any other platform so far! :D



In this video the "techdemo" runs inside the pcsx-redux emulator and I am randomly choosing the direction to scroll to. There is acceleration and deceleration...although not exactly the same as in the existing ports. This was just "something that works". I need to completely rewrite and repack the way the tilemaps are stored to make it more efficient for the PS1 hardware. In this video the structure of how tilemaps are stored in memory is exactly the same as the other ports. In other words...it works but the PS1 is not fast enough to handle it all at once in this way. I did some testing with other methods and they are a lot faster....but as said require a lot of rewriting. hmmm...where did I hear that before?;)

I have attached a little surprise to this post...the actual PS1 executable. It can be loaded in an emulator or for the advanced people you can even upload it to a real PS1 over a serial cable. Because of how the PS1 works and it has no writable storage (that is sufficient to hold the game's assests) they are currently embedded in the EXE. So no external downloads this time...everything is contained in this one download. Then you can scroll arround just like in the video. Enjoy! :D

Comments

No concentration to try out right now.

I'm so exhausted by all the crap related to moving.
========

Would love to upload to real console, but I don't have a serial cable. Will have to wait until you have CD images.
 
No concentration to try out right now.

I'm so exhausted by all the crap related to moving.
========

Would love to upload to real console, but I don't have a serial cable. Will have to wait until you have CD images.
No problem, it's just there in case you are curious enough to launch it in an emulator some day. ;)

Whenever you feel you're up for it there is a way to use controller port 2 as a "serial port" too. I personally don't think the current version as shown in the video is worthy of even the cheapest CD. I do have the BIN,CUE files if you really want it though....they are generated as part of the build process. I've never tested if they actually work though since I was just playing around and trying to make things work.

Next time I'll be sure to include the BIN and CUE files just in case. ^_^
 
  • Like
Reactions: KleinesSinchen
I personally don't think the current version as shown in the video is worthy of even the cheapest CD.
Normally not. There is the usual "but" here: I have even a few mostly unusable CD-R. Scratched ones. A messed up printing. Things that are already for the garbage can right now. I could throw them away empty… or "waste" them for the PS1.

I would like to know if there is a way to bring either the newer models with automatic gain or – the contrary – adjusting the older models manually to read CD-RW.
The differences pit vs. land are much more significant on CD-ROM and CD-R

From a service manual for a PC drive:
Reflectivity (Rtop) CD-ROM 70%, CD-R 65%, CD-RW 15% ~ 25%
Probably hopeless.


Why not just use an emulator?
A) Real hardware is cooler → :creep:
B) Emulators aren't always 100% accurate. A homebrew game should pass the test of using real hardware
==========

If you could provide some link to a noob-friendly manual for uploading stuff with serial cable (sparing me the search) I'll surely try to look into this.
 
  • Like
Reactions: Archerite
Normally not. There is the usual "but" here: I have even a few mostly unusable CD-R. Scratched ones. A messed up printing. Things that are already for the garbage can right now. I could throw them away empty… or "waste" them for the PS1.
In that case you got a valid point. I have attached the CD image in an extra zip file. I only tested that in an emulator though. Please ignore the "template" name of the image....I have not changed the names yet in the makefiles. ;)
I would like to know if there is a way to bring either the newer models with automatic gain or – the contrary – adjusting the older models manually to read CD-RW.
The differences pit vs. land are much more significant on CD-ROM and CD-R

From a service manual for a PC drive:
Reflectivity (Rtop) CD-ROM 70%, CD-R 65%, CD-RW 15% ~ 25%
Probably hopeless.
I have no idea, I could ask for you in the psx.dev discord if you want. Pretty big lot of hardware people over there.
Why not just use an emulator?
A) Real hardware is cooler → :creep:
B) Emulators aren't always 100% accurate. A homebrew game should pass the test of using real hardware
I agree on both points! :D Except....that for testing and debugging I find emulators much better in my experience. I do 100% agree it should work correctly on real hardware! For that very reason I went through the trouble of making sure I got the required components to do that over the serial cable. And I have a "cheatcart" that is flashed with unirom for super quick boot times, and it has the "Serial boot loader" build in which is cool.
If you could provide some link to a noob-friendly manual for uploading stuff with serial cable (sparing me the search) I'll surely try to look into this.
If you mean a regular serial port cable on the phat model's than those are super easy. I just bought a cheap third party cable and cut it in half, measured the wires and pins on the connector and just hooked it up to a USB to serial converter. I am going to do basically the same for the PSOne but that one requires soldering to tiny pins near the CPU.

For the "controller port 2" method it was as simple as connecting the wires and a diode to the USb to serial converter. I am trying to find the information but can't see it anymore. I am pretty sure it was mentioned on the psx.dev discord somewhere. Once I find the information I will let you know.

As usual I got the crazy urge to make something myself...with a Raspberry Pi Pico (or compatible). There is already a USB serial firmware for it and it would be just drag and drop to program that. Then it's only three wires to connect to the console's serial port.

I do really wanted to test the Controller pad upload method though...as it's perfect for a PSOne without modding it! Really frustrating that I can't find the information, but I'll let you know.

EDIT: @KleinesSinchen : I have found the project for the controller port 2 interface cable. It's called joymon https://github.com/socram8888/joymon but as far as I see there is no real "tutorial" for it. I'll check it out and if I get it working write something up. It looks simple enough to make but might require "sacrificing" a controller.
 
Last edited:
Those executables are very small. And a re-write just for the ps1 would be a time sink!
I am using an EXE packer....original is about 530KB. And it's not complete yet....it's really just two splashscreens, the tileset and the level data. That is also most of where the 530kb is filled with.

And a time sink sure...but it's a rewrite for all of the code and a big cleanup I planned for years. Trying to do things 'better' than before this time. And later reintegrate it with all the others.
 
  • Like
Reactions: newo
Be careful of premature optimization. Even if you rewrite you might be restricting yourself in some way that you do not realize as yet or not until you stumble up on the limitation.
 
  • Like
Reactions: Archerite
Be careful of premature optimization. Even if you rewrite you might be restricting yourself in some way that you do not realize as yet or not until you stumble up on the limitation.
Good advise, thanks. The biggest thing to do different though is separating rendering from gamestate. So while drawing objects that's all that it should be doing. And not at the same time also check if a collectable object (like a battery) is picked up by the player.

Also the collision detection is hardcoded for this tileset! Limiting the 'reuse' of the game engine for things like a possible Jazz2 port. Or a SuperTux implementation... just to name a few.

Also loading a level from other formats is something I want to add into it. The plan is to think of some kind of 'in memory' representation that makes sense to me. Then create a 'loader interface' or something to load whatever format of level and tileset...then parse that into the internal format.

I am moving to C++ and want to copy multiple things from the existing code to the new PS1 code of course.
But I first want to get the basics working and see how far it goes. So far I am impressed with what is possible already. And the limited hardware of the PS1 makes it necessary to make optimized choices instead of 'it works this way too. kind of coding style.

And I think there will always be certain optimizations for each specific platform. But that's ok.

EDIT: Typing a reply on a phone without spellcheck is awesome late at night! Fixed the many mistakes. ^_^
 
Last edited:
  • Like
Reactions: newo
@KleinesSinchen I have tested the joymon project I linked above myself now. It works...but not without a few hoops!

I had to change the makefile to compile it. And I had to make the interface ofcourse. It needs a USB serial adapter (mostly any will do I think). You will also need a controller cable (extention cable or cut of an existing controller plug. They can be opened but the wires are super thin!! It's like three strands of hairthin copper that are the actual conductors in an official sony controller cable. Yes, I cut it because it was dirty and sticky and could not get it clean anymore. Also....I got 5 or 6 controllers anyway. And you need a diode 1N4148

If you got all that...and a soldering iron or breadboard....it's just three wires to connect.

The receiver binary has a few formats: EXE, (ROM, maybe), BIN+QUE, and it can create a FreePSXBoot MCD file to 'flash' a memory card with.

So quite a few options to lauch it. The actual EXE is super tiny, only 4KB!! It's written in MIPS assembly so really tightly packed!

I could provide the BIN and QUE if you want. It's artificially inflated to 20MB. I have run it through Unirom serial upload and then switch my USB cable over. It's running at 115200 baud. Not changable...since the guy who wrote this thought it was 'fast enough'. It being written in assembly makes it kind of hard to modify...but it is heavily and very well commented.

Sorry for the wall of text. But these are my findings so far. I have not tested it on a PSOne yet....for which it was originally made.

Overall it's a really cool extra option to upload code to the PSX.
 
Last edited:

Blog entry information

Author
Archerite
Views
366
Comments
9
Last update

Downloads

  • batterycheck-ps1-alpha-v0.02.exe.zip
    128.1 KB · Views: 27
  • batcheck-ps1-alpha-v0.02-cd.zip
    214.2 KB · Views: 26

More entries in Personal Blogs

More entries from Archerite

General chit-chat
Help Users
  • No one is chatting at the moment.
    Psionic Roshambo @ Psionic Roshambo: Taylor Swift death metal AI cover please lol