Question

i am trying to develop a gui based GDB for debugging 8086 programs. i execute gdb command using Runtime.getruntime.exec(). i have redirected stdin & stdout to a text area in my gui. my application works fine but if the assembly level program asks for user input, it does not wait and i get segmentation fault i tried running a simple java code which asks for ur name and prints it.this worked fine.. so i tried running the a assembly level code on eclipse console..it too did not wait for user input.. so i think there is no problem in my application.. but how do i make my text area to wait for user input? is this the problem with assembly level code?

%macro print 2
mov rax,1
mov rdi,1
mov rsi,%1
mov rdx,%2
syscall
%endmacro

%macro read 2
mov rax,0
mov rdi,1
mov rsi,%1
mov rdx,%2
syscall
%endmacro

SECTION .data
msg1: db "Enter the string",10
len1: equ $ -msg1
msg2: db "Length is "
len2: equ $ -msg2
msg3: db "It is a palindrome",10
len3: equ $ -msg3
msg4: db "It is not a palindrome",10
len4: equ $ -msg4
msg5: db "Reversed string is",10
len5: equ $ -msg5
nl: db 10
lennl: equ $ -nl

SECTION .bss
str: resb 100
len: resb 4
tlen: resb 4
cnt: resb 4
rstr: resb 100

SECTION .text
global _start
_start:
print msg1,len1
read str,10
;print nl,lennl
mov [len],eax
sub byte [len],1
mov ecx,[len]
mov [tlen],ecx
mov ecx,0
add byte [tlen],30h
print msg2,len2
print tlen,4
print nl,lennl


rev:
mov ecx,[len]
;mov [cnt],ecx
dec ecx
label:
mov esi,str
l1:
inc esi
;dec byte [cnt]
dec ecx
jnz l1
;inc esi
;inc ecx
mov edi,rstr
mov ecx,[len]
;mov [cnt],rcx
;dec byte [cnt]
;dec ecx
loop:
mov bl,[esi]
mov [edi],bl
dec esi
inc edi
;dec byte [cnt]
dec ecx
jnz loop

print msg5,len5
print rstr,10

mov cx,[len]
palin:
mov esi,str
mov edi,rstr
palinloop:
mov bl,[esi]
cmp [edi],bl
jne notpalin
inc edi
inc esi
dec cx
jnz palinloop
jmp ispalin 
notpalin:
print nl,lennl
print msg4,len4
jmp exit
ispalin:
print nl,lennl
print msg3,len3

exit:
print nl,lennl
mov eax,1
mov ebx,0
int 80h

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top