Board index » delphi » translate assembler code into turbo pascal code

translate assembler code into turbo pascal code

Hi,

I need to write a program only in Turbo Pascal 7.0 or
there's a procedure I know in assembler but I can't find
the translation of 'les' [in this procedure] into Turbo
Pascal 7.0.
The entire procedure is :

procedure setcursor(x,y : integer;cursor : t_cursor);
assembler;
 asm
  mov ax,09h
  mov bx,x
  mov cx,y
  les dx,cursor {the line I'm unable to translate}
  int 33h
 end;

please help me it's quite urgent !

* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful

 

Re:translate assembler code into turbo pascal code


translate assembly into turbo pascal 7 wrote:

Quote
> I need to write a program only in Turbo Pascal 7.0 or
> there's a procedure I know in assembler but I can't find
> the translation of 'les' [in this procedure] into Turbo
> Pascal 7.0.
> The entire procedure is :

> procedure setcursor(x,y : integer;cursor : t_cursor);
> assembler;
>  asm
>   mov ax,09h
>   mov bx,x
>   mov cx,y
>   les dx,cursor {the line I'm unable to translate}
>   int 33h
>  end;

les dx, cursor loads the register combination es:dx with the words
located at the address of the variable cursor. Therefore, "cursor"
is probably a pointer to a structure that defines the shape of the
mouse cursor. es:dx is equivalent to cursor^.

Re:translate assembler code into turbo pascal code


translate assembly into turbo pascal 7 wrote:

Quote

> Hi,

> I need to write a program only in Turbo Pascal 7.0 or
> there's a procedure I know in assembler but I can't find
> the translation of 'les' [in this procedure] into Turbo
> Pascal 7.0.
> The entire procedure is :

> procedure setcursor(x,y : integer;cursor : t_cursor);
> assembler;
>  asm
>   mov ax,09h
>   mov bx,x
>   mov cx,y
>   les dx,cursor {the line I'm unable to translate}
>   int 33h
>  end;

uses dos;

procedure setcursor(x,y : integer;cursor : t_cursor);
var r:registers;
begin
  r.ax:=$09;
  r.bx:=x;
  r.cx:=y;
  r.es:=seg(cursor);
  r.dx:=ofs(cursor);
  intr($33,r);
end;

Michael

--
+-----------------------------------------------------------------+
| Michael Knapp - Mauerbach - Nieder?sterreich - Austria - Europe |
|   Informatik-Student an der TU-Wien - http://www.tuwien.ac.at   |
| E-Mail: mkn...@gmx.at                             ICQ: 36542787 |
+-----------------------------------------------------------------+
|     G r a p h i X  -  Freeware Graphics-Library for Pascal      |
|           http://programmierer.freepage.de/graphix              |
+-----------------------------------------------------------------+

Re:translate assembler code into turbo pascal code


On Sat, 08 Apr 2000 03:21:10 -0700, translate assembly into turbo

Quote
pascal 7 <ben124NObeS...@nsimail.com.invalid> wrote:
> I need to write a program only in Turbo Pascal 7.0 or
> there's a procedure I know in assembler but I can't find
> the translation of 'les' [in this procedure] into Turbo
> Pascal 7.0.

There is no "translation", 'les' is 'les'. Thus the translation is
correct but the parameter type is wrong.

Quote
> The entire procedure is :

> procedure setcursor(x,y : integer;cursor : t_cursor);
> assembler;
>  asm
>   mov ax,09h
>   mov bx,x
>   mov cx,y
>   les dx,cursor {the line I'm unable to translate}
>   int 33h
>  end;

Substitute

        procedure setcursor(x,y : integer;cursor : t_cursor);

by

        procedure setcursor(x,y : integer;var cursor:t_cursor);

Then 'cursor' will have the expected type 'pointer' in BASM.
les,lds,lss etc. apply syntactically to pointers only.

If you absolutely want to declare it as you did you'd have to write

      mov dx, SS
      mov ES, dx
      lea dx, cursor

instead of  les dx, cursor in order to get the _address_ of 'cursor'
into ES:DX.

Regards
Horst

Re:translate assembler code into turbo pascal code


In article <38ef3015.63190...@news.btx.dtag.de>,

Quote
Horst Kraemer <horst.krae...@t-online.de> wrote:
>On Sat, 08 Apr 2000 03:21:10 -0700, translate assembly into turbo
>pascal 7 <ben124NObeS...@nsimail.com.invalid> wrote:

>> I need to write a program only in Turbo Pascal 7.0 or
>> there's a procedure I know in assembler but I can't find
>> the translation of 'les' [in this procedure] into Turbo
>> Pascal 7.0.

>There is no "translation", 'les' is 'les'. Thus the translation is
>correct but the parameter type is wrong.

>> The entire procedure is :

>> procedure setcursor(x,y : integer;cursor : t_cursor);
>> assembler;
>>  asm
>>   mov ax,09h
>>   mov bx,x
>>   mov cx,y
>>   les dx,cursor {the line I'm unable to translate}
>>   int 33h
>>  end;

>Substitute

>    procedure setcursor(x,y : integer;cursor : t_cursor);

>by

>    procedure setcursor(x,y : integer;var cursor:t_cursor);

>Then 'cursor' will have the expected type 'pointer' in BASM.
>les,lds,lss etc. apply syntactically to pointers only.

>If you absolutely want to declare it as you did you'd have to write

>      mov dx, SS
>      mov ES, dx
>      lea dx, cursor

RTFM. Turbo pascal passes complex parameters (with exception of
arrays/records of length exactly 1,2 or 4 bytes) as pointers. In Pascal
procedures the entry code copies the variable to a local variable but in
Assembler procedures that is not done. For ASM procedures there is
little difference between value and variable parameters with complex
types.

Osmo

Re:translate assembler code into turbo pascal code


On 8 Apr 2000 16:22:37 +0300, ronka...@cc.helsinki.fi (Osmo Ronkanen)
wrote:

Quote
> RTFM.

{*word*30} yourself, arrogant {*word*67} I knew the manual by heart before you
were born.

Kindest Regards
Horst

Re:translate assembler code into turbo pascal code


In article <38ef63ab.6636...@news.btx.dtag.de>,

Quote
Horst Kraemer <horst.krae...@t-online.de> wrote:
>On 8 Apr 2000 16:22:37 +0300, ronka...@cc.helsinki.fi (Osmo Ronkanen)
>wrote:

>> RTFM.

>{*word*30} yourself, arrogant {*word*67} I knew the manual by heart before you
>were born.

I just wonder what makes you use such language.

Osmo

Re:translate assembler code into turbo pascal code


Quote
Horst Kraemer wrote:
> {*word*30} yourself, arrogant {*word*67} I knew the manual by heart before you
> were born.

> Kindest Regards
> Horst

?

Ouch, what happens to you?

Alex
--
Author of the free Chatsystem PINO! || Website: http://www.alcomp.net
Available at http://pino.cjb.net    || Chat   : pinochat.dhs.org:8080

Re:translate assembler code into turbo pascal code


Quote
Horst Kraemer wrote:
> On 8 Apr 2000 16:22:37 +0300, ronka...@cc.helsinki.fi (Osmo Ronkanen)
> wrote:

> > RTFM.

> {*word*30} yourself, arrogant {*word*67} I knew the manual by heart before you
> were born.

Why do you use such a language?
RTFM means "read the f'ing manual" because nobody likes to read manuals
and because manuals are often incomplete, not helpful or whatever.
But RTFM does NOT mean "the f'ing user should read his manual".
RTFM does not insult anybody.

Quote
> Date: Sat, 08 Apr 2000 17:03:49 GMT

You live 2h in future!
(should be either "17:03:49 +0200" or "15:03:49 GMT")

Wolf

Re:translate assembler code into turbo pascal code


Quote
Horst Kraemer wrote in message <38ef63ab.6636...@news.btx.dtag.de>...
>On 8 Apr 2000 16:22:37 +0300, ronka...@cc.helsinki.fi (Osmo Ronkanen)
>wrote:

>> RTFM.

>{*word*30} yourself, arrogant {*word*67} I knew the manual by heart before you
>were born.

>Kindest Regards
>Horst

Lieber Horst,

Mir scheint, Deine wste Antwort war ein Fehltritt, der vielleicht
mit einer sofortigen Entschuldigung ein bisschen ausgebgelt
werden kann. RTFM im englischen Sprachraum ist wirklich keine
Beleidigung, bloss ein Ausruf, wie mein Vorg?nger schon bemerkt
hat. Im Zweifelfalle w?re es vermutlich besser, erst mal nachzufragen.
Erst schiessen und dann erst Fragen zu stellen ist nicht immer die
beste L?sung.

KlausL

Re:translate assembler code into turbo pascal code


Quote
KlausL wrote:

> Mir scheint, Deine wste Antwort war ein Fehltritt, der vielleicht
> mit einer sofortigen Entschuldigung ein bisschen ausgebgelt
> werden kann. RTFM im englischen Sprachraum ist wirklich keine
> Beleidigung, bloss ein Ausruf, wie mein Vorg?nger schon bemerkt
> hat. Im Zweifelfalle w?re es vermutlich besser, erst mal nachzufragen.
> Erst schiessen und dann erst Fragen zu stellen ist nicht immer die
> beste L?sung.

> KlausL

Vielleicht? Ein bi?chen?

Klaus!!! DAS was Horst hier geliefert hat, war mehr als eine Frechheit.

Alex
--
Author of the free Chatsystem PINO! || Website: http://www.alcomp.net
Available at http://pino.cjb.net    || Chat   : pinochat.dhs.org:8080

Re:translate assembler code into turbo pascal code


Quote
>> > RTFM.

>> {*word*30} yourself, arrogant {*word*67} I knew the manual by heart before you
>> were born.

>Why do you use such a language?
>RTFM means "read the f'ing manual"

Read the Fine Manual that is ;-)

Re:translate assembler code into turbo pascal code


On Sat, 08 Apr 2000 18:17:16 +0200, Wolf Behrenhoff

Quote
<wolf.behrenh...@gmx.net> wrote:
>Horst Kraemer wrote:

>> On 8 Apr 2000 16:22:37 +0300, ronka...@cc.helsinki.fi (Osmo Ronkanen)
>> wrote:

>> > RTFM.

>> {*word*30} yourself, arrogant {*word*67} I knew the manual by heart before you
>> were born.

>Why do you use such a language?
>RTFM means "read the f'ing manual" because nobody likes to read manuals
>and because manuals are often incomplete, not helpful or whatever.

It isn't normally a comment on the manual. It's a comment on the fact
that the recipient of the epithet should have read the manual. The
f-word is for emphasis. Or it could have been intended in a lighter
spirit... tone of voice would be important here, but unfortunately
such nuances are lost in a newsgroup.

Quote
>But RTFM does NOT mean "the f'ing user should read his manual".
>RTFM does not insult anybody.

It says "you are ignorant". That may not be an insult to a newbie, but
I can't see how it would be anything other than an insult to someone
who has been a respected poster here for a long time.

FP

Re:translate assembler code into turbo pascal code


Quote
Alexander Mueller wrote in message <38F2102E.ADBE5...@gmx.at>...
>KlausL wrote:

>> Mir scheint, Deine wste Antwort war ein Fehltritt, der vielleicht
>> mit einer sofortigen Entschuldigung ein bisschen ausgebgelt
>> werden kann. RTFM im englischen Sprachraum ist wirklich keine
>> Beleidigung, bloss ein Ausruf, wie mein Vorg?nger schon bemerkt
>> hat. Im Zweifelfalle w?re es vermutlich besser, erst mal nachzufragen.
>> Erst schiessen und dann erst Fragen zu stellen ist nicht immer die
>> beste L?sung.

>> KlausL

>Vielleicht? Ein bi?chen?

>Klaus!!! DAS was Horst hier geliefert hat, war mehr als eine Frechheit.

>Alex
>--
>Author of the free Chatsystem PINO! || Website: http://www.alcomp.net
>Available at http://pino.cjb.net    || Chat   : pinochat.dhs.org:8080

Alex,

- Ich nannte Horsts Bemerkung eine wste Antwort, nicht eine Frechheit
- "Vielleicht" und "ein bisschen" beziehen sich auf die Entschuldigung,
  nicht auf Horsts Ausbruch. Osmo akzeptiert "vielleicht" die
Entschuldigung;
  ob er's tut oder nicht ist seine Sache.

Die deutsche Sprache ist in solchen Sachen sehr pr?zis. Lies doch bitte
meine Antwort noch einmal - da sind wirklich keine mildernden Umst?nde
fr Horsts Gefluche drin.

KlausL

Re:translate assembler code into turbo pascal code


Quote
KlausL wrote:

> Alex,

> - Ich nannte Horsts Bemerkung eine wste Antwort, nicht eine Frechheit
> - "Vielleicht" und "ein bisschen" beziehen sich auf die Entschuldigung,
>   nicht auf Horsts Ausbruch. Osmo akzeptiert "vielleicht" die
> Entschuldigung;
>   ob er's tut oder nicht ist seine Sache.

> Die deutsche Sprache ist in solchen Sachen sehr pr?zis. Lies doch bitte
> meine Antwort noch einmal - da sind wirklich keine mildernden Umst?nde
> fr Horsts Gefluche drin.

> KlausL

Hallo Klaus,

stimmt, beim zweiten Durchlesen bemerkte ich, da? das "vielleicht" auf
"ausgebgelt werden kann" gemntzt war. Aber mein "Frechheit" war auch
nicht auf Dein Posting bezogen, sondern ich meinte einfach, "es sei mehr
als eine Frechheit". Allgemein gesprochen.

So, jetzt sollten wir aber wieder in Englisch posten, bevor die
restliche Newsgroup ber uns kommt :).

Alex
--
Author of the free Chatsystem PINO! || Website: http://www.alcomp.net
Available at http://pino.cjb.net    || Chat   : pinochat.dhs.org:8080

Other Threads