1 Replies - 673 Views - Last Post: 01 December 2015 - 11:33 PM

#1 harry_007   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-November 15

displaying contents of register in assembly program

Posted 01 December 2015 - 12:44 AM

hi this is my code in nasm to print contents inside the data registers . how will i print the content or address of pointer registers or segment registers and to display if flag is set or not

section .text
global _start       ;must be declared for using gcc
_start :                     ;tell linker entry point

    mov eax,msg  ;stores the data to register
    mov [reg],eax  ;moves data from register to variable
    

mov edx, 8     ;message length
mov ecx, reg  ; message to write
mov ebx, 1      ;file descriptor (stdout)
mov eax, 4      ;system call number (sys_write)
int 0x80           ;call kernel
mov eax, 1      ;system call number (sys_exit)
int 0x80         ;call kernel

section .data

msg db "rubi",10

section .bss

reg resb 100




Is This A Good Question/Topic? 0
  • +

Replies To: displaying contents of register in assembly program

#2 harry_007   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-November 15

Re: displaying contents of register in assembly program

Posted 01 December 2015 - 11:33 PM

hi i have tried this so far and its not dispalying the states of the flag.

section .text
global _start       ;must be declared for using gcc
_start :                     ;tell linker entry point

mov eax,msg         ; moves message "rubi" to eax register
mov [reg],eax       ; moves message from eax to reg variable


mov edx, 8   ;message length
mov ecx, [reg];message to write
mov ebx, 1      ;file descriptor (stdout)
mov eax, 4      ;system call number (sys_write)
int 0x80        ;call kernel

mov eax, 100
mov ebx, 100
cmp ebx,eax

pushf
pop dword eax

mov [save_flags],eax

mov edx, 8        ;message length
mov ecx,[save_flags]         ;message to write
mov ebx, 1          ;file descriptor (stdout)
mov eax, 4          ;system call number (sys_write)
int 0x80     


mov eax, 1      ;system call number (sys_exit)
int 0x80        ;call kernel

section .data

msg db "rubi",10

section .bss

reg resb 100

save_flags resw 100




Was This Post Helpful? 0
  • +
  • -

Page 1 of 1