markus-zzz / myc64-pocket

A Commodore 64 core for the Analogue Pocket
32 stars 2 forks source link

Shortcut button to load PRG and Run #7

Closed dfilskov closed 4 months ago

dfilskov commented 5 months ago

Please consider making a shortcut to activate the chosen PRG file and run it with one click.

lunchpacked130 commented 5 months ago

Try this: 1: Press the [Analogue] button and load a prg file. 2: Press [Select] to bring up the onscreen keyboard. 3: Press the [R] shoulder button to change from keyboard to the prg loader. 4: Confirm path is showing prg you loaded in (1) and press [Confirm] button

There are 3 pages available when you press [Select], you can change between them by using the shoulder [L] & [R] buttons Page 1 is the onscreen keyboard Page 2 is the ".prg injector/loader" Page 3 let's you reset the machine and swap controllers.

Screenshot_20240410_230952_Chrome Screenshot_20240410_230746_Chrome

dukestah commented 5 months ago

Unfortunately, this won't work while the Pocket is in the Dock. Depending on the controller in use, you don't have the shoulder buttons functionality and I haven't figured out how to operate the 'Select-Menu' via keyboard.

lunchpacked130 commented 5 months ago

Ahh, you didn't mention anything about using the dock or a externalkeyboard.

Have you looked through the src files for the mapping as described in the readme?

"The (external) keyboard is expected to show up on the third input (i.e. cont3_joy). For details on the key mapping see table hid2c64 in source file src/bios/main.c."

dfilskov commented 5 months ago

Try this: 1: Press the [Analogue] button and load a prg file. 2: Press [Select] to bring up the onscreen keyboard. 3: Press the [R] shoulder button to change from keyboard to the prg loader. 4: Confirm path is showing prg you loaded in (1) and press [Confirm] button

... and then also type R, U, N, RETURN on the onscreeen keyboard, right?

Thank you for the explanation!

I was hoping for an easier solution like

  1. Press the Analogue button and pick a PRG file
  2. Exit the menu and tap one shortcut key to start the chosen PRG.
dukestah commented 5 months ago

Ahh, you didn't mention anything about using the dock or a externalkeyboard.

Have you looked through the src files for the mapping as described in the readme?

"The (external) keyboard is expected to show up on the third input (i.e. cont3_joy). For details on the key mapping see table hid2c64 in source file src/bios/main.c."

hid2c64 is included in keyboard-ext.c I think the section 'if (osd_on)' within main.c needs a mapping of external keyboard keys like F11 and F12 for example

lunchpacked130 commented 5 months ago

... and then type R, U, N, ENTER on the onscreeen keyboard, right?

I just press the "confirm" button and it boots the prg directly, don't need to type run or anything.

But some roms won't load and does not give any indication of error, it just behaves as if you didn't press anything, if this happens, try another rom. Also you can check the compatability wiki for know working roms

markus-zzz commented 5 months ago

... and then type R, U, N, ENTER on the onscreeen keyboard, right?

I just press the "confirm" button and it boots the prg directly, don't need to type run or anything.

I'll comment on this more properly later today but just wanted to say that if the prg start up directly after inject that indicate that the prg is replacing the entire memory image (ie not using crunched prg). This may definitely lead to more failures and is not supported. Or maybe i misunderstood.

dukestah commented 5 months ago

... and then type R, U, N, ENTER on the onscreeen keyboard, right?

I just press the "confirm" button and it boots the prg directly, don't need to type run or anything.

I'll comment on this more properly later today but just wanted to say that if the prg start up directly after inject that indicate that the prg is replacing the entire memory image (ie not using crunched prg). This may definitely lead to more failures and is not supported. Or maybe i misunderstood.

Yes, I think this might be the case. I have tested about 30 crunched prgs and autostart never occured, always needed to type run and enter (hence my interest to get this operation done via external keyboard...)

dfilskov commented 5 months ago

... and then type R, U, N, ENTER on the onscreeen keyboard, right?

I just press the "confirm" button and it boots the prg directly, don't need to type run or anything.

