News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Morri

Machine code half size font routine

Started by Morri, 03:29, 20 January 15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Morri

Hi,
Currently doing a little basic programming and wondering if anyone has or knows of a machine code routine which can be poked into memory for a halfsize font.
I found a machine code double height routine in AA15 which would be perfect if changed to be the halfsize.
Once poked into memory (relocatable) you simply typed:
a$="Text here":call &8000,@a$

I already have the usual SYMBOL AFTER stuff and loading in a .fnt file. But this way suits my needs a lot more and I was wondering if anyone had already done something similar.


Keeping it Kiwi since 1977

AMSDOS

Quote from: Morri on 03:29, 20 January 15
Hi,
Currently doing a little basic programming and wondering if anyone has or knows of a machine code routine which can be poked into memory for a halfsize font.
I found a machine code double height routine in AA15 which would be perfect if changed to be the halfsize.
Once poked into memory (relocatable) you simply typed:
a$="Text here":call &8000,@a$

I already have the usual SYMBOL AFTER stuff and loading in a .fnt file. But this way suits my needs a lot more and I was wondering if anyone had already done something similar.


It looks like all RpM has done is taken the BASIC Double Height Program by Leighton Derrick and converted it to Machine Code.


The only M/C based thing I know of, which allows you to play around with the Character Set is "Maxi-RAM" from AA59. It states it's 464 Only, this is because it's using 464 Direct Addressing, it should be easy enough to use the Firmware Manual to substitute with 6128 Addresses, but you might need a routine to detect what the computer is and use the correct address.  One of the RSXs in that program gives Thin characters, but it can do Bold as well as Italics. I haven't used the program in ages, and it looks like you can only do each character one at a time.
* 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

andycadley

Doesn't sound like it would be too difficult to write. How does it need to work in terms of character positioning etc? I'd imagine that's easier in a double height routine because it never needs to be smaller than normal character positioning, but not insurmountable as long as you just bypass the BASIC commands like LOCATE and use either a separate M/C call or one that includes the start position in the call.

Morri

#3
It doesn't need to be a complicated routine. I was hoping for a print string in halfsize font with correct spacing at specified location. No colour effects etc...
I am in the early stages of coding a BASIC game which will have mode 1 graphics but only if possible, I was hoping to have a half size font so I can fit more text in the available window (2 lines).
I don't mind if it is a locate...call or call ,parameters as long as I still have the option of using the normal char set, same as the double height routine I mentioned earlier.
Keeping it Kiwi since 1977

andycadley

Well it won't likely be before the weekend, but if nobody's suggested anything better I'll see what I can knock up.  :)

EgoTrip

#5
You could always redefine the second half of the font to your half size font, then draw the characters using TAG. But I guess this might not be quick enough for you which is why you want machine code.

Maybe something along the lines of getting the LEN of a variable, then doing a FOR loop using it, using MID$ to get the current character, VAL it into an integer, adding 128 to it to get the correct letter, then advancing the graphics cursor to PRINT it with TAG (dont forget the ; after the CHR$(x); command). Then it loops back to the next character until the string is printed. Sorry I don't have time right now to do a listing and test it. You could simply GOSUB this routine after putting your string in a$ or whatever.

Morri

Quote from: andycadley on 00:41, 21 January 15
Well it won't likely be before the weekend, but if nobody's suggested anything better I'll see what I can knock up.  :)
Thank you for your offer. Please do not rush on my account. I have plenty of code ahead of me before I'm even close to presenting anything and I don't mean to be a pain.

Quote from: EgoTrip on 00:50, 21 January 15
You could always redefine the second half of the font to your half size font, then draw the characters using TAG. But I guess this might not be quick enough for you which is why you want machine code.

