I use Masm long time...
today try write for HLA...

damn !!! how can write ASM so eazy....

cool HLA...

:grin: :grin: :grin:
Posted on 2003-05-04 16:13:49 by swang
swang,

HLA is wonderful. I made a promise to myself to learn something new this year and I found HLA through HLA Basic. Wasn't until I read the HLA Basic documentation that I discovered HLA itself.

I'm still trying to understand the differences between Eax, Ebx, Ecx and Edx. Other than being 32-bit registers, I can't say with certainty which one I should be using. I like Eax, personally. But I have no idea what differences Eax has to the other registers. Maybe someone can fill us in on the differences. :)

Regards,

Paul Panks
dunric@yahoo.com
Posted on 2003-05-05 12:36:45 by Paul Panks
Paul Panks

I am a HLA newbie hehe... just try it 2 days
this Asm is very high level

but i just try a small program...
large program i will use MASM too..

I like Masm more :alright:

i will stardy HAL up my class level ... :grin:

HAL is very eazy to write.. nice nice
:grin: :grin: :grin:
Posted on 2003-05-05 13:10:15 by swang
Swang,

Less than a week here. I think I started in late-April. Hopefully by next April I'll be able to write some larger adventure games in HLA. Right now my focus is on learning the different commands and what the assembly equivalents are. I'm also working to become MCSD certified. A lot of reading material this coming week. I think we are going into ASP.NET in the next few weeks. Access hasn't been too difficult, but then again they are starting us with Access 2000 and (I believe) the next version of Access is nearing completion.

Regards,

Paul Panks
dunric@yahoo.com
Posted on 2003-05-05 13:18:10 by Paul Panks
Paul Panks,

OK..

hope your Large Game will come...:grin: :grin: :grin:

if need help funtion !! i will use MASM support you.. hehe....
12 years MASM class

:grin: :grin:


S-Wang
Posted on 2003-05-05 13:45:42 by swang
swang,

Thanks. I'm trying to determine why the value in "r" in my test code keeps going out into orbit. The test code is at:

http://members.tripod.com/~panks/hlaadv.html

The code portion is:


verb1:
mov(r,ebx);
mov(r,eax);
intmul(r,eax);
mov(s,ecx);
add(s,eax);
mov(eax,r);
mov(r,edx);
stdout.put("r is ",edx,nl);
stdout.put("m is ",m,nl);
if((type int32 m)<50) then
mov(m,r);
jmp Room;
endif;
nope:
mov(ebx,r);
console.setOutputAttr( win.fgnd_LightRed | win.bgnd_Black );
stdout.put( "You can't go that way!", nl);
jmp parse;


Any ideas?

Sincerely,

Paul Panks
dunric@yahoo.com
Posted on 2003-05-06 00:14:49 by Paul Panks
Paul Panks

I got it and trying...
low class a HLA newbie to check this code...@@

ps. HLA too like C.. lol


:grin: :cool: :cool:
Posted on 2003-05-06 15:49:58 by swang

swang,

Thanks. I'm trying to determine why the value in "r" in my test code keeps going out into orbit. The test code is at:

http://members.tripod.com/~panks/hlaadv.html

The code portion is:


verb1:
mov(r,ebx);
mov(r,eax);
intmul(r,eax);
mov(s,ecx);
add(s,eax);
mov(eax,r);
mov(r,edx);
stdout.put("r is ",edx,nl);
stdout.put("m is ",m,nl);
if((type int32 m)<50) then
mov(m,r);
jmp Room;
endif;
nope:
mov(ebx,r);
console.setOutputAttr( win.fgnd_LightRed | win.bgnd_Black );
stdout.put( "You can't go that way!", nl);
jmp parse;


Any ideas?

Sincerely,

Paul Panks
dunric@yahoo.com



Well, assuming your array index calculation is somehow correct,
there are a couple of problems here.

1) Array elements in m are four bytes long, but you're using a
single-byte index into the array. Try using m. Otherwise
you'll just store and retrieve garbage in m (probably why you're using
r*r to spread things out, because you've not indexed into m properly).

2) If r does get out of bounds, it picks up garbage beyond the end of m
(or before m, for that matter) and you get garbage squared (literally, in this
case). Easy to believe that r goes crazy.


If you've declared m like this:

m:int32[42,6];

Then *stop* using manual computations.
Do the following code whenever you want to access m:

?array.BoundsChk := true; // Turn on HLA arrays module bounds checking
.
.
.
array.index( edx, m, r, s ); // If r or s is out of bounds, this raises an exception
stdout.put( "m=", m, nl );
if( m < 50 ) then

mov( m, r ); // This will most certainly raise an exception if m in 42..49
// and you wind up executing the above code again. The array
// bounds is 0..41, not 0..49!
jmp room;

endif;

.
.
.

array.index automatically computes the index into a multidimensional
array for you. It leaves a (byte-indexed) pointer sitting in the register
you supply as the first parameter. And if you set the compile-time
variable "arrays.BoundsChk to true, it will even emit code to raise
a bounds check violation if the array indicies are ever out of bound
(which is likely the cause of your problems here). Note that by
setting array.BoundsChk to false, you automatically eliminate all
the array bounds checking code from your program. So you can
turn bounds checking on during testing and remove the excess code
for production versions.
Read more about the array.index macro and other array module functions
at
http://webster.cs.ucr.edu/Page_hla/HLADoc/HTMLDoc/HLAStdlib.html#pgfId-1041617
Cheers,

Randy Hyde
Posted on 2003-05-06 22:35:25 by rhyde
I'm still trying to understand the differences between Eax, Ebx, Ecx and Edx. Other than being 32-bit registers, I can't say with certainty which one I should be using. I like Eax, personally. But I have no idea what differences Eax has to the other registers. Maybe someone can fill us in on the differences.

http://www.asmcommunity.net/board/index.php?topic=11667&highlight=registers
Hope it solve your problem.
Posted on 2003-05-07 03:04:39 by roticv

swang,

HLA is wonderful. I made a promise to myself to learn something new this year and I found HLA through HLA Basic. Wasn't until I read the HLA Basic documentation that I discovered HLA itself.

I'm still trying to understand the differences between Eax, Ebx, Ecx and Edx. Other than being 32-bit registers, I can't say with certainty which one I should be using. I like Eax, personally. But I have no idea what differences Eax has to the other registers. Maybe someone can fill us in on the differences. :)

Regards,

Paul Panks
dunric@yahoo.com

Although each x86 register has its own special purposes, for the most part you'll find that the EAX, EBX, ECX, and EDX registers are mostly equivalent. Certain instructions are more efficient (smaller) when they reference EAX rather than some other register, so I'd prefer EAX over other registers if EAX is available. Another issue is that the Intel ABI (application binary interface) suggests using EAX, ECX, and EDX as temporary registers (that do not have to be preferred across procedure calls), so these are great registers to use for temporary calculations; note, however, that Win32 API calls do not have to preserve these registers. The HLA Standard Library does preserve all registers in each call (unless, of course, the particular function explicitly returns a value in a register).

Traditionally, here's what the x86 registers have been used for:

EAX: used as an "accumulator" to evaluation arithmetic expressions.
EBX: used as a pointer/index register.
ECX: used as a loop counter.
EDX: accumulator extension and I/O.

These "traditional" uses come from the days of the 16-bit versions of the CPU
and don't apply as strongly as they used to, but tradition suggests these uses
for these registers.
Cheers,
Randy Hyde
Posted on 2003-05-07 10:36:19 by rhyde