Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : MMBasic Test Version 2.6A - With Fonts
Page 2 of 4 | |||||
Author | Message | ||||
BobDevries Senior Member Joined: 08/06/2011 Location: AustraliaPosts: 266 |
Hi Geoff, If I want to print in the large inverted font using the FONT #3,2,1 on one part of the screen, and then revert to normal size characters on subsequent lines, I'd use the command FONT UNLOAD #3, right? If I do that, and then run another programme to use the command FONT #3,2,1 again, the MM returns an error "Invalid Font" I'm presuming the MM needs to be restarted in this case? I think I should just use the command FONT #1 instead of FONT UNLOAD #3, but there seems to be no way to retrieve the unloaded font even though it's a built-in font. Perhaps FONT UNLOAD should not do anything for the built-in fonts? Regards, Bob Devries Dalby, QLD, Australia |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
I used something like 10 FONT #3 : Print 1234 : FONT #1 to revert back to the smaller font. I dont think you need to unload fonts 2 and 3. Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
Whenever the interpreter returns to the prompt the font is reset back to #1. This is because your program could have stopped with an unreadable font selected and you would not be able to read the error message or see the prompt. So, if you type in a font command at the prompt, it will be reset at the next prompt and you would not see anything. Try this instead: > FONT #3,2,1 : PRINT "0123" I don't understand, the video cursor has never flashed ! Geoff Geoff Graham - http://geoffg.net |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
Thanks, another bug. I will fix it in the next version. Geoff Geoff Graham - http://geoffg.net |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
Yes, you will have to cycle the power if you wanted to restore a built in font that you have unloaded. Gizmo has it right, don't unload them. This facility was only included for people who would want to load more than 7 fonts but, now that I think about it, that is an extremely unusual requirement. So, OK. I will remove the ability to unload built in fonts. Geoff Geoff Graham - http://geoffg.net |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
The Maximite now has all the commands and speed to achieve the ultimate goal, its only a matter of time ..... The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
That looks great. Unfortunately, my maximite won't run it. Besides, I've got too many machine language games for my Maximite TRS-80. My biggest problem is pulling me away from them to start exploring the Operating systems and productivity software! |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
Just for fun, threw this together this morning. Space Invader animation, with two of the alien characters. Very basic, but proves the Maximite has more than enough speed for the full game if written in MMBasic. 10 FONT UNLOAD #4 20 CLS 30 FONT LOAD "SPACE.FNT" AS #4 40 FONT #4 50 X1=1:X2=50:XStep=2 60 FOR Y=1 TO 200 STEP 5 70 FOR X=X1 TO X2 STEP XStep 80 LOCATE X,Y : PRINT "010101010" 90 LOCATE X,Y+20 : PRINT "030303030"; 100 PAUSE 100 110 LOCATE X+(XStep/2),Y : PRINT "020202020" 120 LOCATE X+(XStep/2),Y+20 : PRINT "040404040"; 130 PAUSE 100 140 NEXT x 150 IF X1=1 THEN 160 X1=50 : X2=1 : XStep=-2 170 ELSE 180 X1=1 : X2=50 : XStep=2 190 ENDIF 200 CLS 210 NEXT Y 220 END Save below as SPACE.FNT, carefull to not loose the spaces at the ends of the lines. The top block is our space, or blank, character, in this case the number 0. 8,16,48,52
XXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXX XXXX XXXXXXXXXXXXXXXX XXXX XXXX XXX XX XXX XXX XXX XXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXX XXXX XXXXXXXXXXXXXXXX XXXX XXXX XXX XX XXX XXX XXX X X X X XXXXXXXXXX XX XXXXXX XX XXXXXXXXXXXXXX X XXXXXXXXXX X X X X X XXX XXX X X X X X X X XXXXXXXXXX X XXX XXXXXX XXX XXXXXXXXXXXX XXXXXXXXXX X X X X Now back to earning a living. Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
I added the FONT UNLOAD #4 command in the first line because it would throw an error if I re-run the program after a crash. Maybe a RUN command should clear any loaded fonts from memory? Actually I just noticed it throws an error if there wasn't a font loaded anyway. You can remove line 10 The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
BobDevries Senior Member Joined: 08/06/2011 Location: AustraliaPosts: 266 |
Hehe, that had you worried. I guess it's just that I prefer a flashing cursor... you can see something's happening? BTW, when I power up my maximite, I have a file AUTORUN.BAS 10 LINE INPUT "Date DD/MM/YYYY -> ",a$ 20 LINE INPUT "Time HH:MM:SS -> ",b$ 30 DATE$=a$:TIME$=b$ When this runs, I get a letter "v" on the screen at the DATE prompt, as if I had typed it. This started with version 2.6B (I didn't load V2.6A). My MM is powered from the USB, but I use a keyboard and VGA screen. Regards, Bob Devries Dalby, QLD, Australia |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
I deliberately did not clear the fonts because I thought that someone might want to load them in autorun.bas for use in a program that might be run later. But that causes even more problems as you have demonstrated. So, unless I can think of a better solution, the next version will clear them on RUN, NEW, etc. Geoff Geoff Graham - http://geoffg.net |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
All good. Certainly programmable characters makes this possible, something I've been calling for since day 1. Now do it for 55 invaders (that's how many there in Space Invaders), make them fire lasers, explode, move a laser base that also fire, barriers that break down, sound effects and scoring and your done! Our simple game of Space Invaders for the Maximite! (Or just load up Space Intruders from Adventure International on the Maximite TRS-80) |
||||
Gadget Regular Member Joined: 22/06/2011 Location: AustraliaPosts: 70 |
damn you beat me to it, I've created the full set of aliens, now to make them shoot, and to be able to shoot them. Terry |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
Nick, who is going to learn anything from that? Terry, mate go for it. I dont have time, too busy planting seeds The game looks pretty basic, there are a few rules that make it easier to program. Like the invading swarm is just an 2d array that increments down the screen. If a alien is shot, the others dont bunch up. The only differenece is if a left or right colum is empty, the remaining colums will more further over before moving down the screen. You can only have one shot in progress at a time. The aliens have many, but I would limit it to 10 to make it easier to track. Should be a fun project. Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
damn you beat me to it, I've created the full set of aliens, now to make them shoot, and to be able to shoot them.Terry You know that the aliens are meant to move in a ripple fashion? Not as a fixed block? Check out this youtube video to see what I mean... http://www.youtube.com/watch?v=437Ld_rKM2s The reason for this is that part of the strategy of Space invaders is to time your shots so that your laser misses the bottom invader and hits the ones above as the invaders 'ripple march' into it sideways. Bonus points can be awarded for this. And don't forget the accelerating hardbeat sound which give Space Invaders it's psychological stimulous as the number of aliens move faster the less of them there are. ...not to talk you out of it or anything! This will be a good test of the Maximite BASIC and see what it's capable of. |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
Nick its really not a hard program to develop. Adding ripple, etc, is just a matter of timing events. Tracking shots is also easy. The Maximite can also produce sound as a background process, so will have little effect on program timing. Yes you could just load up Maximite TRS80 Space invaders, but you could also just give kids at school a calculator instead of teaching them maths. This Space Invader discussion should probably have its own thread, this thread is more about the latest update from Geoff. I just wanted to post the Space Invader code as an example of programmable fonts. Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
Yes. you are correct. This is going off topic. I'll be interested to see what Maximite BASIC can make of it. Going back on topic about the latest update from Geoff. Am I led to believe that the latest update includes a programmable character set? (And regarding the calculator example, many kids do use a calculator in school nowadays... or should that be and ipod with a calculator app?) Not to be taken as someone who doesn't practice what he preaches, check out my site at... http://www.members.optusnet.com.au/nickma/ProjectArchive/int ruders.html (remove the space that this forum is putting in at "int ruders.html") |
||||
Gadget Regular Member Joined: 22/06/2011 Location: AustraliaPosts: 70 |
Would it be hard to implement a method of checking if a font is in use? Terry |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
Not hard, but it would be messy for programmers to use. Probably a better option would be to have some method of making a font hang around. Does anyone need such a feature? EDIT: Also Nick, I am not sure what you mean by a programmable character set but this ability to dynamically load different fonts sounds close. You could even generate the font file from within your program then load it as a new font within to the same program. Geoff Geoff Graham - http://geoffg.net |
||||
Gadget Regular Member Joined: 22/06/2011 Location: AustraliaPosts: 70 |
wouldnt be that hard to use if the ability to determine if a font was loaded then a simple IF statement to check if a font is in use prior to loading a font would prevent mmbasic from throwing an error. Terry |
||||
Page 2 of 4 |
Print this page |