Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:27 24 Nov 2024 Privacy Policy
Jump to

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: Australia
Posts: 266
Posted: 10:09pm 22 Sep 2011
Copy link to clipboard 
Print this post

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: Australia
Posts: 5078
Posted: 10:19pm 22 Sep 2011
Copy link to clipboard 
Print this post

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: Australia
Posts: 3194
Posted: 10:22pm 22 Sep 2011
Copy link to clipboard 
Print this post

  BobDevries said  If I type:
FONT #3,2,1
PRINT "0123"

I get normal characters on the screen. I should be able to do this from the command prompt, right?

Hmmm, apparently you CAN NOT use this from the prompt? Just tried it inside a short program and it works fine.


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"

  BobDevries said  BTW, the cursor stops flashing after I use the FONT command (in a programme)

I don't understand, the video cursor has never flashed !

Geoff


Geoff Graham - http://geoffg.net
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 10:27pm 22 Sep 2011
Copy link to clipboard 
Print this post

  TassyJim said   Using the USB port, the command prompt is preceded by a space and a backspace.

Thanks, another bug. I will fix it in the next version.

Geoff
Geoff Graham - http://geoffg.net
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 10:38pm 22 Sep 2011
Copy link to clipboard 
Print this post

  BobDevries said   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,


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: Australia
Posts: 5078
Posted: 10:55pm 22 Sep 2011
Copy link to clipboard 
Print this post

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: Australia
Posts: 512
Posted: 11:23pm 22 Sep 2011
Copy link to clipboard 
Print this post

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: Australia
Posts: 5078
Posted: 12:14am 23 Sep 2011
Copy link to clipboard 
Print this post

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: Australia
Posts: 5078
Posted: 12:17am 23 Sep 2011
Copy link to clipboard 
Print this post

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 10Edited by Gizmo 2011-09-24
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: Australia
Posts: 266
Posted: 12:26am 23 Sep 2011
Copy link to clipboard 
Print this post

  Geoffg said  
I don't understand, the video cursor has never flashed !

Geoff



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: Australia
Posts: 3194
Posted: 12:59am 23 Sep 2011
Copy link to clipboard 
Print this post

  Gizmo said   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?

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: Australia
Posts: 512
Posted: 01:16am 23 Sep 2011
Copy link to clipboard 
Print this post

  Gizmo said   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.Glenn


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: Australia
Posts: 70
Posted: 01:20am 23 Sep 2011
Copy link to clipboard 
Print this post

  Gizmo said   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.


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: Australia
Posts: 5078
Posted: 01:35am 23 Sep 2011
Copy link to clipboard 
Print this post

  Nick said  
(Or just load up Space Intruders from Adventure International on the Maximite TRS-80)


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: Australia
Posts: 512
Posted: 01:36am 23 Sep 2011
Copy link to clipboard 
Print this post

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.

Edited by Nick 2011-09-24
 
Gizmo

Admin Group

Joined: 05/06/2004
Location: Australia
Posts: 5078
Posted: 01:47am 23 Sep 2011
Copy link to clipboard 
Print this post

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: Australia
Posts: 512
Posted: 01:56am 23 Sep 2011
Copy link to clipboard 
Print this post

  Gizmo said   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


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")

Edited by Nick 2011-09-24
 
Gadget
Regular Member

Joined: 22/06/2011
Location: Australia
Posts: 70
Posted: 05:42am 23 Sep 2011
Copy link to clipboard 
Print this post

  Geoffg said  
  Gizmo said   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?

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


Would it be hard to implement a method of checking if a font is in use?

Terry
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 06:02am 23 Sep 2011
Copy link to clipboard 
Print this post

  Gadget said  Would it be hard to implement a method of checking if a font is in use?

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.

GeoffEdited by Geoffg 2011-09-24
Geoff Graham - http://geoffg.net
 
Gadget
Regular Member

Joined: 22/06/2011
Location: Australia
Posts: 70
Posted: 06:56am 23 Sep 2011
Copy link to clipboard 
Print this post

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
© JAQ Software 2024