
Help! Utter newbie needs help with basic code
Help please!
I've been "trying" to learn basic ASM for the last few weeks, but I've been
sick and missed two classes that must have been major or something because
now im totally lost!
Anyway can anyone help with coding the following?
Using a 7 segment display (on printer port, address 0000:0408H and :0409H)
print the following prompts and totals:
The user is two be prompted to enter two one-digit numbers, both must be
displayed on the 7segment display. The second digit is subtracted from the
first, and the total displayed as "Num1 - Num2 = " <total>.
If the result is negative a negative sign must be placed before the number
for a reasonable time before the negative number is displayed
Please understand I'm an absolute newbie and i've probably screwed this code
up something chronic (no ASM's work in dos under win2k, even ones downloaded
from the net and converted to exe - so I cant test at home)
********************************************
; Program name: Difference in Numbers
; Coded by: Stephen
; Purpose: To input two numbers, display total of num1 - num2
difference segment
assume CS:difference,DS:difference
org 100h ; Give origin of 100h
start: db 'Give the total of Num1 - Numb2$',0ah ; Output Title
db 'Please insert first Number: $' ; Output Request for first Number
mov ah,0h
int 16h ; Read in Number
push ax
mov dl,al ; Move from AL to DL so it stores it
mov ah,2
int 21h ;reprint inputted character on screen
db 'Please insert Second Number$' ; Output Request for second Number
mov ah,0h
int 16h ; Read in 2nd Number
push ax
mov ah,2
int 21h ; Output the second Number
sub dl,al ; Subtract the second input from the first
mov al,dl
mov ah,2
db 'NUm1 - Num2 = ' ; Output "Num1 - Num2 = "
int 21h ; Print the total outputted
port [$408]:=b; ; Something about printing to Printer Port 1, pin B - i
got NO idea how this works
difference ends
end start
*************************
Can anyone help?
Thanks heaps if you can
Stephen