Adventures in vibe coding

For discussion and distribution of custom code and hacks
User avatar
NSFW
Posts: 802
Joined: Fri Feb 02, 2018 5:13 am

Adventures in vibe coding

Post by NSFW »

I wrote a simple patch for P59 OS 12587603 that should give a delayed fuel injection pulse at idle and cruise, to cut down on exhaust stink and smooth out cruising, and then switch to stock injection timing when MAF is above 50 grams per second, for better atomization (because at that air flow rate, the engine runs smoothly even with stock injection timing).

https://github.com/LegacyNsfw/12587603_ ... /patches.s

But then I needed a way to apply the patch to my .bin file, and the patching tool that I made ten years ago in my Subaru days is kind of awkard to use. So I decided to give "vibe coding" a try. It took a few iterations with GitHub Copilot / Claude Sonnet 4 to come up with a good way to annotate the source code and map file, but I think that what we came up with is about as simple as it can be. And then it took a few more iterations to fix some bugs - this vibe coding stuff works surprisingly well, but it doesn't work on the first try. But I think it works now. Maybe. I make no promises.

https://github.com/LegacyNsfw/12587603_ ... arePatcher

But I can't trust the patched file until I can step through the code. And I couldn't find an M68K / CPU32 emulator that makes me happy, sooo.... hey Claude, write me an emulator?

This is might be fantastic or it might be worthless, I still don't know yet:

https://github.com/LegacyNsfw/Cpu32Emulator/

This is by far the most ambitious thing I've tried with AI, so I'm taking notes as I go:

https://github.com/LegacyNsfw/Cpu32Emul ... journal.md
Please don't PM me with technical questions - start a thread instead, and send me a link to it. That way I can answer in public, and help other people who have the same question. Thanks!
User avatar
antus
Site Admin
Posts: 10013
Joined: Sat Feb 28, 2009 10:34 am
cars: TX Gemini 2L Twincam 8psi
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Subaru WRX 2007

Re: Adventures in vibe coding

Post by antus »

I guess this is the one you tried and didnt like but easy68k is how I wrote and debugged the crc32 asm code in the asm flash kernel. http://www.easy68k.com/
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
NSFW
Posts: 802
Joined: Fri Feb 02, 2018 5:13 am

Re: Adventures in vibe coding

Post by NSFW »

I do like it, but I want to be able to test tblu instructions.

Plus I've been looking for an excuse to play with vibe coding, and this seems like a good one. The really difficult stuff is all in the unicorn emulator DLL, I just need to create UI for it.

The good thing is that Claude wrote a ton of code. The bad thing is that it's not perfect and now I have to debug someone else's code. :)

But real problem right now is that VS Code's debugger won't let me set breakpoints, which is bizarre.

And the worse problem is that it's way past my bedtime. I have to try again tomorrow...
Please don't PM me with technical questions - start a thread instead, and send me a link to it. That way I can answer in public, and help other people who have the same question. Thanks!
rjdrew1986
Posts: 84
Joined: Wed Apr 12, 2023 8:52 pm

Re: Adventures in vibe coding

Post by rjdrew1986 »

This is both interesting and impressive...do you think it would be advantageous to apply some injection delay at the lower RPMs to all OEM engines?
8SecSleeper
Posts: 27
Joined: Sun Mar 12, 2017 5:57 am

Re: Adventures in vibe coding

Post by 8SecSleeper »

We suffer with the same problem, most of the time all available software is just short of what I need and I feel like I have to remake the whole thing from scratch to add little features. I can't seem to get away from this ideology. Haven't looked into vibe coding, is that Claude AI?
User avatar
NSFW
Posts: 802
Joined: Fri Feb 02, 2018 5:13 am

Re: Adventures in vibe coding

Post by NSFW »

"Vibe coding" basically just refers to asking AI to write all of the code - and then using AI to fix whatever doesn't work, because it won't all work on the first try. Basically you do it all through the AI chat window, rather than editing the code yourself. At least, that's the goal. It's not the miracle that it claims to be, but it's also not hopeless. It's been an interesting process.

