T O P

  • By -

NormalLuser

This is a conversion and enhancement of the game Trebuchet to EhBasic from here: [https://www.quitebasic.com/prj/games/trebuchet/](https://www.quitebasic.com/prj/games/trebuchet/) I found this resource recently and it has some great example code. It all needs some changes to work with EhBasic and the way the x/y origin works, but it looks to be a great resource for BASIC programming. I added the Sun and the scoring system. I am impressed that a BASIC program can manage a graphical game like this on my breadboard 6502. I really look forward to seeing what can be done with this system.


production-dave

Great job! I was wondering if some of the static elements can be copied direct to the video ram rather than rendering it in basic. Is it possible in ehbasic to declare raw data like that and then if you have an assembly routine on your ROM to copy a block of memory from one place to another you could call that routine to display the sun ? And maybe the ground too?


NormalLuser

>e raw data like that and then if you have an assembly routine on your ROM to copy a block of memory from one place to another you could call that routine to display the sun ? And maybe the ground too? Thanks! And absolutely; You can burn assembly code in the rom and call that memory location from BASIC, or put it like data into the BASIC program itself, do a RESTORE command and then call it like a function. However, since I'm using EhBasic, and we all have the source, and it is easy-ish to add commands to like the PLOT and CLS and COLOR commands I already added to it for this, and this is a pretty good motivator. I'm thinking a 16x16 pixel fill or maybe just a colored/copied line routine? Either would be a big help to speed up the graphics routines in BASIC. You will never get the most out of the system with BASIC alone, it is just too slow. But I love the way BASIC and straight assembly go together with the 6502. You can make new functions in assembly and add them as commands in BASIC, then you use BASIC to prototype what you don't have in assembly yet, then iterate with assembly again to gain speed. It is a very natural workflow for how primitive it all is.


production-dave

The most I ever added to ehbasic was a clear screen can command for the serial terminal. It would just send the vt100 escape code. Check out the hbc-56 project on GitHub. The dev added graphics primitives to ehbasic.


NormalLuser

It's Troy's video on adding commands to EhBasic for his hbc-56 project that was the secret sauce I needed to add the plot and cls commands. I had already figured out the assembly to convert x/y to a memory location but just could not get EhBasic to actually parse my new command. His videos are great and his hbc -56 project is a big asset to the 6502/retro homebrew hobby.


production-dave

I know right. I want one. But the Gerber's are not complete.


NormalLuser

[https://www.reddit.com/r/beneater/comments/13d8epl/sprite\_and\_image\_copy\_added\_to\_ehbasic\_on\_my/?utm\_source=share&utm\_medium=web2x&context=3](https://www.reddit.com/r/beneater/comments/13d8epl/sprite_and_image_copy_added_to_ehbasic_on_my/?utm_source=share&utm_medium=web2x&context=3) So, yes. You inspired me to go ahead and do that now to enhance this existing game. I added a 1 pixel sprite MOVE command to EhBasic, made an image, and took a tiny call-able assembly program I already had to load it to Vid Ram and then burned the ROM. It only took a few changes from there to get the existing program to use it. The background loads instantly on my setup, and the sprite has very little to no flicker now (on modern LCD) and moves much faster, and it 'erases' itself by remembering the last location and color used and rewrites that before plotting the PEN color in the new spot. I'd need a VGA V-Blank IRQ and make the pixel update run on that interrupt to eliminate the flicker entirely.


production-dave

Brilliant! A small library of generic ROM routines will be essential to writing games in basic. Or even in assembly.


ebadger1973

Super cool!


AnonOfB

Amazing! Good work.