Hello
how can i input a number composed from 2 digit and i print it!
I tried but i can't

mov ah,1
int 21h
to input one number like 1 or 5 ....

But how can i input number like 34 or 19 ....and i print it!?

Recommended Answers

All 5 Replies

#This is how u can read an input from keyboard.

#Supposed u have declared an ascii variable :

var: .ascii ""
var_len: .long . - var

movl $3, %eax #3 is the number of the system call "read"
movl $0, %ebx #0 is the keyboard identifier
leal var, %ecx #u put the pointer to that variable in the register ecx.
movl $1, %edx #it reads 1 character (the speed of reading)
int 0x80 #call interrupt 0x80 to execute the system call read.

#this is how u can print ur string now :

movl $4, %eax #4 system call write
movl $1, %ebx #1 stdout
leal var, %ecx
movl var_len, %edx
int $0x80

thank you magicsign for your reply but i want it in assembly 16bit

mov ah, 1
int 21h          ;read ascii digit
mov str[0], al   ;save digit to string

mov ah, 1
int 21h          ;read ascii digit
mov str[1], al   ;save digit to string

lea dx, str      ;ds:dx -> string
mov ah, 9        ;print the string
int 21h         
mov ax, 4c00h    ;finish
int 21h

str db 2 dup(?), '$'

Thank you very much mathematician

how to use that number?

i mean, i want div it with 8...

commented: Please don't post on old threads +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.