Author Topic: Development on PC environment possible?  (Read 865 times)

VectrexRoli

  • Newbie
  • *
  • Posts: 2
    • View Profile
Development on PC environment possible?
« on: September 11, 2016, 12:06:05 PM »
Hi, I have a question: Is there some way of emulating / simulating the Vectrex32 cart on a Windows PC environment?
The reason I am asking is, it would be great to write and test a program on a laptop without using the Vectrex and test the final result later on real hardware.

Vectrex32

  • Administrator
  • Full Member
  • *****
  • Posts: 102
    • View Profile
Re: Development on PC environment possible?
« Reply #1 on: September 11, 2016, 12:33:23 PM »
There is no way to do that. But remember that writing a game for the SmartCart is dramatically different from writing a game in 6809 assembler. To write a game for the SmartCart:

- Plug the SmartCart into the Vectrex and turn it on.
- Plug the SmartCart via USB into your PC.
- Bring up a terminal window on your PC to talk to the SmartCart.
- Bring up your favorite text editor. Write some BASIC and save it to the SmartCart's USB drive.
- In the terminal window, load and run your program.
- Is there a fatal error in your program? BASIC will print out a message in your terminal window telling you what the error is and what line it was on.
- Is there a logic error in your program? Hit Ctrl+C. Print out variables, set breakpoints, and continue running.
- Are the shapes not right on the screen? Hit Ctrl+C. Change the values in the arrays that define your vectors. You'll see the changes reflected on the Vectrex screen immediately.
- When you've figured out the fix for the problem, change the BASIC in your text editor, save the changes to the SmartCart's USB drive again, and reload the program from the terminal window. Run it again and see the results.

A PC-based emulator was really, really important as an alternative to assembling code, burning it into a ROM, running it on the Vectrex where there are no debugging tools, and trying to puzzle out where the bugs were. The SmartCart changes that completely. Not only is it letting you write your program in BASIC, but the SmartCart is loaded with debugging tools: breakpoints, tracing, examining variables, changing variables, examining what's being drawn on the screen, and changing the screen interactively.

- Bob

Minestorm

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Development on PC environment possible?
« Reply #2 on: September 11, 2016, 01:05:11 PM »
Would it be possible to edit the BASIC program from the terminal ?. I'm so used to entering LIST, editing BASIC programs and then re-running.

Or, another option could be some PC software that combined both terminal and editor.


Vectrex32

  • Administrator
  • Full Member
  • *****
  • Posts: 102
    • View Profile
Re: Development on PC environment possible?
« Reply #3 on: September 11, 2016, 01:19:21 PM »
Editing a BASIC program from the terminal would require either 1) a visual text editor using VT-100 codes or 2) typing line numbers on all your BASIC statements. The first option is a lot of work that would leave no one happy (everyone hates text editors that are different from their favorite); the second option is so 1970s.

(There's actually a third option: implementing a Edlin-like editor. I'm skeptical that people would want to use it.)

So I suggest you have your program open in a text editor in one window, and the terminal open in another window. Make changes in the editor, click Save, then switch to the terminal window and re-load. Yeah, it's a pain to have to re-load. But I think it's the least worst option.

- Bob

VectrexRoli

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Development on PC environment possible?
« Reply #4 on: September 12, 2016, 07:59:36 AM »
Thanks for your response, the idea behind my question was to write programs being on a trip than sitting in front of the Vectrex.  ;) But anyway, so I have to try that when I am at home.

gliptitude

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Development on PC environment possible?
« Reply #5 on: October 03, 2016, 03:58:54 PM »
Does the VIDE compatability now mean that it is possible to work on a GSBASIC program without a Vectrex?

Vectrex32

  • Administrator
  • Full Member
  • *****
  • Posts: 102
    • View Profile
Re: Development on PC environment possible?
« Reply #6 on: October 03, 2016, 04:12:48 PM »
You still need a Vectrex to test or run the GSBASIC program.

Airshack

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Development on PC environment possible?
« Reply #7 on: January 11, 2017, 12:19:55 AM »
So what then does VIDE compatibility mean for the GSBASIC programmer?

Astrosynthesist

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Development on PC environment possible?
« Reply #8 on: April 19, 2017, 09:31:56 AM »
I actually don't think it would be too hard to build a nice graphical environment for the Vectrex32 to combine both terminals into one. If I have time after these blasted exams are done I'll write it in Java and post the source to Git. I may even be able to put it into Eclipse, haha.

