Hacker News new | past | comments | ask | show | jobs | submit login
NES 64 – Commodore 64 Kernal and Basic ROMs Ported to the NES (nesdev.org)
156 points by muterad_murilax on Feb 15, 2022 | hide | past | favorite | 41 comments



I was just thinking that what the NES really needs is the world's slowest disk drive.


I'll defrag that for the younger audience - the commodore 64 had a slow external disc drive and best explained "The 1541 was very slow in loading programs because of a poorly implemented serial bus, a legacy of the Commodore VIC-20" https://en.wikipedia.org/wiki/Commodore_64_peripherals#Flopp...


There's some nice background here: https://www.lemon64.com/forum/viewtopic.php?t=52439

The Ultimate 1541 talk is also great: https://www.youtube.com/watch?v=_1jXExwse08

The 1541 maintained compatibility with the VIC. The VIC had very slow firmware routines to communicate with its 1540 disk drive because a shift register in the 6522 VIA chip didn't work properly.

The C64 had an improved VIA with a working shift register. The 1541 attached to a C64 was going to be much faster than the 1540 and the VIC. A board rework in the 1541, however, removed a trace needed for the high-speed operation, so the 1541 and a C64 ended up being no faster than a 1540 and a VIC (and actually slower because the VIC-II in the C64 needed to take control of the bus periodically introducing jitter in the communications).


Also worth checking out: http://www.quiss.org/freespin/

This is a demo running entirely on the 1541 using a hacked together connector from the drive's serial out to a monitor. Audio is generated using the stepper motor.


wow, now that is some serious hacking and mind-blowing. Probably one of the best abuses of hardware I've seen for a while.


o_O

What's amazing is that it's actually a neat demo with cool music. And the only additional hardware it uses is ONE RESISTOR.


I've been trying to find a reference to the board rework removing the high speed serial capability. I heard about it originally in a video or podcast and I'm going to do some digging to find that. To correct the record, though, the board rework story references the C64 motherboard and not the 1541 board.


I'll defrag that for the younger audience

Does the younger audience even know what "defrag" is?

I don't think I've defragged a drive since the days when you could magically make more RAM and storage appear by running Stacker.


If you think Stacker was cool, check out the details of the compression algo that underlied SoftRAM95 ;) https://devblogs.microsoft.com/oldnewthing/20211111-00/?p=10...


The 1541 was slow also because of the firmware. There was this kit that I bought sometime in the 80s which, if memory serves, consisted of EPROMs and a small board to be swapped into the C64 and the disk drive in place of their original firmware, then a parallel cable to connect the drive to the C64 via the user port. The firmware also added a much more advanced BASIC interpreter and some utilities. Curiously, by using the parallel cable disk operations became dramatically faster than with the original DIN connector as expected, but if I removed the parallel cable say because I needed the user port, it continued to work, clearly not at the same speed, but still a lot faster than when using the original ROM, so there probably was some room for optimization in the original firmware too. Unfortunately I can't remember the name of that kit, it was one of the many "turbo" this or that on the market at that time, and by today standards looked definitely homemade.


There was a cartridge you could buy and shove in the back that made everything load about 5x. I wish I could remember the name of it.

--edit-- ah here it is https://en.wikipedia.org/wiki/Epyx_Fast_Load


I recently bought a C64 and was recommended this modern replacement, it works with the vast majority of games https://www.thefuturewas8bit.com/shop/commodore/eflr.html


Even using the stock serial cable you can make the disk drive much faster (up to 19kB/sec) with software: https://www.c64-wiki.com/wiki/Transwarp


Some of the modern clones of the C64 use JIffyDOS built into the Kernel for faster loading from 1541 drives. The 1541 drive has a 6502 CPU and built in DOS (Commodore DOS not MS-DOS) firmware. It is like getting a whole different computer in the floppy drive which is why it was so expensive.


Yet it was so much faster than the cassette drive!


And both of them are really fast nowadays with the recent fastloaders.

Some 10 kbit/s for tape with https://csdb.dk/release/?id=212586 and either https://csdb.dk/release/?id=189130 or http://www.linusakesson.net/software/spindle/v3.php for 1541 giving you some 6-8 kbyte/s all without extra hardware, just better code.

