Solved

if i need in assembler to use bigger varibles than the maximum i know

Posted on 1997-11-02
6
305 Views
Last Modified: 2010-04-16
I KNOW THAT THE BIG REGISTER/VARIBLE THAT I CAN USE IN MY ASSEMBLER PROGRAMS IS 0FFFFH BUT IF I WNAT TO USE A BIGGER
REGISTER/VARIBLE IN ASSEMBLER WHAT I NEED??
 AND HOW CAN I PRINT ON THE SCREEN THE NUMBERS THAT IN THE REGISTERS??
SEND ME AN EXAMPLE!!
0
Comment
Question by:noam
[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
6 Comments
 
LVL 1

Expert Comment

by:Odie
ID: 1216423
For bigger registers variables you can
1 * Upgrade to 32-bit
2 * Split 2 16-bit vars up

like

mov ax, word ptr [xxxx]  // addr of first 32-bit var
mov bx, word ptr [xxxx + 2]
add ax, word ptr [yyyy] // addr of second 32-bit var
adc bx, word ptr [yyyy + 2]
mov word ptr [zzzz], ax // addr of third 32 -bit var
mov word ptr [zzzz + 2], bx

adds var at xxxx to yyyy and writes the result to zzzz
you can have similar code for substracting, xoring, ...

0
 
LVL 1

Expert Comment

by:FuzzyLogic
ID: 1216424
Odie is right.
However, it is possible to write 32bit code under TP by using inline assembler.
If you want to make some calculation over big numbers, you can also use the FPU even if the numbers are integer.
0
 
LVL 1

Expert Comment

by:Odie
ID: 1216425
That's true and multiplying on a Pentium in Floating Point can be faster.

If you want I can give you instructions on that too.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Accepted Solution

by:
fozy earned 0 total points
ID: 1216426
For Printing  the content from a registry try assigning to a variable the content of the register
xc:=dx
and dx is declared as byte
ten print the variable.
If not convinced try to dl a program called XRAY who makes a tracing off line the program possible.
0
 
LVL 1

Expert Comment

by:Odie
ID: 1216427
If you want to use the Floating Point Unit:

It has 8 registers which are "stacked" - that means you can't access whatever register you like, but only the topmost.

Ex.: Add 64-bit int A at address xxxx to 64-bit int B at address yyyy
     and write it to 64-bit int C at address zzzz

fild QWord Ptr [xxxx] // Float Integer LoaD: A loaded to Register 0
                      // Reg0: A, Reg1: Empty, Reg2: Empty, ...
fild QWord Ptr [yyyy] // Float Integer LoaD: B loaded to Register 0
                      // A moved to register 1 (stack)
                      // Reg0: B, Reg1: A, Reg2: Empty, Reg3: Empty, ...    
faddp ST(1), ST // Add Reg1 (= ST(1)) (B) to Reg0 (= ST(0) or ST) (A)
                // Reg0: A + B, Reg1: Empty, Reg2: Empty, ...
                // the p means the source reg is emptied
fistp QWord Ptr [zzzz] // the contents of the topmost register (ST) or written to zzzz
    // Float Integere STore
    // Reg0: Empty, Reg1: Empty, Reg2: Empty, ...
    // if the p is left out Reg0 (ST) would still be A + B

Some other usefull instructions:
fmul(p) // Multiplying
fsub(p) // Substraction
fdiv(p) // Division
fld1 // Load a 1
fxch // exchanges the contents of two registers

You can of course also work with real floating point values (doubles, long doubles, ...) or 32-bit integers

For a complete reference search Intel's Literature Centre.
0
 

Expert Comment

by:Thefly
ID: 1216428
You can use my routine to write the content of a 32 bit variable, put the desired value in mem (mov eax,1234h    mov mem,eax    call affiche), the affisub sub routine is not included but is easy to make using Bios or Direct memory write.
affiche:
      pusha
      mov flag,0
      mov cx,10
      reset:
      mov bx,cx
      dec bx
      mov number+bx,0
      loop reset
      mov eax,0
      mov ebx,0
      mov ecx,0
      mov edx,0
      mov eax,mem
      cmp mem,0
      je zero
      mov tempo,1000000000
      mov cx,10
      calculus:
      mov bx,cx
      neg bx
      add bx,10
      push bx
      push cx
      mov edx,tempo
      jump:
      cmp eax,edx
      jb finished
      mov flag,edx
      add edx,tempo
      inc number+bx
      jmp jump
      finished:
      sub eax,flag
      mov flag,0
      finit
      fild tempo
      fild cons
      fdiv
      fist tempo
      pop cx
      pop bx
      loop calculus
      mov flag,0
      mov cx,10
      display:
      mov bx,cx
      neg bx
      add bx,10
      mov dl,number+bx
      mov dh,0
      mov eax,flag
      cmp eax,1
      je noend
      cmp dx,0
      je dispend
      noend:
      call affisub
      mov flag,1
      dispend:
      loop display
      jmp nozero
      zero:
      mov dl,"0"
      call affi1
      nozero:
        mov flag,0
      popa
      ret


0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to resolve an IP Address to a host name 6 1,707
How to send email in delphi with image 4 595
Client Data Set - Wide Memo 6 1,782
Delphi: Read a array of strings in a OleVariant 4 1,252
Read our guide on how to survive being on-call.
In order to fulfill our mission of inspiring learning in the technology community, Experts Exchange is launching a Course of the Month program. Premium and Team Account members will have access to one course per month as a part of their membership, …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

761 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