• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 371
  • Last Modified:

sds & longint in asm-code

how can i use some longint-variables in my asm-code ?

need help
columbo666

btw:does anybody know, where i can download sds (sound deluxe system) ? i think the actual version number is around 5.
0
columbo666
Asked:
columbo666
  • 3
  • 2
1 Solution
 
HypoCommented:
To use longint variables in your asm code you need to use 32-bit registers.

32Bit registers are not supported by the pascal compiler (BP 7.x) since 32Bit registers were first introduced by the 80386 and BP 7.x only supports the 80286 assembler instruction set.

Anyway, it's not impossible to use 32bit registers & longint variables in your code. I answered a question similar to this a couple of months ago:
http://www.experts-exchange.com/jsp/qShow.jsp?ta=pascal&qid=10168326 

There's an example below here... it shows you how you can put override prefixes before the 16bit instructions so that they become 32Bit instructions.

Program test;

var T : longint;

Procedure TestA(L : longint; var D : longint); assembler;
asm
 DB $66; MOV AX,word [L] {EAX := L}
 LES DI,D
 DB $66; MOV ES:[DI],AX  {D := EAX}
end;

Procedure TestB(La,Lb : longint; var D : longint); assembler;
asm
 DB $66; MOV AX,word [La] {EAX := La}
 DB $66; MOV BX,word [Lb] {EBX := Lb}
 DB $66; ADD AX,BX        {EAX := EAX+EBX}
 LES DI,D
 DB $66; MOV ES:[DI],AX   {D := EAX}
end;

begin
 T := 1;
 writeln(T);
 TestA(1000,T);
 writeln(T);
 TestB(100,100,T);
 writeln(T);
end.
0
 
columbo666Author Commented:
i leave this question open for some time, 'cause i think, your answer can help other people too. answer is good !

greets
columbo666
0
 
HypoCommented:
ok
0
 
columbo666Author Commented:
thank you very much hypo. btw:what are you doing ? which laguage(s) are you using ?

greets & thanxs from
columbo666
0
 
HypoCommented:
:) I like to share my knowledge every now and then.

Right now I'm working on an online  game project with a couple of guys.
We're using VC++ for that one. Other than that I'm using these languages when I programm:

*Assembler
Pascal (my first real language)
Delphi
C++
some Java/HTML

I'm working on learning, SQL programming and CGI scripts too. I figure there might be some money to make there.

anyway: Thx for the points! ;)
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now