Flash ROM from the X16

Chat about anything CX16 related that doesn't fit elsewhere
Scott Robison
Posts: 952
Joined: Fri Mar 19, 2021 9:06 pm

Flash ROM from the X16

Post by Scott Robison »



2 hours ago, ZeroByte said:




Me, I’d put a file browser or a command shell in ROM, along with a file viewer/editor that displays in PETSCII, ASCII, or hexdump formats. 



After that, I’d say an assembler.



While my BASIC-like peer project isn't going to be an assembler per se, I was planning to allow some sort of "inline assembly" first class feature so that those portions that would benefit could use it.

Stefan
Posts: 454
Joined: Thu Aug 20, 2020 8:59 am

Flash ROM from the X16

Post by Stefan »


Considering what Lorin said above in this thread I will probably remove my PR for a START command.

I now have a much simpler implementation for a FARSYS command.

Example: FARSYS $C000,7 will jump to address $C000 in ROM bank 7.

It seems to work, but I will look at the code a bit more before pushing that.

Even if flashing the ROM will be somewhat complicated/risky, it's reasonable to believe quite a few will try that anyway. The FARSYS command would be useful for those.

Do you think the name of the command should be shortened to FAR?

User avatar
desertfish
Posts: 1092
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Flash ROM from the X16

Post by desertfish »


just FAR is too confusing IMO , it's a SYS call you're doing after all, just to another Rom bank.   Perhaps FSYS?   (in the spirit of VPOKE/VLOAD) 

Stefan
Posts: 454
Joined: Thu Aug 20, 2020 8:59 am

Flash ROM from the X16

Post by Stefan »


I made the pull request now. As suggested by @desertfish, I'm calling it FSYS.

https://github.com/commanderx16/x16-rom/pull/213

Scott Robison
Posts: 952
Joined: Fri Mar 19, 2021 9:06 pm

Flash ROM from the X16

Post by Scott Robison »


I think "BOB" would be a good command for a far sys... ? Or not...

Scott Robison
Posts: 952
Joined: Fri Mar 19, 2021 9:06 pm

Flash ROM from the X16

Post by Scott Robison »


In all seriousness, C128 had an extended SYS command: SYS address,a,x,y,s

Where a,x,y,s were optional and were used as values for the given registers if given.

I would think a better solution for X16 BASIC is to just extend the SYS command to be "SYS addr,bank,a,x,y,s" where bank can be ROM or RAM based on the address provided. That way it allows setting of register values and SYSing into either ROM or RAM banks depending on the context, just like JSRFAR does.

 

Stefan
Posts: 454
Joined: Thu Aug 20, 2020 8:59 am

Flash ROM from the X16

Post by Stefan »



5 hours ago, Scott Robison said:




In all seriousness, C128 had an extended SYS command: SYS address,a,x,y,s



Where a,x,y,s were optional and were used as values for the given registers if given.



I would think a better solution for X16 BASIC is to just extend the SYS command to be "SYS addr,bank,a,x,y,s" where bank can be ROM or RAM based on the address provided. That way it allows setting of register values and SYSing into either ROM or RAM banks depending on the context, just like JSRFAR does.



 



Are there any vararg functions in the current BASIC implementation? I'm not aware. A vararg SYS command could be a lot of work. I don't know if it's worth it.

There is much less need for a FAR SYS command that lets you jump to banked RAM. The RAM bank can easily be switched from BASIC with a POKE 0,[RAM BANK] before using the standard SYS command.

My implementation of FSYS does only switch ROM banks.

User avatar
Cyber
Posts: 482
Joined: Mon Apr 27, 2020 7:36 am

Flash ROM from the X16

Post by Cyber »


I agree with Lorin's approach, that certain requirements have to be met like jumper and so on. And I don't see how this interferes with adding custom file browsers, viewers, editors or even making a completely custom ROM. This really should not be casual. Why would one need a BASIC command that could be executead at any time?

Scott Robison
Posts: 952
Joined: Fri Mar 19, 2021 9:06 pm

Flash ROM from the X16

Post by Scott Robison »



1 hour ago, Stefan said:




Are there any vararg functions in the current BASIC implementation? I'm not aware. A vararg SYS command could be a lot of work. I don't know if it's worth it.



There is much less need for a FAR SYS command that lets you jump to banked RAM. The RAM bank can easily be switched from BASIC with a POKE 0,[RAM BANK] before using the standard SYS command.



My implementation of FSYS does only switch ROM banks.



That's a good point. Twas just an idea. ?

Stefan
Posts: 454
Joined: Thu Aug 20, 2020 8:59 am

Flash ROM from the X16

Post by Stefan »



8 hours ago, Cyber said:




I agree with Lorin's approach, that certain requirements have to be met like jumper and so on. And I don't see how this interferes with adding custom file browsers, viewers, editors or even making a completely custom ROM. This really should not be casual. Why would one need a BASIC command that could be executead at any time?



The purpose of the command is not to program the ROM, but to start a program that resides in ROM.

The command is needed as you cannot change ROM bank in BASIC. Typing for instance POKE 1,[ANY ROM BANK BUT 4 WHERE BASIC IS STORED] will typically crash the BASIC environment.

Without a FAR SYS command, you would need to type in a machine code startup stub in RAM with the MONITOR each time the computer is started. That is not very practical. Or load the startup stub from the SD card, which is also a bit cumbersome.

Post Reply