On another note, I recommend a hardware revision to future models of the Vectrex32 (I'll be testing this myself). Allow the thing to run off of USB power! That way 90% of testing can be done with the Vectrex off, as well as loading and accessing programs on the go. I haven't investigated voltage/current requirements yet but it can't be outside of usb capabilities. If the 32 can sense that there is no Vectrex attached it could use a set of static values for any areas the Vectrex would write to and simulate a tick counter based on its own clock. If you wanted to get really fancy you could feed it values over time but methinks that's all too ambitious at once. In order to separate the power I would just use two diodes across Vectrex and USB power input to prevent reverse biasing.

I wasn't sure whether to make it its own thread or not but I think it relates to developing on a PC environment as this potentially cuts down the required peripherals from "Vectrex32 and Vectrex" to just "Vectrex32".

Anyways, I haven't had the Vectrex32 for long so feel free to tell me off if I'm wrong.

Vectrex32

  • Administrator
  • Full Member
  • *****
  • Posts: 102
    • View Profile
Re: Development on PC environment possible?
« Reply #9 on: April 19, 2017, 09:42:55 AM »
I actually don't think it would be too hard to build a nice graphical environment for the Vectrex32 to combine both terminals into one. If I have time after these blasted exams are done I'll write it in Java and post the source to Git. I may even be able to put it into Eclipse, haha.

Check out VIDE first to make sure it isn't already doing what you want. If it does not do what you want, one possible approach is to work with Malban to add the features.

Allow the thing to run off of USB power! That way 90% of testing can be done with the Vectrex off

I've thought about this, and I've even experimented with it. But how useful would it really be? You could run the program, but you wouldn't see any of the shapes or any of the motion, you wouldn't hear any sound, you couldn't feed it any input. All it would really do is check your program's syntax.

- Bob

Astrosynthesist

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Development on PC environment possible?
« Reply #10 on: April 19, 2017, 10:22:40 PM »
Ah, yes. I had forgotten about VIDE. I'll give it a go as it seems to be more than adequate and already implements some of the ideas I had like the graphical sprite generating and stuff.

With regard to the USB side of things, I would say that just because we might not have an idea why it would be useful now, doesn't mean the capability might not be useful in the future. As it stands, the ability to make small revisions to a program with the vectrex off and upload it to the flash and then not having to boot my computer next to the vectrex later when I want to run it would be nice. I admit this is a poor example but my point is who knows?:)

Even more interestingly, if it could auto-sense being plugged into a Vectrex, when it's standalone it could potentially funnel the machine code it generates through USB so that an emulator like the one in VIDE could actually work in conjunction with the Vectrex32. Now, I don't know whether USB 2.0 is fast enough to do that, but I'm pretty sure 480 Mb/s should be fast enough to do that.

That is obviously a fantasy at this point but I think it's doable... iff the Vectrex32 will even turn on from USB power of course. (Since VIDE is open source fiddling with the emulator can't be too hard. If you think this is feasible over USB I can look into that end).

Vectrex32

  • Administrator
  • Full Member
  • *****
  • Posts: 102
    • View Profile
Re: Development on PC environment possible?
« Reply #11 on: April 19, 2017, 10:32:46 PM »
You can run V32 programs on the Vectrex without having it connected to a PC. Just copy a BASIC program to the V32's flash. If its name is autorun.bas, it will run when the Vectrex is turned on, regardless of whether a PC is connected. Alternatively, you can use the autorun.bas program that comes with V32; it displays a menu of all the BASIC programs on the V32 and lets you select one and run it.

Having the V32 send 6809 code over the USB to the PC is problematic, not just because of USB's speed but because Windows is not a real-time operating system; there's no guarantee that Windows will read the USB 30 times per second. In any case, it would be simpler to port the V32 code to Windows and have it interact with a Vectrex emulator.

"Simpler" is a relative term, though. It would still be a lot of work.

- Bob

Astrosynthesist

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Development on PC environment possible?
« Reply #12 on: April 19, 2017, 11:25:55 PM »
Haha, yes I know the Vectrex32 runs standalone. What I'm saying in that poor example is case: Download program from Vectrex32 with Vectrex off, modify program with Vectrex off, upload to Vectrex32 with Vectrex off. Turn off computer. Go eat dinner, come back later, turn on Vectrex and use program uploaded earlier. Something more like that. It's not a significant difference in my life but it would make me feel better than having to turn on the Vectrex just to download a file from the Vectrex32. Now, yes, you could argue I should keep copies of everything on my computer anyways, but I'm only trying to impress the point that it would be preferred to do Flash operations at the very least without needing to power on the Vectrex.

It's moot because the idea of using USB independently from the Vectrex is being explored in the other case we're discussing right now. If usb access speed is an issue then for pure testing purposes a user adjustable frame buffer would probably be more than adequate to compensate, and 4 or 5 buffered frames would cause noticable lag indeed, but for testing purposes it would probably work out fine. And the lower latency the system is, the less lag would be present over the usb connection.
I'm assuming the Vectrex32 generates the machine code frame by frame and writes every frame to the dual port memory as a batch. In this case each batch could be redirected to USB and if the framerate is higher than 30 fps then that allows for a larger buffer without noticable effect. Especially if input (fed from the computer by USB) is always changed at a fixed rate, say 30 reads/second regardless of frame rate.

Towlebooth

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Development on PC environment possible?
« Reply #13 on: May 16, 2017, 08:54:28 AM »
Thank you for the patience in answering these questions (and so many more to come I'm sure).  I had the same ones.  I'm looking forward to jumping in!

Chad