05-31-2010, 02:57 PM
boriel Wrote:na_th_an Wrote:This is somewhat a wish list to which I may contribute (coding my second suggestion).By Types you mean used defined types, don't you? ZX BASIC have types (UByte, Byte, Float....), but user-defined types are not allowed (yet).
1.- Types. I'm a nightmare, I keep repeating this, but types are most needed. They would make every coding chore way easier, specially when you have to pass parameters or create arrays of structured data. Game coding can be pretty messing without the ability to create proper data structures.
Of course, I meant user defined types. I used just "types" to name them 'cause I'm so used to my old times when I was pretty active at QB/fB forums, and people used "types" to name user defined types (structures) 'cause you sed the keyword Type to define them:
Code:
Type myType
x As Integer
y As Integer
End Type
boriel Wrote:na_th_an Wrote:2.- A nice, fast, simple, hassle-less Putchar (x, y, attr, ascii) function which draws character ascii with attributes attr at coordinates (x, y).Why don't you use PRINT AT x,y; a$?
Because it's slow and means too much of a hassle when I just want to print a coloured char. I don't need everything "Print" has. I just want, as LCD suggested, to write 9 bytes to the screen RAM.
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 funcion 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.
boriel Wrote:na_th_an Wrote:5.- Allow comments in broken lines, such as this:I definitely agree with this. I was thinking in using the C commenting scheme /* ... */, but FreeBasic uses /' ... '/ scheme instead. So better stick to it for the sake of compatibility. If everybody agrees, I could enable just this evening :!:
Code:Dim myLevel(2) as uByte => { _
0, _ ' Number of exists
10, _ ' Baddies life gauge
7 _ ' Water level
}
As LCD pointed out, It's not /'...'/, but the ability of use single comments in broken lines.
@LCD: thanks, that's what I meant. My plan is writing my own in assembly for extra speed, but my problem is that I don't know how to interface BASIC and ASM using ZXBasic, and using pokes to transfer BASIC variables into ASM variables kills the purpose of writing such a routine. Anyway, your routine is indeed faster than the Print At + Poke combination, so I'll be using it. Thanks :-)
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 park
