Solved

How access 286 extended registers via Turbo Pascal 6.5 Inlines?

Posted on 2000-03-26
11
369 Views
Last Modified: 2008-03-10
Anyone left who still uses the Turbo Pascal 6.5 compiler? I need some inline code to move the 286+ extended Registers into some kind of variable ...

Anyone who can help?

Armin.Linder@Adlon.de
0
Comment
Question by:arminl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 12

Expert Comment

by:Hypo
ID: 2658750
Hello,
I'm not familiar with the Turbo Pascal 6.5 compiler, though I'm very used to assembler programming in BP 7.

I'm not sure if it is the EAX,EBX,ECX,EDX etc. registers you are speaking of... though if you are, I'm sure I can help you!

regards Hypo.
0
 
LVL 48

Expert Comment

by:dbrunton
ID: 2660169
Surely you mean the 386 chip?
0
 
LVL 1

Expert Comment

by:nrico
ID: 2660247
You can't just use the register name EAX under the inline assembler. Instead, I believe you do to move 0 into EAX:

  DB $60; MOV AX,0

but I could be wrong.

And yep, those registers, and FS and GS are 386+.
0
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 
LVL 5

Expert Comment

by:scrapdog
ID: 2661852
EAX,EBX,ECX,EDX are not available in the 286...but I think that the 286 had some extra registers for protected mode...
0
 
LVL 12

Expert Comment

by:Hypo
ID: 2661915
True, EAX,EBX,ECX,EDX... which is the 32bit versions of AX,BX,CX,DX... was first introduced with the 80386CPU.

Also "DB $60; MOV AX,0" will most probably crash your computer or generate an illegal oppcode exception.

The correct oppcode should be (in this case) "DB $66; MOV AX,0; DW 0"

The preceeding byte you should put infront of _MOST_ 16bit register instructions to make them 32bit reg. instructions are 66h.

Here's an old question about 32bit instructions in pascal:
   http://www.experts-exchange.com/jsp/qShow.jsp?ta=pascal&qid=10168326


Yet, I still don't know if these are the extended registers you want to use... Could you please reply?
0
 
LVL 4

Author Comment

by:arminl
ID: 2669188
Hello Turbo veterans,

it's good news that there are still some left out there ...

I mean the extended registers of the 386+, of course.

What I need to do is move the contents of EAX into a variable.

Armin.Linder@Adlon.de
0
 
LVL 12

Accepted Solution

by:
Hypo earned 200 total points
ID: 2670246
Hi, I'm not sure if this works with Turbo Pascal 6.5 (since I have 7.0)
But try my example.

What you need to do is put DB $66; infront of the instruction "MOV AnyVar,AX"
If "AnyVar" is of type longint, you have to make the compiler beleive that it is a 16bit variable, that's done by putting, "word ptr" infront of the variable name (see example).

The example simulates a "MOV AnyVar,AX" and then converts it to "MOV AnyVar,EAX" by putting "db $66" as a prefix to the instruction.

Program RegIntoVar;
uses crt;

var A,B : longint;

begin
 A := 123456789;
 B := 0;
 asm
  DB $66; MOV AX,word ptr A { Move A into EAX }
  DB $66; MOV word ptr B,AX { Move EAX into B }
 end;
 Writeln(B);
end.

Is it clear?
0
 
LVL 12

Expert Comment

by:Hypo
ID: 2683838
yo! did it work?
0
 
LVL 12

Expert Comment

by:Hypo
ID: 2697609
Always the same thing...
0
 
LVL 4

Author Comment

by:arminl
ID: 2699424
Hi Hypo,

thanks for your response. unfortunately I am busy with another project right now and won't be able to check that out for the next 2 weeks.

I do, however, assume that this is exactly what I was looking for, and that it will work like intended.

Thanks for your help, and beg your pardon for beeing silent so long (have no regular access to my e-mails right now as well).

....Armin
0
 
LVL 12

Expert Comment

by:Hypo
ID: 2700155
oh... tha's ok,
I thought you'd just left it to autograde... (tha's happend me before)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
WSAAdressToString example Delphi code needed 3 1,803
Using IdHTTP1.Get with Delphi and Indy 9/10 on a specific web server returns exception 3 2,638
delphi 8 625
interacting with web form 4 154
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
The goal of this blog is to: > note what has impeded us from reaching effective life on-call > provide 3 steps to mastering life on-call > highlight what will be achieved with effective life on-call
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question