[A83] Re: Structs in asm


[Prev][Next][Index][Thread]

[A83] Re: Structs in asm




As Mr. Weiss suggested... loading into ix and using an offset is more
efficient if you are planning on ever reading something other than
everything in order of the data... and much more readable:

;struct mytype {
#define foo 0 ;byte
#define bar 1 ;byte
;};

;typedef struct mytype blah;
blah .db 0,0

ld ix, blah
ld a,(ix+bar)
...
ld a,(ix+foo)
...

is much better than inc hl, and then dec hl... and that is on a very simple
a trivial data type.

Btw, jason, the inbetween that muddies programs is called BASIC :)


Scott "Wrath" Dial
wrath@calc.org
ICQ#3608935
Member of TCPA - tcpa.calc.org
PGP key available
----- Original Message -----
From: <Mike3465@aol.com>
To: <assembly-83@lists.ticalc.org>
Sent: Monday, March 19, 2001 2:49 PM
Subject: [A83] Re: Structs in asm


>
> Ok, in defence of the all mighty struct, I use them because they are easy
to
> gather all your data into 1 point(very usefull if you have a fair amount
of
> data that repeats it self(like for your characters)
>
> But also something about classes, to make a class, it would be the same
thing
> as the struct, but you would make local variables equal what ever they
equal
> in the class(I think thats how most c++ functions do it). So in working(if
> they do it that way), classes are a bit slower, though you can make them
be
> nicer i guess, I use structs a bit more then classes really.
>
> Wow...I'm supprised how many people responded ^_^ i just thought it might
be
> a tidbit of wisdom.
>
> Oh, and about the easy way of doing it, I'm just relating what i
*think*(also
> how i'm doing it in my little compiler ^_^) c/c++ compilers handle
structs,
> even though that would be easier, you would need to make different
functions
> for getting any of the data, the way i'm doing it, is you load hl to the
> struct, then incrment hl how ever many times that you need it.
>





Follow-Ups: References: