Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Proportional pixel-precise printing anywhere on screen
#4
LCD Wrote:No, don't dump your code, post it here. This one has 1,5 KB after compilation, so yours is maybe shorter. Please publish it. And we don't have a 64 char/line routine here yet (I ripped the one from tasword II, but it allows only to put text on screen thirds).
If you want to leave a pixel gap between characters, you can change xgap value to from 0 to 1. I wanted just to demonstrate how condensed it can print.
You are right, Your method of poking the values save bytes and time, but at least time is not so important here because this will be done once per line, so we cannot save much time, But thank you for the tip, it will be useful in other programs.
Self modyfing code is dangerous with code optimiser. I made a SUB to put a graphics block on screen, using self modyfing ASM code, but the first version was screwed by the optimiser until I found the reason. The result was a crash of the emulator.
We cannot write this:
Code:
LD HL,0
LD DE,0
LD BC,0
LDIR
to modity it later, because optimiser turns it into:
Code:
LD HL,0
LD D,H
LD E,L
LD BC,0
LDIR
A compiler directive, #pragma or $something will be created in the future, to mark "non-optimizable" regions.
A workaround for this is:
Code:
ASM
DB 21h, 00, 00 ; LD HL, 0
DB 11h, 00, 00 ; LD DE, 0
DB 01h, 00, 00 ; LD BC, 0
LDIR
This could work (the compiler do not optimize DB values), but have not tried it.
Another possibility is disabling optimization for user ASM blocks.

LCD Wrote:Which is a bit faster and smaller, but trying to modify the old code will break it.
I wonder why LD BC is not turned into LD B,H:LD C,L too, maybe the compiler does not expect a third equal Register assignation.
It doesn't, but will try to implement it. :wink:
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)