PCEngineFans.com - The PC Engine and TurboGrafx-16 Community Forum
Tech and Homebrew => Turbo/PCE Game/Tool Development => Topic started by: ccovell on August 30, 2015, 04:18:59 AM
Title: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on August 30, 2015, 04:18:59 AM
Hi, folks. I had a bit of fun developing a serial monitor that I call PCEmon. This is a tool for hackers/developers, but it also has some useful features for non-technical people as well. Some features: [ul][li]Back up BRAM (save-files) to your PC, edit them, save them back to the PC-Engine (finally!)[/li][li]Upload your own code to RAM and run it. Upload larger files to CD-RAM and run them.[/li][li]Freeze a game in progress and view its screen data or RAM.[/li][li]Resume a frozen game as-is, or resume from an uploaded savestate.[/li][li]Search for and Activate RAM-freezing trainers for cheating in games.[/li][li]Upload image data to VRAM for viewing on the actual hardware.[/li][li]Hex dump or Binary dump any part of the PCE's address space.[/li][li]Upload data to any part of the PCE's address space.[/li][li]PCEmon can run as a stand-alone ROM or be embedded in games (eg: CD System Card.)[/li][/ul] More information is here: http://www.chrismcovell.com/PCEmon/
Updated version 10/25/2015
And now, some pics! (http://www.chrismcovell.com/PCEmon/screenshot.gif) (http://www.chrismcovell.com/PCEmon/pcemon2.jpg) (http://www.chrismcovell.com/PCEmon/pcemon4.jpg)
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: dshadoff on August 30, 2015, 05:08:07 AM
Wow ! Cool stuff Chris ! This is exactly the kind of stuff I was using to debug my machine language stuff in the 80's.
A couple of questions:
1) Did you build a converter for your RS-232 ? Or, "how does one know whether their RS-232 is 12V or not ?" This was originally one of the things that the Develo Box did - provide a compliant conversion layer. Is it perhaps mainly the difference between 9-pin and 25-pin variants ?
2) What's the default baud rate for the session startup ? I see that it's configurable, but the old-fashioned standard rate of 9600 baud sounds a bit high to be stable for long transfers.
-Dave
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: Gredler on August 30, 2015, 06:18:26 AM
This looks awesome, thanks so much for sharing this!
Title: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: esteban on August 30, 2015, 06:43:13 AM
You had me at "back up BRAM to PC"...
(http://junk.tg-16.com/images/love_1.gif)
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: elmer on August 30, 2015, 08:20:08 AM
Very cool stuff! :D
I'm a bit concerned with the advice about being careful to not hook up you PC Engine to a PC that uses 12V serial ports.
RS232 is basically a 12V standard ... AFAIK nearly all PC serial ports will be 12V!
I seem to remember that some manufacturers did run them at 5V (right at the edge of the specification), but I don't remember it being all that many.
It might be a good idea to recommend that people use a nice, cheap FTDI USB-to-5V-serial adapter to help avoid people frying their PC Engines.
Here a decent one ... https://www.sparkfun.com/products/9718
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: Punch on August 30, 2015, 09:04:53 AM
My hero.
now to learn how to use it in projects to debug stuff.
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: TailChao on August 30, 2015, 09:12:59 AM
Very nice work, however I would really recommend using a MAX232 or similar level shifter so you don't have to worry about the RS232 connection being one of the out-of-spec 5V ones, and to protect the PCE.
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on August 30, 2015, 12:02:17 PM
1) Did you build a converter for your RS-232 ? Or, "how does one know whether their RS-232 is 12V or not ?" This was originally one of the things that the Develo Box did - provide a compliant conversion layer. Is it perhaps mainly the difference between 9-pin and 25-pin variants ?
2) What's the default baud rate for the session startup ? I see that it's configurable, but the old-fashioned standard rate of 9600 baud sounds a bit high to be stable for long transfers.
Yes, the official RS-232 spec is dangerously high for the PCE, so users will have to either test their port's output with a multimeter (oscilloscope would be better), use a USB-to-5V-serial adaptor, build in a MAX232, or grit their teeth and ride the voltage rails like a cowboy. ;-D
I've included 3 assembled versions with different baud rates at startup. 9600 is the slowest speed, in fact the PCE's CPU is so fast, 115200 bps or higher can be achieved but that's a little bit of overkill. I've dumped 128K of ROM at 57600 just fine, but I've noticed that VRAM uploading at that speed produces a few errors, so that's the timing limit for banging bytes to the VDC reliably.
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on August 30, 2015, 02:22:40 PM
Well, it's almost that easy, but that is an FTDI TTL interface... so instead of 2, 3, 5 on the 9-pin D-SUB, it looks like 5, 4, 1 on that 6-pin Molex connector, according to the PDF on that page. Be sure to locate the correct pins by colour or numbering!
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: Arkhan on September 01, 2015, 08:58:28 PM
lol, will this work with my MSX.
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on September 02, 2015, 04:26:59 AM
OK, I've updated my page with a test version of PCEmon that should/may run for people who buy FTDI TTL cables. Someone with such a cable please let me know if PCEmon works for you. The TTL version is under "TTL_TEST" in the archive.
As a matter of fact, yes, it should. One of the computers supported by the original Develo hardware/software was actually the MSX.
Yeah, I know. I set the MSX + Develo stuff up here a few times to dick around. This might be a funny thing to try at some point. My HX-34 has RS-232 on it, because it's awesome.
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on September 02, 2015, 01:14:49 PM
No, it has RS-232 as standard because it's old. ;-D
I meant that because not all MSX have the RS-232 on it lol.
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on September 05, 2015, 03:45:50 PM
Another update of PCEmon -- RS-232 and TTL versions are in the archive for all baud rates and syscard/CD versions, etc. If anybody actually has used PCEmon by now, let me know!
I've added one feature - helpers - that let you upload or add (in the ROM) larger external commands.
The one helper I made so far is a .PCX saver -- it saves the current screen BAT in VRAM over the serial port as a .PCX file -- a pixel-perfect screendump.
The dimensions of the PCX file will depend on the BAT size setting in VDC register 9. use commands v9 00, v9 10,... v9 70 to adjust the BAT to the correct size. Usage for the helper command can be seen in the instructions on my page (# <-- helper command).
http://www.chrismcovell.com/PCEmon/
http://www.chrismcovell.com/PCEmon/PCEmon.zip
examples of the PCX dump: (http://www.chrismcovell.com/PCEmon/screengrabs/pcx-grad2.gif) (http://www.chrismcovell.com/PCEmon/screengrabs/pcx-redalert.gif) (http://www.chrismcovell.com/PCEmon/screengrabs/pcx-ys.gif) (http://www.chrismcovell.com/PCEmon/screengrabs/pcx-monlair.gif) -- (http://www.chrismcovell.com/PCEmon/screengrabs/valis2-boss.gif) (http://www.chrismcovell.com/PCEmon/screengrabs/valis2-cin1.gif) (http://www.chrismcovell.com/PCEmon/screengrabs/valis3-cin1.gif) (http://www.chrismcovell.com/PCEmon/screengrabs/ys-adol.gif)
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: esteban on September 05, 2015, 04:01:35 PM
That's awesome. I know that a person could stitch separate screens together, but these images are gorgeous.
Request to folks: We need examples from VALIS II :(
Thank you! :)
GUY KAZAMA = badass
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: shubibiman on September 05, 2015, 09:01:52 PM
Gorgeous !
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: esteban on September 06, 2015, 12:07:22 AM
UTTERLY
MAGNIFICENT
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: elmer on September 06, 2015, 04:02:07 PM
Way cool! :D
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on September 08, 2015, 04:17:21 AM
The disassembler gets loaded into $4000- so unfortunately game code mapped in there can't be disassembled (unless you remap it to a higher MPR).
http://www.chrismcovell.com/PCEmon/PCEmon.zip
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: Bonknuts on September 09, 2015, 04:40:22 AM
So how does this work for CD games? Do you hook an interrupt vector to monitor the game pad port? If you're stalling/pausing the game for disassembly, you could always map a code bank into page $0000 (no commercial games put code banks there) to read from page $4000.
The turbo express uses the gamepad port both for serial communication as well as gamepad controls simultaneously. It first looks to see if there is a single on the port, much-much faster than the gamepad and if detected it reads/writes to it - else just read the data as gamepad input. I don't remember all the details, but it looked like it was replicable on the base systems. Anyway, this is awesome Chris!
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on September 09, 2015, 02:53:55 PM
OK, here's a quick release (19200 baud at start) that allows you to upload a helper command (PCX save, Disassembler) into the PCE's RAM buffer ($2200-) through the "U" command (simple.)
So now PCEmon searches the buffer, ROM, and CD-RAM for a helper signature and reports where it is.
Bonknuts: As for CD games, check out the readme inside of the SysCard folder. Most CD games keep Syscard bank 0 into MPR7 as a BIOS, including reading the joypads. I just patch the RUN+Select reset code to look for one or both button presses, which then jumps to PCEmon hidden in Bank $15.
As for now, PCEmon can't resume a CD game. The ROM version also traps IRQ/BRK and restarts in case the user jumps to bad code.
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: NightWolve on September 15, 2015, 03:31:46 PM
Wow, amazing work as usual, Chris! That you say it took you only "a week" from some vacation time is also amazing... :/ Pretty sure it wouldn't take me a week to do something like that, if ever...
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: Punch on September 15, 2015, 05:24:55 PM
Damn the only thing between me and PCEMon on my duo is finding a Mini DIN cable to do the adapter. Wish I didn't have to order it over the internet, I'll probably pay more for shipping than the cable/plug itself.
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: elmer on September 15, 2015, 05:42:58 PM
Damn the only thing between me and PCEMon on my duo is finding a Mini DIN cable to do the adapter. Wish I didn't have to order it over the internet, I'll probably pay more for shipping than the cable/plug itself.
Damn the only thing between me and PCEMon on my duo is finding a Mini DIN cable to do the adapter. Wish I didn't have to order it over the internet, I'll probably pay more for shipping than the cable/plug itself.
You can always test it this way first: (http://www.chrismcovell.com/PCEmon/connect1.jpg)
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on September 21, 2015, 03:10:35 AM
I've put up an updated version 1.25.3 of PCEmon. at: http://www.chrismcovell.com/PCEmon/
What's new is that the .PCX helper now dumps the whole of VRAM, either as BG tiles or Sprite tiles:
As you can see, there are a few options for tilemap width, sprite arrangement, and palette selection. Check out the command list / instructions page for a full description of the helpers.
Have fun!
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on September 28, 2015, 02:23:02 PM
Working on a new feature. Here's a short video:
https://youtu.be/GNWXFYOBFFw
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: Gredler on September 28, 2015, 02:54:46 PM
:clap:
Another rad update, incredible
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: NightWolve on September 28, 2015, 03:09:56 PM
(https://postimg.cc/image/hcv2p24df/)
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: Punch on September 28, 2015, 03:54:27 PM
(http://www.ysutopia.net/images/TheJoker.gif)
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: NightWolve on September 28, 2015, 05:18:20 PM
Cool how everybody applauds/praises in their own unique way. :)
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on September 28, 2015, 05:25:23 PM
<Jimmy_Swaggart_Mode>
The holiest way to give praise is to give generously, my friends.
Our Paypal link is below.
</Jimmy_Swaggart_Mode>
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ParanoiaDragon on September 28, 2015, 06:24:41 PM
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ParanoiaDragon on September 30, 2015, 07:21:29 PM
Yikes Steve, it wasn't THAT funny, but, whatever floats yer' boat! :D
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on October 06, 2015, 06:00:47 PM
Another video is up... I'll have version 1.27 up soon.
https://www.youtube.com/watch?v=UQWTwh-eXm8
In this one I show ADPCM stuff, savestates, and a cheat/Trainer.
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: Bonknuts on October 07, 2015, 05:12:58 AM
This just keeps getting better and better! I need to make an analog switch and a cable, so I wouldn't have to swap in/out the gamepad.
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on October 07, 2015, 02:22:44 PM
OK, the new version of PCEmon (1.27.2) is up on my page. New commands:
!L / !M / !H : change the horizontal screen resolution !< / !> : copy CDRAM <-> ADPCM RAM !P n : Play ADPCM sample T [0/1/2 aaaa dd] : set a Trainer that freezes a RAM address to a value (in-game cheating!) G [L/S] : load savestate / save savestate / go to savestate. (It's a save state function.) Also, "G R" tries to save RAM in raw format at the moment the game was frozen (this is for comparing successive RAM saves to search for cheats.)
http://www.chrismcovell.com/PCEmon/index.html direct link: http://www.chrismcovell.com/PCEmon/PCEmon.zip
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on October 25, 2015, 03:17:23 AM
Okay! A new version of PCEmon is on my page: http://www.chrismcovell.com/PCEmon/index.html
This adds a more elaborate hack to the CD System Card that allows you to activate cheats without needing to use a serial port adaptor or running PCEmon. Press Select from the CD System Card screen:
Also, another new helper function allows you to search for RAM cheats Action Replay-style from within PCEmon. Now no ISO-ripping or PC-based emulator is needed just to search for cheats! (Well, that makes it quicker for me, anyway.)
+---------------------------------------------------------+ | RAM Cheat Search Tool -- Step 2 -- Press a key: | | X - exit to PCEmon | | U - upload RAM image | | R - restart search | | | | -- Comparison Options -- | | V - equal to numerical value | | E - equal to previous | | N - not equal to previous | | L - less than previous | | G - greater than previous | | | | S - show search results | +---------------------------------------------------------+
L 78 matches found.
U Okay, send your binary! ...(3rd 8K binary uploaded)
L 15 matches found.
S
2045: A4 94 8C 205C: 3F 1F 0F 205E: 3F 1F 0F 2086: FD F7 F1 ... 3B90: AC A5 73 -- end -- PRESS A KEY --
(And $205C:3F happens to be the code for infinite energy in Spriggan 2. :-) http://www.chrismcovell.com/PCEmon/PCEmon_Commands.html#hlprsrch
Title: Re: PCEmon - an RS-232 monitor / debugger on the PCE
Post by: ccovell on June 13, 2016, 02:56:16 PM
Since I played through NEXZR last night (not so hard, once you get past levels 3 & 4...) I'll post some real hardware savestates (uploadable through PCEMon in a hacked system card) for the penultimate boss and ending.