Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Trying to display name and input of a character through machine language of NASM

ID: 3753682 • Letter: T

Question

Trying to display name and input of a character through machine language of NASM through DosBOX. It is very simple but im having trouble with the code. My code is listed below. The instructions are to

Write an 8086 program which will:

Display your name on one line

On the next line, display a ‘?’

Read a character from the keyboard

Display a second message, and the character that immediately follows in the ASCII character sequence.

Here is my code so far, for some reason it will not work as well as Im missing how to get the character that follows in the ASCII character sequence. Will you please tell me what Im doing wrong? And if Im on the right track? As well as how to read the new ASCII character?

org 100h section.data msg DB "Name of Perso char DB? char1 DB msg2 DB "The following character in sequence is: " char3 DB section.text Start: ;getmessage mov dx, Imsgl mov ah, 09h int 21h display string function ;display message ;input a character mov ah, 1 int 21h mov [char1], al sore character ; read char fcn ;input char into AL display in same line mov dx, [char1] ;read char1 mov ah, 1 int 21h ;display character ;display message ;display on next line next character mov dx, msg2 int 21h ;get last line message ;display message Exit: mov ah, 4Ch mov al, 0 int 21h ;DOS function: Exit program ; return exit code value ;Call DOS. Terminate program

Explanation / Answer

I see problem with displaying the character and the msg2. As I assume you want to first display msg2 followed by the char1. In the display msg2 you are missing copying service code into ah before "int 21h". So correct sequence would be:

mov dx, [char1]

mov ah, 09h

int 21h

mov dx, msg2

mov ah,09h

int 21h