As far as I know, the best tools for that are Claude Code (which just runs in a terminal, so you can use it with any IDE) or VS Code + GitHub Copilot + Claude Sonnet 4 (which I've been using) or Cursor IDE with Claude Opus (which I would use, but it costs more). I've heard the Windsurf IDE is also good, but I haven't tried that either.

Surprisingly (to me anyway) Visual Studio 2022 + GitHub Copilot + Claude Sonnet 4 is barely usable. I generally prefer VS 2022, but VS Code's Copilot integration is much better.

I just heard that Open AI just released something with GPT 5 that's supposed to be great, but I haven't tried it.

In testing the emulator project today I've fun into a few bugs that prevent it from initializing everything properly at startup, mostly due to order-of-operation bugs. Like trying to initialize the register view before it initializes the emulator itself, for example. It wrote a lot of code last night, but it also made a lot of surprisingly human-like mistakes. "Vibe coding" seems like it has a lot of potential, and feels amazingly productive at first... but getting all of the code written is just the first step. The next step is making it work. :) (That's probably going to be a lot of steps.)
Please don't PM me with technical questions - start a thread instead, and send me a link to it. That way I can answer in public, and help other people who have the same question. Thanks!
8SecSleeper
Posts: 27
Joined: Sun Mar 12, 2017 5:57 am

Re: Adventures in vibe coding

Post by 8SecSleeper »

NSFW wrote: Sun Jul 27, 2025 7:52 pm "Vibe coding" basically just refers to asking AI to write all of the code - and then using AI to fix whatever doesn't work, because it won't all work on the first try. Basically you do it all through the AI chat window, rather than editing the code yourself. At least, that's the goal. It's not the miracle that it claims to be, but it's also not hopeless. It's been an interesting process.

As far as I know, the best tools for that are Claude Code (which just runs in a terminal, so you can use it with any IDE) or VS Code + GitHub Copilot + Claude Sonnet 4 (which I've been using) or Cursor IDE with Claude Opus (which I would use, but it costs more). I've heard the Windsurf IDE is also good, but I haven't tried that either.

Surprisingly (to me anyway) Visual Studio 2022 + GitHub Copilot + Claude Sonnet 4 is barely usable. I generally prefer VS 2022, but VS Code's Copilot integration is much better.

I just heard that Open AI just released something with GPT 5 that's supposed to be great, but I haven't tried it.

In testing the emulator project today I've fun into a few bugs that prevent it from initializing everything properly at startup, mostly due to order-of-operation bugs. Like trying to initialize the register view before it initializes the emulator itself, for example. It wrote a lot of code last night, but it also made a lot of surprisingly human-like mistakes. "Vibe coding" seems like it has a lot of potential, and feels amazingly productive at first... but getting all of the code written is just the first step. The next step is making it work. :) (That's probably going to be a lot of steps.)
I've found ChatGPT can produce some great working code, then you try to ask it change little things and it breaks over and over and you basically have to take it from there. It's decent for getting a template together before you dive in. I guess I can try the Vibe coding process at some point, might wait for the next generation to come out based on how GPT4 is.
User avatar
NSFW
Posts: 802
Joined: Fri Feb 02, 2018 5:13 am

Re: Adventures in vibe coding

Post by NSFW »

That's kinda how it's working out with Copilot+Claude right now. It wrote a ton of code, but there are lots of mistakes and I'm just chipping away at them. Mostly silly mistakes like trying to initialize things in the wrong order (initialize the registers, then create the emulator engine...) but also some visual layout issues, and I'm pretty sure I'll be finding new issues for days.
Please don't PM me with technical questions - start a thread instead, and send me a link to it. That way I can answer in public, and help other people who have the same question. Thanks!
User avatar
Tazzi
Posts: 3626
Joined: Thu May 17, 2012 10:53 am
cars: VE SS Ute
Location: WA

Re: Adventures in vibe coding

Post by Tazzi »

I have found requesting too large of a request results in more bugs and issues.

Request AI to break down the project/app into much much smaller steps. Get it to create the class frameworks, and then process through each step 1 by 1.
If worded correctly, you can debug to ensure the new functionality is working before moving to the next step.
Your Local Aussie Reverse Engineer
Contact for Software/Hardware development and Reverse Engineering
Site:https://www.envyouscustoms.com
Mob:+61406 140 726
Image
User avatar
antus
Site Admin
Posts: 10013
Joined: Sat Feb 28, 2009 10:34 am
cars: TX Gemini 2L Twincam 8psi
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Subaru WRX 2007

Re: Adventures in vibe coding

Post by antus »

I had a bit of a look at the product. It looks like it uses the unicorn emulator under the hood, so its more of a GUI over the top of that? https://www.unicorn-engine.org/

And it seems to know the weather. :D https://github.com/LegacyNsfw/Cpu32Emul ... erCache.cs
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396