MEGA65 FORUM

Work is underway to make open-source replacement ROMs for the C64

append delete gardners

Howdy Folks,

Just a quick note to say that we have begun implementing an open-source reimplementation of C64-compatible ROMs, so that we can include them in the MEGA65 without legal complications:

https://c65gs.blogspot.com/2019/05/free-and-open-source-replacement-roms.html

Paul.

Reply RSS

Replies

append delete #1. Gunstarrhero

is there any way for you to implement the roms even on a stock 64 without using that 32k?
such as writing the roms on a rom and paging(bridging) them properly on its own mapped memory space so the 64k is free? im sure you understand that some type of flag or control must be made in that mem space back out to the system and vice versa.

perhaps some new features such as a cp/m dir command or so, or a whole load of dos commands and directory listing structures. maybe the option of directory structures for the c64.

thanks

append delete #2. gardners

What do you mean without that 32KB? The ROMs we are writing already do what you are asking: They run in a stock C64, i.e, fit in place of the original KERNAL and BASIC, and do proper banking so that almost all the 64KB RAM is usable -- only 2KB at each end is reserved for the screen and other miscellaneous bits and pieces.

As for adding at least a directory command, that will be a matter of how much we cansquish things in. But being open-source, it will be super-easy for people to, for example, ditch some of the trigonometric functions in BASIC in return for a more useful set of extensions.

append delete #3. Freddy Champagne

Commodore uses 'intelligent' drives. Commodore disk devices are in reality own standalone computer, with own cpu, own memory and own OS.
The DOS is not in the computer, it is in the drives.
The computer only has a command-channel to the drives.

append delete #4. Gunstarrhero

i meant holding the ram usage to the rom chip it self not subtracting from the main board ram :)

append delete #5. gardners

I'm not sure I know what you mean. All 64KB RAM remains free with our ROMs, because they are ROMs, not a program sitting in RAM. Is that what you meant?

append delete #6. Gunstarrhero

yes and i was also talking about the c64

#7. d3bug

This post was deleted by its owner

append delete #8. d3bug

Gunstarrhero: You might want to take a look at "Mapping the 64" to see how the memory map works on the C64. Location $0001 in zero page controls if KERNEL and BASIC is switched on/off (directly readable) or the underlying RAM is exposed. It will have to remain that way in the MEGA 65 if it is to remain compatible with the C64.

append delete #9. Gunstarrhero

you misunderstood, i think everyone did.

