You have to write an optimized 6809 assembler function to draw vector lines on a Vectrex game console. Attached is the full project. You can open and run it with the Vide IDE:
[login to view URL]
When opening the project in Vide, you can start it with the play button in the Vedi toolbar. Then you can click in the vecxi window, and press "a" to start the game (the buttons 1, 2, 3, 4 are a, s, d, f). Then you can open the "tracki" window and click "reset". This will show you the number of cycles the whole game loop needs.
As a test if you are qualified to do this task, tell me the "avg" number you see. If the number is wrong or if you don't tell me the number, your offer will be ignored.
You have to write an optimized version of the "drawField" function in the bloxorz.c file. Most likely it needs to be in assembly and it needs to use the VIA registers directly instead of calling the Bios functions. If you add a "return" at the beginning of the function, you can see in the tracki window that it needs 11799 cycles (difference between the game loop with and without the function). Your task is to increase the speed to at least less than 5000 cycles, for the first level, and the function has to work for the other 2 levels as well (but then it can be slower).
The higher speed should be possible, because if you comment out the showInfo function, you can see that this function needs 3589 cycles, and it draws about 80 lines, while the drawField function draws much fewer lines.
Some helpful resources:
- Vectrex Bios ROM listing: [login to view URL]
- Vectrex Programmers Manual: [login to view URL] [login to view URL]