Maybe something along the lines of getting the LEN of a variable, then doing a FOR loop using it, using MID$ to get the current character, VAL it into an integer, adding 128 to it to get the correct letter, then advancing the graphics cursor to PRINT it with TAG (dont forget the ; after the CHR$(x); command). Then it loops back to the next character until the string is printed. Sorry I don't have time right now to do a listing and test it. You could simply GOSUB this routine after putting your string in a$ or whatever.
Yes, this is similar to the method I have used in previous games and yes, I am looking for a machine code routine more for speed, as well as avoiding using SYMBOL AFTER and having to work around memory issues. Just for interests sake, I might list the different type-ins I have found in various mags and what I came up with using a .fnt file from OCP art studio.
Keeping it Kiwi since 1977

AMSDOS

Just to clarify when you say Half Size Font your not after something between 3 or 4 pt because that would be unreadable.


The Maxi-RAM program I mentioned can produce Thin characters if that's what you're after and I can easily extract the relevant RSX routine. It seems to use a couple of other RSX routines with it though, so I'll have to extract those too, but shouldn't be a problem.

* 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

Morri

Quote from: AMSDOS on 07:44, 21 January 15
Just to clarify when you say Half Size Font your not after something between 3 or 4 pt because that would be unreadable.

The Maxi-RAM program I mentioned can produce Thin characters if that's what you're after and I can easily extract the relevant RSX routine. It seems to use a couple of other RSX routines with it though, so I'll have to extract those too, but shouldn't be a problem.
I was initially thinking 3 - 4 pt. While it's not perfect it is still readable in mode 1 with the exceptions of M and W. I was then thinking something like the Symbos font in mode 1 which looks like it's around 4 - 5 pixels depending on the letter. Is the thin font you mentioned something like this? My goal was to be able to write more letters per line than the usual 40 characters in mode 1 so even if it's 50 - 60 that would still be OK.
Keeping it Kiwi since 1977

AMSDOS

Quote from: Morri on 10:22, 21 January 15
I was initially thinking 3 - 4 pt. While it's not perfect it is still readable in mode 1 with the exceptions of M and W. I was then thinking something like the Symbos font in mode 1 which looks like it's around 4 - 5 pixels depending on the letter. Is the thin font you mentioned something like this? My goal was to be able to write more letters per line than the usual 40 characters in mode 1 so even if it's 50 - 60 that would still be OK.


The Thin Font in the program I mentioned only really Thins the character set, I don't recall it reducing the size of it. I've only seen it being done when the Symbol Table has been redefined.
* 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

Morri

Quote from: AMSDOS on 10:32, 21 January 15

The Thin Font in the program I mentioned only really Thins the character set, I don't recall it reducing the size of it. I've only seen it being done when the Symbol Table has been redefined.
Hmm, as I feared. The thing which got me to ask in the first place is I can't seem to get around the memory full problems using SYMBOL AFTER. I play around with memory often and I can't get it right. I was hoping a machine code routine might help fix this problem.
Any other suggestions are welcome. I have tried the usual SYMBOL AFTER 256:MEMORY ... but I keep getting improper argument or memory full.
Keeping it Kiwi since 1977

AMSDOS

Quote from: Morri on 10:56, 21 January 15
Hmm, as I feared. The thing which got me to ask in the first place is I can't seem to get around the memory full problems using SYMBOL AFTER. I play around with memory often and I can't get it right. I was hoping a machine code routine might help fix this problem.
Any other suggestions are welcome. I have tried the usual SYMBOL AFTER 256:MEMORY ... but I keep getting improper argument or memory full.


In assembly I've used the cheaters approach to initialise the Character Set with this for example:



org &8000


ld de,65
ld hl,table
call &bbab
ret


.table defb 0



You call that and the Character set is placed into ".table", whatever the address is for ".table" I make another file to load over the contents of Table which gives me the character set I need. In Assembly it can be done like this:



org table


defb 4,14,10,10,14,10,10
defb 12,010,10,12,10,10,12
defb 4,10,8,8,8,10,4
defb 12,10,10,10,10,10,12


;; and so on.



In the case of TXT M SET TABLE (&BBAB) - you can specify where you want the table to be in the 32k core memory, which gives you more control over a SYMBOL AFTER situation and having to worry about MEMORY.
* 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

Powered by SMFPacks Menu Editor Mod