I'll comment on this more properly later today but just wanted to say that if the prg start up directly after inject that indicate that the prg is replacing the entire memory image (ie not using crunched prg). This may definitely lead to more failures and is not supported. Or maybe i misunderstood.

Well I simply hope for a very fast way to perhaps reset, activate the chosen PRG and type RUN RETURN.

:)

That's why I'm asking you to consider mapping that 'macro' to one single button on the Pocket.

markus-zzz commented 5 months ago

@dfilskov, yep I know what you mean. I think part of the problem is that the keyboard is clunky (as reported in #5). If it were not it would be less of a problem to type out RUN. Regardless I agree that it could be convenient to have some pre-canned lines like RUN and eventually LOAD "*",8,1

@lunchpacked130, that stuff could serve as a nice getting started guide if you add it to the wiki. Maybe also add some screen dumps from the pocket of the different menus.

@dukestah, I haven't at all considered controlling the cores OSD with an external keyboard. I guess it is doable (by utilizing some unused keys like you say) but the user would still need to have a normal game controller handy to navigate the Pocket's own menu system to load the PRG slot.

lunchpacked130 commented 5 months ago

... and then type R, U, N, ENTER on the onscreeen keyboard, right?

I just press the "confirm" button and it boots the prg directly, don't need to type run or anything.

I'll comment on this more properly later today but just wanted to say that if the prg start up directly after inject that indicate that the prg is replacing the entire memory image (ie not using crunched prg). This may definitely lead to more failures and is not supported. Or maybe i misunderstood.

Ha ha 😅 turns out I've used the wrong prg set, and somehow the few uncrunched games i tested out actually worked. (Cosmic causeways for one) Long time since i fooled around on a c64, I was more into the amiga,

But yes, "run" + [enter] to run the games.

lunchpacked130 commented 5 months ago

@lunchpacked130, that stuff could serve as a nice getting started guide if you add it to the wiki. Maybe also add some screen dumps from the pocket of the different menus.

I'll see if i can cook something up during the weekend.

dukestah commented 5 months ago

@dukestah, I haven't at all considered controlling the cores OSD with an external keyboard. I guess it is doable (by utilizing some unused keys like you say) but the user would still need to have a normal game controller handy to navigate the Pocket's own menu system to load the PRG slot.

yes, understandable and totally fine, I'm using the 8bitdo N30 controller and the shoulder buttons aren't doing the trick tho, hence my urge to do this by keyboard, would make typing RUN even more comfortable and the C64 is very keyboard depending anyway :)

dukestah commented 5 months ago

@lunchpacked130, that stuff could serve as a nice getting started guide if you add it to the wiki. Maybe also add some screen dumps from the pocket of the different menus.

I'll see if i can cook something up during the weekend.

I'd like to provide some help if needed.

lunchpacked130 commented 5 months ago

@markus-zzz :

@lunchpacked130, that stuff could serve as a nice getting started guide if you add it to the wiki. Maybe also add some screen dumps from the pocket of the different menus.

I gave it a shot 😅 it's still work in progress, and i want to change the photos with new ones.. for one, the buttons doesn't really show that good on my translucent red pocket, and I'd also like to get proper screenshots of the openfpga menu, as now its just a photo, and there's an unessesary white border edge that should be cropped etc.

I'm fairly new to contributing on github, so i hope it's not a complete mess 🙈 and though I've written a couple of guides for work related training etc, it might come off as a bit "hand holding" or overkill 😅

