test automation with VICE

Topics pertaining to the emulation or simulation of the 65xx microprocessors and their peripheral chips.
Post Reply
chitselb
Posts: 232
Joined: 21 Aug 2010
Location: Ontonagon MI
Contact:

test automation with VICE

Post 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
Attachments
Screenshot_2019-04-27_01-33-41.png
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: test automation with VICE

Post by BigEd »

Nice idea!
unclouded
Posts: 81
Joined: 24 Feb 2015

Re: test automation with VICE

Post 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!
chitselb
Posts: 232
Joined: 21 Aug 2010
Location: Ontonagon MI
Contact:

Re: test automation with VICE

Post by chitselb »

JimBoyd
Posts: 931
Joined: 05 May 2017

Re: test automation with VICE

Post 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?
chitselb
Posts: 232
Joined: 21 Aug 2010
Location: Ontonagon MI
Contact:

Re: test automation with VICE

Post by chitselb »

behold! remote 8-bit test automation!

https://photos.app.goo.gl/BX42trUAy7Q3Ui4x9
pzembrod
Posts: 22
Joined: 05 Sep 2020
Contact:

Re: test automation with VICE

Post 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.
Post Reply