Write a program that gets the character 'C' from memory then prints it on screen using Flat Assembler?

110 views Asked by At

I am really new to Assembly programming. Its been 2 weeks since our lecturer starting teaching assembly programming using FASM. He gave us the above question to solve using memory addressing and I am really stuck. He only taught us the mov instructions until now and dint go into much details. So, i am wondering if anyone can help me solve this problem.

Since, he told us to retrieve from the memory. So, i used a variable to store it in the memory. This is what i tried so far

 #fasm#

org 100h

mov ah,2 
var db 67  
mov bh, [var]
mov dl,bh

int 21h
int 20h
3

There are 3 answers

2
Jester On

That's pretty much it, except you don't want your data in the middle of code. Put it after the code, such as:

org 100h

mov ah,2 
mov bh, [var]
mov dl,bh

int 21h
int 20h
var db 67  
0
Jose Manuel Abarca Rodríguez On

This is what @Jester means:

org 100h

mov ah,2 
;mov bh, [var]
lea si, [var]  ;"SI" REFERENCES THE VARIABLE. LEA = LOAD EFFECTIVE ADDRESS.
mov dl,[si]    ;GET THE DATA THROUGH THE MEMORY REFERENCE.

int 21h
int 20h
var db 67      ;JESTER IS RIGHT: VARIABLES AT THE BOTTOM.
0
NoName On
org 100h

mov ah,2 
mov dl,[var]

int 21h
int 20h
var db 67