News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_SkulleateR

Displaying "readable" text in mode 0

Started by SkulleateR, 20:03, 30 August 19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SkulleateR

Hi guys  :D


So I finally received my M4 and after putting all those software on it and getting my old disks usable again without worrying about using them, I thought I take some of my old unfinished Basic Projects and .... well .... finish them  :laugh:


So on an old disk I found a kind of strategy game I began to write back in the 80s.


I do now nearly nothing about asm and so I code in basic.


Main screen is some kind of stellar map with some planets and stars and a spaceship. There you have to explore Planets, destroy pirate ships and so on ...


Problem is : I wrote the game back then in mode 1 with text as objects like "X" for a spaceship and "O" for a planet and so on  ;)


So I took the source and converted all to mode 0 to use some nice (well, kinda nice for my purpose) graphics but I have problem now. Some things that happen has to be displayed using text messages, but well as you now, mode 0 is kinda useless here (writing one sentence and the screen is filled)


Does anyone has a clever idea to deal with this, maybe a clever routine for displaying some amount of text in "readable" format on a mode 0 screen ?

AMSDOS

I created a short demo here which redefines the character set 230 to 255 to make a condensed Alphabet set which would give you 40x25 in MODE 0.
The problem I had in order to place the characters onscreen, I have to graphically place them onscreen and the Demo for which I made in that example won't be suitable for your purposes.
You would need some formulas which calculate the xpos and ypos positions based on the MODE 1 cursor position which will look something like this:


xp=(x-1)*16 and;
yp=398-((y-1)*16)


with x & y containing the text xpos & ypos positions normally set from LOCATE.


Then it's just a matter of writing a routine to PRINT the text, in my example I wanted to retain the Amstrads standard character set 65 to 90, which is why I pointed my new set to 230, writing something to PRINT the text may look like this:



1000 FOR p=1 TO LEN(a$)
1010   MOVE (x-1)*16,398-((y-1)*16)
1020   TAG
1030   v=ASC(MID$(a$,p,1))
1040   IF v<>32 THEN PRINT CHR$(v+165);
1050   x=x+1
1060 NEXT p
1070 RETURN



Modifying my earlier demo, I changed lines 1 & 2 to read:



1 DEFINT a-z:SYMBOL AFTER 230:DIM o(8,26):GOSUB 9
2 MODE 0:a$="HELLO WORLD":x=15:y=10:GOSUB 1000:END



Unfortunately it's not as fast as printing actual Text Onscreen due to the calculations which have to take place, but I hope it gives you understanding of the process.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Fessor


SkulleateR

@AMSDOS


Thx, will have a look as soon as I got some spare time again, speed should not be an issue since this will be no fast paced action shooter or something like that  :P


@Fessor


Don´t think this could be a solution since it will mess up on Mode 0 from what I read ?

Fessor

Try the listing of the second post. ;)
It sets the graphics to mode 0 but leaves the text-printing like mode 1, with 40x25 chars, but the chardefinitons are now storing mode-0-bitmasks.

TotO

I remember to type a program like this from a 80's french magazine (Amstrad Cent Pour Cent?). It was really great.
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

SkulleateR

Quote from: Fessor on 19:28, 31 August 19
Try the listing of the second post. ;)


Ok, tried and that really does the trick, now I only have to adjust colours so I can use my simple sprites again, looking kinda weird now  :laugh:


Best thing is I can use normal text printing without using graphics coordinates for that. I can now define a text window to display status things ... thanks a lot (also to @Devilmarkus for this routine)


SkulleateR

If anyone is curious how it looks to mix mode 0 and 1 and multicolour text in Basic ... here it is  :D


Quite happy with the result, but it´s hell of a work to convert 30 year old code and give it some graphics into it  :laugh:


TotO

Nice, but... Where is MODE 1?  ;D 
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

ZbyniuR

Other exemples how to use narrow fonts 4x8 pixel in 4 colors, are here:
http://www.cpcwiki.eu/forum/programming/basic-programming-tips/msg117620/#msg117620

Explanation is little bit higher in post 58 on the same page, and other interesting use, as pointer sprite in post 53, and walking Lemmings in post 67. DSKs are under posts. :)

I'm late, but maybe someone will be inspired. :)
In STARS, TREK is better than WARS.

Powered by SMFPacks Menu Editor Mod