Omnimaga
Calculator Community => TI Calculators => ASM => Topic started by: Xeda112358 on April 06, 2012, 05:21:49 pm
-
When using the Font Hook, you cannot do special things on your own. For example, you cannot use your own drawing routines to speed things up. About a year and a half ago, I introduced an 8x8 font hook in BatLib and this is something I had never seen elsewhere. I had to do some semi-hacky things to display fonts in a custom way as opposed to just changing the data displayed and I figured this might be useful for others to use. Pretty much, if you want to use your own routine to display the font when the OS wants to draw a char, try adding this to the end of your hook:
ld hl,18
add hl,sp
ld sp,hl
pop hl
ld a,l
out (6),a
pop hl
pop ix
pop hl
pop de
pop bc
pop af
ret
I am not sure if that works across all OSes, but I don't have access to them all :/ The main scary part that could cause a crash is the fact that this readjusts the stack. If other OSes makes other calls or pushes/pops, this will likely cause a crash.
I used that to let me draw the fonts directly to the LCD and make sure the OS didn't try to mess that up. Plus, it skips over tons of OS code XD You will need to handle inverted text on your own, though, too. I just check the flag and use CPL on the data if it is supposed to be inverted.
Screenie:
(http://www.omnimaga.org/index.php?action=dlattach;topic=5383.0;attach=5612;image)
As you can see, my actual hook needs help, too, because menus don't work, but the main part is that 8x8 fonts can work XD
EDIT: I have tested some OSes:
1.03 fail
1.10 fail
1.12 fail
1.13 good
1.14 good
1.15 good
1.17 good
1.18 good
1.19 good
2.30 good
2.40 good
2.41 good
2.43 good
2.53 works except in MathPrint, but doesn't crash
2.55 works except in MathPrint, but doesn't crash
-
That's pretty cool, nice handwriting font, but the problem is that you can't see the last 4 columns. You can't wrap around?
-
I played with it for a bit before releasing that version, and one version did wrap text. The issue was that certain menus got really buggy.
-
Do you need to go through the process of selecting the font every time you turn off and turn on the calc? Or does the calc remember it?
-
When you set a font hook, it remains until you run a program that replaces it, disables it, or your RAM gets cleared :)
-
Nice stuff. I wonder if this works with archived fonts?
-
Well, if your font hook does, then yes (the example does use an archived font). The code is just a way to bypass a bunch of the OS stuff when it is returning from the hook :)
-
You say that it may crash in other Oses, so my question is which OS is it tested to work properly in? I remember seeing this when you added it into batlib. I thought it was cool then, and I still think it's really cool now. =)
-
Well, I got an early birthday present from thepenguin77 so I have just now managed to confirm that it wil crash on OS1.03 and I still have to test others. It does work on 2.43 for sure since that is what i tested on before. I am right now working on a good fix, but to be universal will add a bunch of code XD
EDIT:(though that could be related to Bcalls)
-
Well, if your font hook does, then yes (the example does use an archived font). The code is just a way to bypass a bunch of the OS stuff when it is returning from the hook :)
Oh I thought the code itself wasa font hook ???. I'm confused now lol. I guess it doesn't help that I know nothing about ASM...
-
Os 1.03? Do you mean bootcode 1.03? Someone should also test on the MP OSes, and whatever the current OS for the old TI-83+s is. (1.16?)
-
I am going to test those once I fix my broken Wabbit XD
-
I don't think OS 1.03 matters much, considering it cannot run apps, apparently, or can barely run any. As long as it works on OS 1.19, 2.43, 2.53 and 2.55MP I guess it's fine.
-
Yea if you actually meant OS 1.03 that would be like... super old. O_o
-
I think it only came on very few calcs too. Most calcs in the early 83+ days had OS 1.12 I think.
-
Yeah, it was OS 1.03 XD
Also, it does not work on 2.55MP x.x This isn't looking good... At least with the 1.03, the font worked before crashing, but this time the font doesn't even display as changed before crashing.
Nevermind, I forgot to send the fontset :P Now it is just 1.12 and below that fail.
However, it does work on these so far:
OS2.30
OS2.40
OS2.41
OS2.43
EDIT: And 1.19. I will update as I test them.
1.18 good
1.17 good
1.16 good
1.15 good
1.14 good
1.13 good
1.12 Fail
1.10 Fail
1.03 Fail
2.53 Good except mathprint (doesn't crash though)
2.55 Good except mathprint