Skip to main content

Take an input & display it in console [Assembly Language Programming]

.MODEL SMALL
.STACK 100H
.DATA
MSG DB 'Enter a number: $'
.CODE
MAIN PROC
    MOV AX, @DATA       ; initialize DS
    MOV DS, AX
    
    LEA DX, MSG             ; load & display MSG
    MOV AH, 9
    INT 21H
    
    MOV AH, 1                  ; takes input
    INT 21H
    MOV BL, AL
    
    MOV DL, 0DH              ; display character function
    MOV AH, 2                   ; carriage return
    INT 21H                       ; execute carriage return
    MOV DL, 0AH              ; line feed
    INT 21H                       ; execute line feed
    
    MOV DL, BL
    
    MOV AH, 2                   ; load & display output
    INT 21H
    MAIN ENDP
END MAIN

Comments

Popular posts from this blog

Currency Converter - USD & BDT [C Programming]

#include <stdio.h> void main() {     int i;     float usd, bdt;     printf("Press 1 to convert USD to BDT\nPress 2 to convert BDT to USD\n");     printf("Enter your choice: ");     scanf("%d", &i);     switch(i)     {         case 1:             printf("Enter amount in USD: ");             scanf("%f", &usd);             bdt = usd * 80;             printf("1 USD = 80 BDT\n");             printf("%0.3f USD = %0.3f BDT", usd, bdt);             break;         case 2:   ...

Take Integer, Float, Character as Input & Print Them in Console [C Programming]

#include <stdio.h> void main() {     char ch;     int i;     float f;     printf("Enter a character: ");     scanf("%c", &ch);     printf("Enter an integer: ");     scanf("%d", &i);     printf("Enter a fraction number: ");     scanf("%f", &f);     printf("Character: %c\nInteger: %d\nFloat: %f", ch, i, f); }