Page 1 of 1

test automation with VICE

Posted: Sat Apr 27, 2019 6:49 am
by chitselb
I'm working with VICE emulator on Linux, but this approach should work on other operating systems. What I want to do is
  • build my 6502 code
  • launch a PET (shell script)
  • load the freshly built binary (KEYBUF)
  • then execute it(also KEYBUF)
  • Finally I'd like the emulated PET to exit, to disappear (BREAK/COMMAND trick).
VICE has breakpoints. This uses the COMMAND to run a monitor command when VICE hits the breakpoint, which on the VIC-20 contains an RTS opcode. The 6502 test code will (hopefully) complete successfully, and as a final action do SYS 65503 (or somehow transfer control to $FFDF). Hitting breakpoint triggers the command, which kills the emulator process!

Code: Select all

BREAK +65503
COMMAND 1 "quit"
KEYBUF load"test",8\x0Drun\x0D

Re: test automation with VICE

Posted: Sat Apr 27, 2019 6:52 am
by BigEd
Nice idea!

Re: test automation with VICE

Posted: Sat May 04, 2019 6:00 am
by unclouded
Very cool!

I have an `on-change` script that uses inotify to notice when the `.d64` file is updated by the build process and then does `killall xplus4` and then re-launches VICE with the updated `.d64` but it's cool that you can terminate VICE under 6502 control!

Re: test automation with VICE

Posted: Fri Jun 07, 2019 8:51 am
by chitselb

Re: test automation with VICE

Posted: Fri Jun 21, 2019 10:29 pm
by JimBoyd
chitselb wrote:
I'm working with VICE emulator on Linux
Me too.
Quote:
VICE has breakpoints. This uses the COMMAND to run a monitor command when VICE hits the breakpoint, which on the VIC-20 contains an RTS opcode. The 6502 test code will (hopefully) complete successfully, and as a final action do SYS 65503 (or somehow transfer control to $FFDF). Hitting breakpoint triggers the command, which kills the emulator process!
I didn't know VICE has break points.
I suppose I just saw it as a C-64 on my Linux box and used it pretty much as I used the real C-64 I had.
This is really cool. You've just given me an idea. I don't know if it is possible yet, and it may already have been done. What about using the addresses of the C-64 user port and data direction register as break points to get VICE to emulate the C-64's user port?

Re: test automation with VICE

Posted: Sat Jul 13, 2019 12:37 am
by chitselb
behold! remote 8-bit test automation!

https://photos.app.goo.gl/BX42trUAy7Q3Ui4x9

Re: test automation with VICE

Posted: Fri May 14, 2021 9:47 pm
by pzembrod
chitselb wrote:
behold! remote 8-bit test automation!

https://photos.app.goo.gl/BX42trUAy7Q3Ui4x9
Great stuff!

Picking up this 2 year old thread to compare notes. A bit after you I faced the same problem, fully automating build and test sequences with VICE. I hadn't seen your post, and didn't know or didn't think about VICE's breakpoint feature; I instead used the emulated file system as signal path from inside VICE to the outside world: The emulator is watched by a shell loop, and as soon as a certain file (called "notdone") disappears (because the code inside the emulator scratched it), the shell loop terminates VICE. See https://github.com/pzembrod/cc64/blob/m ... ice.sh#L50

In a thread on github/DurexForth (https://github.com/jkotlinski/durexforth/issues/312) I learned of yet another method to terminate VICE: The "debug cartridge": https://vice-emu.pokefinder.org/index.php/Debugcart
If activated via command line flag, then writing to a certain address terminates VICE.