05-31-2010, 04:16 PM
FreeBasic Types (like your syntax) will be supported in the future. But there several things to keep in mind. E.g. How to implement them in asm, and how to change the compiler to allow them (many changes). So this won't be available in the short term.
Also, I would like you to time against print. PRINT is slow because it relays on strings which are a little slower.
You might want to call internal __PRINT_CHAR routine (at the internal PRINT routine). The difference in time shouldn't be too much.
If you wan't your routine to draw at a different screen location, use the global internal label (SCREEN_ADDRESS), which defaults to 16384 as expected.
na_th_an Wrote:Then I guess you my manage your self with SetATTR, don't you? So lets try a simple putchar:boriel Wrote:na_th_an Wrote:3.- Less important, but may come handy, the ability use Attr as a modifier for Print which combines Ink, Bright, Paper, and Flash in a single command:You can get this with a simple POKE 23695,t (ATTR_T <!-- m --><a class="postlink" href="http://www.wearmouth.demon.co.uk/sys/attr_t.htm">http://www.wearmouth.demon.co.uk/sys/attr_t.htm</a><!-- m -->). ZX BASIC could in the future optimize this, if numeric values are given in a sequence of attributes. E.g. PAPER 7; INK 1; BRIGHT 1; FLASH 0.... could be compiled in a single poke. There's also a function defined in attr.bas library, called SetATTR(x, y, ATTR) which you might find useful.
That's what I'm using (I reinvented the wheel creating my own SetATTR). I didn't know about the systems var thing. But still, it requires two commands to do such a simple task. The "SetATTR" solution also makes noticeable the separation between the printing and the colour setting.
Code:
Sub FASTCALL PutChar(x as Ubyte, y as Ubyte, c as uByte)
Asm
; x comes in A register (FastCall)
; y and charCode
pop hl ; Return Address
pop de ; get Y in D register
ex (sp), hl ; => get c in H register and push return address back
; At this point you have X in a; Y in D; an C in H. Now proceed as you want.
; This routine is fascalled => you can simply RET at any point.
End Asm
End SuB
Also, I would like you to time against print. PRINT is slow because it relays on strings which are a little slower.
You might want to call internal __PRINT_CHAR routine (at the internal PRINT routine). The difference in time shouldn't be too much.
If you wan't your routine to draw at a different screen location, use the global internal label (SCREEN_ADDRESS), which defaults to 16384 as expected.
na_th_an Wrote:5.- Allow comments in broken lines, such as this:Then I misunderstood you. Anyway, this feature will be available soon too (along with the block comment), since it's a standard one.
As LCD pointed out, It's not /'...'/, but the ability of use single comments in broken lines.Code:Dim myLevel(2) as uByte => { _
0, _ ' Number of exists
10, _ ' Baddies life gauge
7 _ ' Water level
}
Quote:I'm writing all this 'cause I'm currently writing my second game using this compiler, and such features (specially the user defined types and a fast putchar) will make the games writing chores to be quite a walk in the parkThen try LCD's routine which uses a similar aproximation. You can also use my template SUB function to put the inline assembler there.