I try to make it understandable and accessible for both experts and those who are completely new, (even that one user who you have to hold their hand and slowly guide them through each step, answering fun questions like "why should i not press no when it asks me to install, what if its a virus" etc. And in the end never learns anything and has to constantly check the guide for how to do it) (If you've worked in IT or computer support services, you know the type)

So i typically find it's better to explain one thing too many than too little.

I'm not sure if the guide is how you were wanting it to be, but i hope I'm not way off :p or since I'm not really that familiar with contributing on github, that i have submitted it the wrong way or if i should have made an entry somewhere with "to do's" and assignments etc so others editing can see what needs to be done etc, or something similar like that.. But I'm pretty sure that continuing this in a "issue" isn't the best way to do it 😅

but anyway, I'd appreciate any constructive feedback you can give me :)

@dukestah

I'd like to provide some help if needed.

That's very much appreciated :) If you have a dock and keyboard, you can help with that section as i don't have the dock myself. And also if you find something I've missed or is incorrect or have an idea etc. Feel free to fix/add it.

If by chance you guys like how I wrote the guide/how it looks, i can edit the wiki and make it as consistent as possible to the rest of the guide, provided you can contribute your findings/information about using the dock/ext. Keyb. And maybe take some photos/screenshots for me. I will of course give you credit (if you want it) just again, I'm new to this whole github thing, so I'm not sure if there's a built-in way to do it 😅 so you could also help me with that and/or other "github things" if you want :)

markus-zzz commented 5 months ago

Migrating the discussion about wiki and documentation to #10.

This issue is about providing a convenient/fast way to enter common commands such as RUN.

dukestah commented 5 months ago

@markus-zzz :

@lunchpacked130, that stuff could serve as a nice getting started guide if you add it to the wiki. Maybe also add some screen dumps from the pocket of the different menus.

I gave it a shot 😅 it's still work in progress, and i want to change the photos with new ones.. for one, the buttons doesn't really show that good on my translucent red pocket, and I'd also like to get proper screenshots of the openfpga menu, as now its just a photo, and there's an unessesary white border edge that should be cropped etc.

I'm fairly new to contributing on github, so i hope it's not a complete mess 🙈 and though I've written a couple of guides for work related training etc, it might come off as a bit "hand holding" or overkill 😅

I try to make it understandable and accessible for both experts and those who are completely new, (even that one user who you have to hold their hand and slowly guide them through each step, answering fun questions like "why should i not press no when it asks me to install, what if its a virus" etc. And in the end never learns anything and has to constantly check the guide for how to do it) (If you've worked in IT or computer support services, you know the type)

So i typically find it's better to explain one thing too many than too little.

I'm not sure if the guide is how you were wanting it to be, but i hope I'm not way off :p or since I'm not really that familiar with contributing on github, that i have submitted it the wrong way or if i should have made an entry somewhere with "to do's" and assignments etc so others editing can see what needs to be done etc, or something similar like that.. But I'm pretty sure that continuing this in a "issue" isn't the best way to do it 😅

but anyway, I'd appreciate any constructive feedback you can give me :)

@dukestah

I'd like to provide some help if needed.

That's very much appreciated :) If you have a dock and keyboard, you can help with that section as i don't have the dock myself. And also if you find something I've missed or is incorrect or have an idea etc. Feel free to fix/add it.

If by chance you guys like how I wrote the guide/how it looks, i can edit the wiki and make it as consistent as possible to the rest of the guide, provided you can contribute your findings/information about using the dock/ext. Keyb. And maybe take some photos/screenshots for me. I will of course give you credit (if you want it) just again, I'm new to this whole github thing, so I'm not sure if there's a built-in way to do it 😅 so you could also help me with that and/or other "github things" if you want :)

Looks very nice already! I'm sorta new to Github too, so we'll have to find our way together 😅 I will do some dock/ext. keyboard testing the next day and then I'll try to add my information to the wiki.

dfilskov commented 5 months ago

Here's what my preferred action would be to load and run a PRG

  1. Select the PRG in the Open FPGA menu
  2. Exit the FPGA menu
  3. Tap one button once (Start - to the right of the Analogue button - is the most logical IMO)
HeyItsLollie commented 5 months ago

I would honestly prefer to Load PRGs before the core even boots (much like how cartridge-based cores operate), and then have the core automatically boot into the chosen game - all without ever having to open the OSD or type RUN.

eobet commented 4 months ago

I must admit that while a purist approach has academic and nostalgic value, PRG is already a shortcut (bypassing the disk/tape storage medium) so I really don't understand why any user action has to be taken after selecting a PRG file... is it very difficult to implement an option to automatically launch whatever PRG you selected without showing the basic command line? This is a device without a keyboard after all so it will always be a pain point having to fake one.

Also, I must admit that I've been able to run exactly zero games so far... only non-games have worked via the "run" command for me, so not sure if I'm doing something else wrong. 😅

markus-zzz commented 4 months ago

is it very difficult to implement an option to automatically launch whatever PRG you selected without showing the basic command line?

The system needs to be up and running to be able to inject a .prg. See src/bios/prg.c for details

  // Update various zero page pointers to adjust for loaded program.
  // - Pointer to beginning of variable area. (End of program plus 1.)
  // - Pointer to beginning of array variable area.
  // - Pointer to end of array variable area.
  // - Load address read from input file and pointer to current byte during
  // LOAD/VERIFY from serial bus.
  //   End address after LOAD/VERIFY from serial bus or datasette.
  // For details see https://sta.c64.org/cbm64mem.html and
  // VICE source: src/c64/c64mem.c:mem_set_basic_text()

Now, of course, almost anything is doable but it would not be straight forward. It is more a matter of if it is worth the cost and my analysis suggests that it is not. It would not only be a matter paying up front but would also complicate things going forward.

Eventually there will be cartridge support and then things will work as you request.

Also, I must admit that I've been able to run exactly zero games so far...

There are certainly issues with many games but I have had reasonable success with at least https://github.com/markus-zzz/myc64-pocket/wiki/Working-PRGs

lunchpacked130 commented 4 months ago

I'm unaware of the complexity of the code, but as a (possibly) simpler alternative, would it be possible to add a [Start PRG] (or similar) button on the prg loading menu page?

F.ex. After loading a prg file, pressing [Start PRG] automatically exits the menu and types RUN + [Enter], starting the prg that way?

It's an extra button press vs directly loading on file select, but you wouldn't have to type RUN + [Enter] with the onscreen keyboard and press the "Select" button to exit the menu/OSK

markus-zzz commented 4 months ago

That kind of cookbook of prepared key sequences would fit better with the framework yes. So far I can see the following being useful

RUN
LIST
LOAD"$",8
eobet commented 4 months ago

Do you also in addition to loading the PRG have to go into the OSD and select it first? Is that why I can't load anything? Because when you open the OSD to that menu it appears selected, and regardless of what button I hit, there's no visual feedback.

So is it the FPGA nature of the thing which prevents someone from coding a timer which runs in the background after you load the PRG from the Analogue menu that after a delay auto selects the program and then enters "run" and starts it on its own or?

Sorry if I repeat myself, but I unfortunately don't see the value in forcing the user go through three distinct steps (about two dozen keypresses currently) just to load and run something on this core...

markus-zzz commented 4 months ago

Do you also in addition to loading the PRG have to go into the OSD and select it first? Is that why I can't load anything? Because when you open the OSD to that menu it appears selected, and regardless of what button I hit, there's no visual feedback.

Correct.

Sorry if I repeat myself, but I unfortunately don't see the value in forcing the user go through three distinct steps (about two dozen keypresses currently) just to load and run something on this core...

There is no particular value in it besides that, at the time, that solution was the most convenient to implement.

Times do change however and now the housekeeping cpu both have a notion of time (100Hz timer interrupt) as well as polling a register indicating when data slots are updated.

So on a second though I guess we could try the following:

When the housekeeping cpu detects an update on the .prg slot

  1. Pulse reset for the C64 (and 1541)
  2. Wait for 3 seconds (approx time it takes for basic prompt to appear)
  3. Inject the .prg into C64 RAM
  4. Inject a RUN<RET> sequence on the keyboard

If that would make people happy then I could try doing that and upload a test build to the issue. Shouldn't be too hard.

It might have some downsides though as I do not know if we will get a slot update indication if the user selects the same .prg as already selected in the menu. So if you want to restart the .prg then maybe you'll have to select another one in between. Stuff like that, general loss of flexibility.

markus-zzz commented 4 months ago

MyC64-Pocket.zip unzip in the root of sd-card.

Now Core Settings->Load inject PRG will reset core, wait until it boots, inject the .prg and then inject RUN<RET>.

I agree that it certainly is more convenient when browsing and trying different games. So would merging this and removing the old .prg support/interface allow us to close this enhancement request once it is released?

dfilskov commented 4 months ago

Yes! Thanks a lot :)

lunchpacked130 commented 4 months ago

MyC64-Pocket.zip unzip in the root of sd-card.

Now Core Settings->Load inject PRG will reset core, wait until it boots, inject the .prg and then inject RUN<RET>.

I agree that it certainly is more convenient when browsing and trying different games. So would merging this and removing the old .prg support/interface allow us to close this enhancement request once it is released?

I just tried the modified core, and it works perfectly. Now it basically works like most other cores, where selecting a rom, starts it upon selection, and selecting a new rom, resets the core and loads the new one.

This is very positive for those who might be intimidated by trying out the C64 because "you have to remember commands and type them to load programs.." etc., and for those using the Pocket as a handheld only, as typing RUN everytime you change roms when you're going through games or demos or similar.

I think if you could have both loading and injecting roms available as a choice, then those that just want to play games etc, can just choose to inject the games directly, while those that want more flexibility can chose to load them instead.

And I cant say for sure if it already does, or if its hard to implement if it isn't 😅 but with both "load" and "inject" available as well as floppy support, i would think it should also make disk swapping easier, as you could inject disk 1/side a and have it start directly, then load disk 2/side b etc. When needed.

And just as a suggestion, to make it clearer for those less technically inclined 😅 maybe the menu selection could read something like "Launch ROM"? Or if "Load" is unchangeable for rom selection, something like "Load & Run ROM"? To clearly indicate it will launch the rom on selection. (ROM used to indicate different extensions it will start)

Inject might also be a bit vague imho, even if it is a more technically correct term, it could also mean to inject something in the middle of something else (i.e. inject a code into a game like a gameshark does)

But all in all, I'm really enjoying being able to load and run games and demos directly while on the go. Excellent work!

And going back aaall the way to the original post in this topic, i would say this enhancement is exactly what @dfilskov asked for when he asked:

Please consider making a shortcut to activate the chosen PRG file and run it with one click.

dfilskov commented 4 months ago

I agree completely :)