what i was saying was add a small amount of rma space to the rom chips so the roms only occupy those chips on. so when the computer boots it reads 64(whatever)basic bytes free instead of 38911 basic bytes free. on the c64.
what i was saying was build a bride in the ram space for the actual control to the mother board and back to the chip. this bridge would have to address the kernal etc the same way the c64 would. rom->(this is where the bridge in programming picks up either way from instruction to instruction)(this is also where the the rom would load itself instead of the c64's mainboard ram)(the ram on the motherboard would still be used the same, now when the c64 instructs back from mobo ram or cycle or instruction from the cpu, it goes through this ram space to the rom, leaving all the ram on the mobo open to the user; the only thing different now is that the programmer would reference/instruct/call this particular "address" bridge instruction instead of just going back to the rom. or, the bridge could work so that the user makes their calls the same and the instruction picks up on the call and just reroutes)(it would be much more effective, now we can use the whole computer without having to disable other sections to free up memory, we could even if allotted, utilize that mem space for even more or larger programs or occupations of ram) ram space on chip -> c64 ; c64 ->ram space -> rom

append delete #10. gardners

I'm not sure I follow you, but our ROMs already leave 64(something) bytes free, because they do bank switching properly, unlike the original ROMs. We leave 60KB of the 64KB free, without having to do any strange things to the ROM chips or motherboard.

Paul.

append delete #11. LGB

Commodore 64 by design is able to use the full 64K of RAM, via bank switching, programmer can switch ROMs and I/O space on/off, etc. It was always the case. It's another question that the stock Commodore ROM BASIC as a software does not utilized this otherwise always available hardware feature (AFAIK C64 ROM BASIC is about the same as VIC20's so not so much plus features put in, C64 would provide over VIC20 ... maybe that's the explanation). But it's matter of software, the hardware was capable to do it, on a real C64 as well, surly on Mega65 as well with being C64 compatible. In fact, for example Commodore Plus4 BASIC ROM already used bank switching (though the exact details on the hardware is not the same, but the theory is similar). It's again another question, that C+4 BASIC said to be kinda slow because doing very rapid bank switching at each token/etc fetch. Or so, I can't remember exactly, but anyway it's not the point here either to deal with the C+4 :)

append delete #12. rosettif

It would be a nice add-on to have a kind of autobooting ability for the C64 Kernal, e.g. by searching for an AUTOBOOT.C64 file at startup on device 8 (similarly to the C65 searching for an AUTOBOOT.C65 file in native mode). Also to have some built-in support for the SD2IEC.

append delete #13. gardners

We'll see what we can fit. In the least, it should be possible to make SHIFT+RUN/STOP do LOAD"*",8:RUN or so, similar to what C64 mode on the C65 can do. This lets you have autoboot, but under user control.

Paul.

append delete #14. MIRKOSOFT

Paul here I'm surprised.
You were owner of C65 and work on your M65... both have C64 mode.
We know that C64 mode has not the same Basic version like C64.
We can name it anything like Basic 2.2...

When you press SHIFT + RUN/STOP it forces load first file on disk in disk drive, by:
LOAD"0:*
and when want load program from disk, you need write only:
LOAD"*
and hit Return, it loads first program on disk, of course asterisk can be exchanged to wished name.
It never needs and never in past LOAD"*",8
Why? You know - C65 is missing cassette port and tape support was from Basic removed...
Of course, this is easy to write when I never owned real C65 and used only M65 core or emulator (but each emulator does the same - Xemu, MESS).
Other thing is booting.
I think if is possible to create any modifications to Basic in open-source way better is use command BOOT which is available since Basic 7 in C128 (first appears in Basic 3.6 in Commodore LCD, but it returned only ?UNIMPLEMENTED COMMAND).
It needs not any file or anything other than correctly written boot sector.
Other side is BOOT command in C65 Basic 10 - it was changed and it always searches for
AUTOBOOT.C65*
In my eyes it is ugly to have any program on disk which needs correct and exact name included in my own programs. This was in my eyes mistake by Commodore 65 designers.
But it is personal feeling, so this is not important.

Miro

append delete #15. gardners

I listed the ,8 to avoid confusion for people who may not be familiar with this feature of the C65, especially since we are talking specifically about the C64.

Adding a BOOT command means expanding the token list and tokeniser, and skipping many tokens in the middle. The result will be quite a lot bigger code. Also "BOOT" takes more key presses than just SHIFT+RUN/STOP.

I think if you can't correctly name a file, then this is not a problem with the design of the system. There are so many other things that using a computer required you to have correctly spelled file names.

At the end of the day this is all syntactic sugar: what is important is that it is in some way easy enough to boot from a disk. To me SHIFT+RUN/STOP is the simplest and most efficient way to implement this in a 16KB C64 ROM set.

Paul.

append delete #16. rosettif

The one-character wedge commands are also very useful: @, %, / etc. (@$ for the directory) and they do not need a token. Many people are already used to them.

Although it is offtopic here, but later when dealing with the C65 ROM's one day, it would be nice to "fix" the v10 Basic ROM on some points where the designers unfortunately broke the backwards compatibility with v7 (and actually with v3.5/v3.6 as well as the v7 is backwards compatible to them, too), for example:

- gfx commands (particularly GRAPHIC for mode change or COLOR with the appropriate colour codes are different here)
- dma commands (on C128 there are STASH, FETCH and SWAP dealing with the REU, the same ones could be reimplemented here but dealing with the DMAgic)
- BANK (to modify if BANK15 is given, that also to mean BANK128 here)

And so on.

This would make it possible to write some basic software on the C128 by only using the common command set (or even on Plus/4 with more restrictions) and be able to also run it on the C65/MEGA65 without any further modifications. (Or even to use some existing software of that kind.)

append delete #17. MIRKOSOFT

Agree Paul, new token costs amount of code... So my Q is bit stupid...
Has C64 Basic all commands implemented? Example is easy to modify Basic 7 without code amount - using unimplemented commands incl. renaming them, most known are Quit and Off.
But really if are all available commands in Basic 2 implemented, it needs bigger mod. But why look not what a code can be written more effective with less code amount. But problem is in token numbers range and if is any free.

Basic 10 backward compatibility:
Sure - true words!
When we look to Basic 3.5 and 7.0 - no problem with some small fixes.
Even 3.6 is almost identical with 7.0 - some changes done.
Even Basic 7.80 - extension of 7.0 to graphics for VDC (from there is name 80), has no one token added. Only graphic commands parameters were extended. 100% backward compatible, only Basic memory free is bit smaller - but not so big difference, so it is near impossible to find problem.
And this is there where Basic 10 discontinued backward compatibility. In time I was experimenting with C65 graphics and I was near lost - near no documentation and total new commands or commands used in previous Basic versions with new syntax, but reason is totally wrong - these commands have nothing with its function in earlier Basic versions.
Best way is what was written by Rosettif - modification Basic 10 to be backward compatible.
Why not? Basic 10 was never released, near no software used it and near no one using/knows it.
M65 can have M65, C65 and C64 modes - native, true C65 incl. Basic, and currently mod in progress.
But problem is on other side - C65 or M65 mode is missing progress and is out of focus. C64 mode is only one with progress and people looking for it. I end this post by way how you all on this forum heard from me (and maybe I'm hated for):
It looks like new C64 is on the way, C65 again dies.
Sad, sad. When I saw this project in 2013 I was happy like little kid - I could get C65, but it is past.
My words are sad and my mind see this, said 25 years ago: I want not to be loved for what I'm not, I'll be rather hated for who I am. It said man who decided very wrong.

Miro

append delete #18. gardners

Hello,

Yes, it is naturally quite possible to give attention to making the MEGA65's native BASIC backwards compatible with BASIC 7. Of course, this will be easier and more likely to happen if the community contributes to its development, instead of leaving everything to us.

As for documentation, we are actually already starting to write documentation for the C65's BASIC 10.

As for the question on the modes of the MEGA65, and your concerns about missing the C65 part, this isn't really true: The MEGA65 is a super-set of the C65 hardware, and can run the C65's original C65 ROMs to give a near-perfect C65 mode. The C65 ROM in turn allows dropping to C64 mode, which is thus supported. Thus the MEGA65 does both the C65 and C64 modes. Then all we have done is provide a number of hardware extensions that could be used to provide a "MEGA65 mode", or because the C65 model is to make it possible to access the higher functions from C64 mode if the program explicitly wants to, the same extensions are available from C64 and C65 mode, if the programmer wants to use them. Thus in the MEGA65 you do get a C64 and a C65, that are faithful to the original, plus the new parts of the MEGA65. But if you want to ignore them and live in C65 mode or in C64 mode, then this is just a case of loading the correct ROM onto the SD card.

But don't worry, we don't think less of you because you have a different opinion. That is only a thing for politicians and football supporters to do, and I am neither ;)

Paul.

append delete #19. Argh

Is some kind of extra ROM banking available in the C64 mode? You might quickly run out of ROM space if you start extending the functionality.

append delete #20. rosettif

@gardners: You wrote before that in C64 mode on MEGA65 the CPU would be switched to 6510 mode for better compatibility unless it enters the Kernal when it is switched to 4510 mode temporarily to handle the v2.2 accessing the built-in drive.

But this method won't work at all if any of the stock or other existing C64 Kernals is used (or anything else custom-made, but only designed with the C64 in mind) since these Kernals won't tolerate the 4510 mode.

So how can you then make a difference between these cases?

append delete #21. gardners

Hello,

Actually, the C64 KERNAL uses no illegal opcodes, so it doesn't care which CPU mode it would run in. Indeed, you can run a stock C64 KERNAL in a real C65 for this reason.

Paul.

append delete #22. rosettif

@gardners: But what about the CPU timing? Since the 4510 is about 20% faster averagely just because of that in advance, it should mean no good for IEC bus, datassette or serial port communications... etc. Or does it also work?

append delete #23. Freddy Champagne

@rosettif: there is no datassette-port in the C65.
And afaik the 4502 does some 'wait-states' when used in C64-Mode.

append delete #24. gardners

Yes, at 1MHz the 4510 of the C65 (and the 4502 of the MEGA65) use exactly the same number of cycles per instruction as the 6510. The only difference is when in the instruction certain memory accesses occur, which is only likely to affect a very few situations.

We can already boot GEOS from an IEC drive on the MEGA65, as an indication of how satisfactory how this is.

Paul.

append delete #25. rosettif

Thanks for the clarification. That's great news. I was always worried for this kind of compatibility issues. Then probably all of the original C64 fastloaders and such things will work.

:: @rosettif added on 20 May ’19 · 03:11

Now I have partly re-read that ominous "Preliminary" about the original C65 again, and yeah it indeed speaks about some "dummy cycles" emulated by the processor. Strange I have never recognized it before... However, I have never seen it in the emulations yet, either.

At least it is emulated at a nearly 1.18 MHz effective speed in both existing emulators (MESS and XEMU) as it was even so on MEGA65 two years ago as well (see my topic about MemTest64 here) as opposed to the 6510 which is about 0.98 MHz. Thanks again.

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: Deft, gardners, Ralph Egas