Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Vectrex32

#106
General Discussion / Profiling a BASIC program
September 29, 2019, 08:39:49 PM
Let's say you want to profile your BASIC program, i.e. determine what lines of code it's spending most of its time on, perhaps to optimize it. Here's a technique I came up with.

From the terminal, I LOADed my program. I turned tracing on (TRON). Then, in the terminal program, I turned logging on (I use TeraTerm so I selected File -> Log. Note that by default, TeraTerm appends to the log file. You don't want that; you want it to create a new file. So uncheck the Append box.)

Then I ran my program. The line numbers were printed out as it executed and TeraTerm wrote them to the log file. The program also runs slower, but hopefully the results will still reflect the program's normal behavior. When I had run the program long enough, I hit Ctrl+C and turned off TeraTerm's logging.

Next, I opened the log file in Notepad++. It contains line numbers in square brackets. I did a Replace All, replacing "]" with "]\n", i.e. I added a line break after each number. For Notepad++ to recognize \n as a newline, you need to set the Search Mode to Extended in the Replace dialog.

Then I saved the file.

Next, I opened a bash window (I have Windows Subsystem for Linux on my PC). I ran the command:
sort teraterm.log | uniq -c | sort -r -n >profile.txt

This sorts the line numbers, then uniq counts how many times each line number occurs, then the second sort command sorts the file so the most-executed line number is at the top. profile.txt will contain a list of line numbers, with the number of times that line was executed, in order with the most-executed line on top. You can use that as a guide for optimizing your code.

Note that this tells you which line is executed the most, but it doesn't tell you which line consumes the most processor time. It's conceivable that a simple line of code is executed most often, but a more complex line of code consumes more time overall.

I apologize for the Windows-centric nature of my description, and the dependence on the Linux subsystem. There are certainly plenty of other ways to achieve the same results. If you profile your code with a different set of tools, please post a description here.

- Bob
#107
News and Updates / Firmware upgrade: version 1.19
September 27, 2019, 01:03:09 PM
There's a new version of the Vectrex32 firmware available, version 1.19. This is a really critical upgrade if you have 1.18; it fixes some serious bugs. If you have an earlier version, this is still an important upgrade because it gives you all the features that version 1.18 promised.

If you already own Vectrex 1.10 or newer, you can download the firmware here. If you still have version 1.00, please read this.
#108
General Discussion / Re: Stuck on "Waiting"?
September 24, 2019, 04:12:03 PM
Can you send me your demo program? I want to try loading it on my system.

- Bob
#109
General Discussion / Re: Stuck on "Waiting"?
September 24, 2019, 03:29:03 PM
I believe I've found a fix for the problems where Demo3D, MissileBreak, and Yankee crashed. I'm still having some problems with sound.

I've haven't been seeing the problems you describe with the disk. Is your USB cable plugged directly into your PC or is it plugged into a hub? Are you certain it's reliable?

I'm really sorry about the trouble you're having. If you want to return the V32, I'll certainly give you a full refund.

- Bob
#110
General Discussion / Re: Stuck on "Waiting"?
September 23, 2019, 10:23:56 PM
I no longer think that adding a WaitForFrame is the solution. There's something messier going on. I'm looking into it.

- Bob
#111
General Discussion / Re: Stuck on "Waiting"?
September 23, 2019, 04:23:40 PM
It sounds like the flash drive has taken a beating. I'd copy all the files off it, reformat it, and copy the files back.

- Bob
#112
General Discussion / Re: Stuck on "Waiting"?
September 23, 2019, 09:32:39 AM
Clipping does not happen automatically. You need to set it up.

If a file is getting locked, it sounds like the crash must have happened during a save. Be careful not to do anything else during a save.

When the Call command is missing, BASIC assumes you meant to assign a variable to the result of a function, rather than assuming you were trying to call a subroutine. That's why you get the missing equal sign error.

If EndFunction is giving an error, it's probably because you're not currently in a function or because the EndFunction statement is inside a loop or IF statement. You can't have more than one EndFunction in a function. Function...EndFunction is a compile-time block.

- Bob
#113
General Discussion / Re: Stuck on "Waiting"?
September 23, 2019, 08:44:38 AM
Finally had some time to look at this.

I edited Demo3D.bas and added:
call WaitForFrame(JoystickDigital, Controller1, JoystickX + JoystickY)

after line 35. This solved the problem where the Vectrex crashes right after you press button 1 to leave the Instructions screen.

The other two problems, crashing after 10+ ships and crashing after moving the ships off the screen, are BASIC program crashes. They display error messages on the terminal. As such, I'm not worried about them. It's only a demo program. Consider them to be demonstrations of issues that can arise in your code. ;-)

- Bob
#114
The commands sent to the 6809 are just straight assembly language, so they vary. Typically, they set up arguments and call a BIOS routine.

- Bob
#115
Well the 6809 can access 64K and the Vectrex maps half of that, 32K, to the cartridge port.

If you want to post a demo, maybe the Code Swap forum would be the best place.

- Bob
#116
General Discussion / Re: Stuck on "Waiting"?
September 21, 2019, 04:36:29 PM
I just saw something surprising. I ran the 3D demo, pressed button 1 and the Vectrex screen went blank. If I reset the Vectrex, it would restart, re-establish communication with the V32, and display the 3D demo screen with the first Tie fighter visible. After that, I could create more Tie fighters.

So something caused the Vectrex to crash but not the V32. At this point, I don't know what. But it doesn't appear to be a loose connection.

- Bob
#117
The max amount of DPRAM would be 32K.

I hand soldered the prototypes. I pay someone else to assemble the production boards because my failure rate with making them is about 25%.

- Bob
#118
More DPRAM would be technically possible. I haven't looked into how much more it would cost. Not only would the chip itself be more, but it's a bigger chip with more pins so assembly is more challenging (and beyond my ability to solder it myself).

- Bob
#119
Frame rate would affect the amount of drawing the Vectrex can do, but would not affect what can fit in the 2K RAM.

You're right about all the stuff that goes into the 2K RAM. YASI is using a clever scheme that, if I understand correctly, is similar to how the Vectrex draws text. Each raster is just one line, but the brightness is turned off and on while the line is being drawn. The V32 does not have that ability built-in (though it might be possible to do with a Code Sprite).

- Bob
#120
I hope the fading in and out is intentional on your part. ;-)