markus-zzz commented 4 months ago

I just tried the modified core, and it works perfectly. Now it basically works like most other cores, where selecting a rom, starts it upon selection, and selecting a new rom, resets the core and loads the new one.

Thanks for the feedback @lunchpacked130, it is always good to hear that the core is being used.

This is very positive for those who might be intimidated by trying out the C64 because "you have to remember commands and type them to load programs.." etc., and for those using the Pocket as a handheld only, as typing RUN everytime you change roms when you're going through games or demos or similar.

Agree. As mentioned before the .prg injection is all fake anyway so those interested in the purist experience would use the 1541 instead.

I think if you could have both loading and injecting roms available as a choice, then those that just want to play games etc, can just choose to inject the games directly, while those that want more flexibility can chose to load them instead.

I got rid of the old .prg stuff to save space in the housekeeping cpu.

And I cant say for sure if it already does, or if its hard to implement if it isn't 😅 but with both "load" and "inject" available as well as floppy support, i would think it should also make disk swapping easier, as you could inject disk 1/side a and have it start directly, then load disk 2/side b etc. When needed.

Selecting a .g64 from the analogue menu is equivalent to a disk change. Nothing needs to be pressed or selected in the in-core OSD. The game/application usually require some key press to confirm that the disk has been changed though.

And just as a suggestion, to make it clearer for those less technically inclined 😅 maybe the menu selection could read something like "Launch ROM"? Or if "Load" is unchangeable for rom selection, something like "Load & Run ROM"? To clearly indicate it will launch the rom on selection. (ROM used to indicate different extensions it will start)

The 'Load' prefix is not something that I control, it comes from the Analogue OS but as suggested I changed the name in the data.json to & Start PRG so that it reads Load & Start PRG which looks much better.

Attached candidate build for next release MyC64-Pocket.zip