Crazy but true.


Here’s also an amazingly detailed writeup of one such optimization attempt, GCR on-the-fly decoding:

https://www.linusakesson.net/programming/gcr-decoding/index....


That and one button joystick!

But fortunately for us RR-Net and Nunchuk64 solves both problems.

I load Super Mario Bros. 64 in 1 second over ethernet with codenet from my PC and then I play it with NES Mini I2C controller on C64!


I can't find any stats on the Famicom Disk System, but it was probably not a beast.


Believe me, it was very hard to make a slower disk system than the C64 had with the 1541 even back then, and even compared to older hardware. Others in the thread already elaborated why it came to that: A sequence of accidents led to the bus being bitbanged in a terrible way.


Where does this spelling "kernal" come from, originally, and why is it so persistent?

(Serious question, not a complaint.)



Today I learned:

"the KERNAL implemented a device-independent I/O API not entirely dissimilar from that of Unix or Plan-9, which nobody actually exploited, as far as is publicly known. Whereas one could reasonably argue that 'everything is a file' in these latter systems, others could easily claim that 'everything is a GPIB-device' in the former."


The TI-99/4A had a similar feature in its firmware. Cartridges could install drivers for devices that appeared to BASIC as file names. For example, if you plug in the Terminal Emulator II cartridge (which had a screen reader feature using the TI Speech Synthesizer add-on) and go to BASIC, you could say OPEN #1:"SPEECH",OUTPUT and get a file handle. Writing to the file handle would cause the computer to speak the text that was written. There was another device, ALPHON, that would cause the computer to speak coded allophones.


So it was a typo they never fixed?


Commodore themselves called the OS “kernal” in the manual.


You shouldn't be able to trademark the word "kernel", but if you misspell it, you can.


Why have I never thought of trying to get AppleSoft running on the NES? I have no imagination.


I love this, but it's kinda the wrong direction as C64 BASIC had no instructions for gfx and sound.. it was all through pokes. I liked using Simon's Basic to get GFX on my C64 back in the day, but until I had it, I highly envied the Apple 2 and Atari BASIC commands!


This is basically why there are all these Commodore firmware ports - because the kernal doesn't provide all that much and the BASIC has no substantial hardware dependencies.


That's a great point, BASIC 2.0 has very few useful commands for graphics and sound, but these could be added, tailored to the particular platform of a given port. Add a means of "compiling", or exporting, and you get a nice tool for creating NES games easily.


it would be a coooool idea to make an in-line basic compiler... I've stepped through the parsing of BASIC and it takes soooooooo long. e.g. just finding the instruction for say, MID$ takes zillions of cycles. But the actual command is quite simple. So just keeping track of the parsing would make it sooo much better. There are lots of other things to do as well.... but overall I think TRSI has an even better appraoch... you ahve to write Pascal, but you can target C64 hardware quite effiently!


As a Franklin Ace 1000 owner (Apple Clone) I can say that there were no commands for sounds and the graphics were rudimentary, draw a point or draw a line or draw a pretty slow vector shape.


IIUC that's because Franklin cloned the hardware successfully, but couldn't clone the BASIC. But I think you could still run Apple's BASIC from a disk. Do you still have it?


The Famicom's Family Basic (wiki linked in another thread) had sprites and stuff, though I think you were limited to the ones built in.


Wow I had no idea there was a keyboard and BASIC ROM for the Famicom: https://en.wikipedia.org/wiki/Family_BASIC It's a shame this never got released for the NES in the USA. I would have had a lot more fun with this instead of the silly Rob robot.


You could even save programs to a cassette tape. It's also why Excitebike has a save and load track function that seems to do nothing.


What fun. I was an Atari guy but I could get into something like the Apple II firmware running on something from the era with more interesting graphics and sound hardware.


The Apple II basic felt quite fast when compared to other systems of the time. I'd be pretty cool to have it on the Atari's, with their 2 MHz CPU.


Very impressive. Should be relatively simple to port it to the SNES.


Thanks! I’ve never worked on SNES ROMs before, but its CPU is backwards compatible, and graphics are probably similar enough. The main problem is that there was never a keyboard for the SNES. You’d need to implement an on-screen keyboard operated by the controllers or SNES mouse.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: