Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEGA65: ability to use the emulator as a testing tool #352

Closed
lgblgblgb opened this issue Jul 10, 2022 · 1 comment
Closed

MEGA65: ability to use the emulator as a testing tool #352

lgblgblgb opened this issue Jul 10, 2022 · 1 comment

Comments

@lgblgblgb
Copy link
Owner

lgblgblgb commented Jul 10, 2022

It can/could be useful to use the emulator to run a kind of module testing of ROM, software etc. For example: MEGA65/mega65-user-guide#484

To realistically do this, some minimal set of requirements from the emulation:

  • allow to run "headless" (no X11 or any GUI is running, no output window) [DONE: using "dummy" video and audio driver then in headless mode]
  • allow to skip timing to run at maximal speed (this is not a hard requirement, but surely it can be useful: faster testing than real-time, if the nature of testing allows that) [DONE]
  • dump memory content on exit [ALREADY-DONE]
  • dump screen content in ASCII (can be done easily, there is code for that in the UI just should be called automatically as well) [DONE]
  • user program controllable exit of emulator [DONE]
  • screenshot to PNG on exit? (can be easily done as there is code for that already to make screenshots) [DONE: MEGA65]
  • allow CLI option for hypervisor "serial" output [DONE]
  • CLI option to use IMPORT function of BASIC65 to load untokenized (pure ASCII) BASIC65 program. BASIC65 has this functionality, just somehow it should be made easy for using that feature in an automated testing workflow potentially [DONE, though not special handling of input chars or any conversion yet!]

Usage of existing techniques:

  • using the -virtsd feature to avoid to create large SD image for just testing purposes [REJECTED] it is very hard to use this feature nowadays since so many special preparement needed for the SD-card nowadays unlike in the old times
  • using -prg to load/run programs automatically
  • using -8 to attach D81 images automatically
  • uring -rom to select ROM to use

Some idea to use Xemu/MEGA65 as a testing tool:

MEGA65/mega65-libc#24

@lgblgblgb lgblgblgb self-assigned this Jul 10, 2022
lgblgblgb added a commit that referenced this issue Jul 16, 2022
CORE: added headless and sleepless mode to run Xemu without any output,
and to run at max speed without trying to sync to emulated target speed.
MEGA65: added -headless and -sleepless CLI options to expose these
features in the MEGA65 emulator.

MEGA65: added -dumpscreen CLI option to dump text screen in form of
ASCII values at exit time. Also an UI menu option to use this promptly.

MEGA65: inject framework (made for -prg etc) is re-worked to use more
precise VIC-IV values of the current screen memory etc.
@lgblgblgb lgblgblgb added the WIP label Jul 17, 2022
lgblgblgb added a commit that referenced this issue Aug 16, 2022
Add screenshot before exit feature and a way to trigger this from
programs as well in "testing mode".
lgblgblgb added a commit that referenced this issue Jul 17, 2023
* Introducing "dialogs_allowed" variable which is zero when headless
  mode is requested. This is to disallow to have warning boxes appearing
  which needs manual OK'ing. Instead, only the stdout shows the
  sitation.
* The same as above for selection box (trying to select the default
  option automatically).
* "-besure" also implied in headless mode, as there is no way to
  display question dialogs.
* Automatically selecting the "none" GUI when headless mode is
  requested.
* Writing $D6CF with $42 when "-testing" CLI option is used with the MEGA65
  emulator causes Xemu to exit with exit code $42. For other exit codes,
  the user program needs to POKE the exit code to $D6CF first, then the
  magic value of $42 should be written. In fact, we can say, writing
  exit code to $D6CF, then the magical value of $42. In case of exactly
  $42, the second write wouldn't happen though, as emulator exited by
  that time. WARNING: if "-screenshot" is also used, the emulation
  continues till one frame is finished, so if that feature is used, the
  test program needs an infinite loop after the write though!
lgblgblgb added a commit that referenced this issue Jul 24, 2023
This uses the BASIC65 ROM's command IMPORT. Xemu just fakes the given
file as a disk image, so BASIC65 ROM can load the SEQ file.

Crude, and preliminary support! Only works if the file is "well
formatted"!
lgblgblgb referenced this issue Jul 26, 2023
With the -fastboot switch, Xemu uses the "sleepless" timing during the
RESET HYPPO trap to speed up booting. Can be useful if called from
scripts with parameters like -prg and such to make the experience
faster. It's usless if -sleepless is used anyway, since then the
sleepless timing is always applied.
@lgblgblgb lgblgblgb added Committed and removed WIP labels Jul 26, 2023
@lgblgblgb
Copy link
Owner Author

Note: #420

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant