d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Assembly I8086 Problem
Add Reply New Topic New Poll
Member
Posts: 16,218
Joined: Sep 27 2009
Gold: 13.00
Nov 18 2012 10:06am
Hey guys, I have a problem in i8086 Assembly.

I try to make the following test :

If the users press "enter" (carriage return), the program jump to the end

In ASCII code, I can try it with 10 (new line) or 13 (creturn). Here's my code problem :

MOV AH, 01H
INT 21H

CMP AH, 10 ;10 = carriage return
JE end

With this code, when I run my program, I'm not able to interupt the program when I do a carriage return, so I'm block in an infinite loop ...

Could you help me plox ?


/e Even if I swap AH for AL, nothing it happen

This post was edited by Bremen on Nov 18 2012 10:09am
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Nov 18 2012 12:39pm
not sure about i8086 but in there should be a specific interrupt you have to call to call to be able to read anything in on stdin. you cant just mov ah around hoping that you capture something.
Member
Posts: 9,759
Joined: Jun 10 2007
Gold: 42,069.33
Nov 18 2012 12:40pm
nvm

This post was edited by Favre on Nov 18 2012 12:40pm
Member
Posts: 16,218
Joined: Sep 27 2009
Gold: 13.00
Nov 18 2012 03:48pm
Ok so I just find my error ... They were an error on my JMP label .... Label was "End :", and it should be "End:" without the space ^^.
I'm an accustomed of bash but I didn't think there were also this kind of problem in assembly :p

Quote (AbDuCt @ Nov 18 2012 08:39pm)
not sure about i8086 but in there should be a specific interrupt you have to call to call to be able to read anything in on stdin. you cant just mov ah around hoping that you capture something.


MOV AH, 01H
INT 21H

it's the interupt I have to call in 8086 to read an entry in my stdin :)
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Nov 19 2012 08:49am
Quote (Bremen @ Nov 18 2012 05:48pm)
Ok so I just find my error ... They were an error on my JMP label .... Label was "End :", and it should be "End:" without the space ^^.
I'm an accustomed of bash but I didn't think there were also this kind of problem in assembly :p



MOV AH, 01H
INT 21H

it's the interupt I have to call  in 8086 to read an entry in my stdin :)


yea but say for instance in x86 32bit asm on linux you also have to supply a buffer to store the stdin data, the length of the buffer and other details before the interrupt call.


Code
.section .bss
       .equ buffer_size, 500
       .lcomm buffer, buffer_size

.section .text

.global _start

_start:
       movl $0, %ebx
       movl $buffer, %ecx
       movl $buffer_size, %edx
       movl $3, %eax
       int $0x80


not sure how 8086 works though never used it

This post was edited by AbDuCt on Nov 19 2012 08:50am
Member
Posts: 16,218
Joined: Sep 27 2009
Gold: 13.00
Nov 29 2012 04:08pm
Quote (AbDuCt @ Nov 19 2012 04:49pm)
yea but say for instance in x86 32bit asm on linux you also have to supply a buffer to store the stdin data, the length of the buffer and other details before the interrupt call.


Code
.section .bss
       .equ buffer_size, 500
       .lcomm buffer, buffer_size

.section .text

.global _start

_start:
       movl $0, %ebx
       movl $buffer, %ecx
       movl $buffer_size, %edx
       movl $3, %eax
       int $0x80


not sure how 8086 works though never used it


oh ok, u were talking about the stack size ?

In 8086 it's this kind of skeleton :

Code
PILE SEGMENT STACK

DW 256 DUP(?)
Base:
PILE ENDS

DATA SEGMENT


DATA ENDS

CODE SEGMENT

ASSUME CS:CODE, DS:DATA, SS :PILE

main: MOV AX,DATA
MOV DS,AX

MOV AX,PILE
MOV SS,AX  
MOV SP,Base




 




MOV AH,4CH  
INT 21H  
CODE ENDS


Go Back To Programming & Development Topic List
Add Reply New Topic New Poll