Help! Utter newbie needs help with basic code 
Author Message
 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



Mon, 16 Feb 2004 09:02:51 GMT  
 Help! Utter newbie needs help with basic code

Quote:
> 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)

Actually, there is a cheat.  Win2k's DOS box is too far removed from it's
original 16-bit status that for the most part 16-bit code has stopped
running correctly on it.  However, you can cause it to revert back into true
16-bit mode if you change into graphics mode, and then change back into
normal text mode (actually just the first part does the switch, the second
is so that you can print stuff out.)

In NASM:

[BITS 16]
[ORG 0x0100]

[SECTION .text]
Start:
 mov ax, 13h;
 int 10h;

 mov ax, 03h;
 int 10h;

 mov dx, message;
 mov ah, 9;
 int 21h;

 mov ax, 04c00h;
 int 21h;

[SECTION .data]
message db "hello$"

This will work perfectly to print.  Just copy the first four lines of code
and paste them at the top of any code you want to test, and DOS will work
perfect.
Note, also, that function 13h of interrupt 10h is pretty cool.  Check the
FAQ (as I recall there is a summary in there.)



Mon, 16 Feb 2004 11:24:56 GMT  
 Help! Utter newbie needs help with basic code
Quote:
> 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)

You can patch the NTDVM.exe so it works better with DOS programs
thanks to Charles Sandmann
(the guy who wrote CWSDPMI). Here's a link he gave on
comp.os.msdos.djgpp
 ftp://clio.rice.edu/djgpp/ntvdmpat.zip


Mon, 16 Feb 2004 13:56:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Newbie needs some basic starting help

2. Newbie needs help with this code segment...

3. Newbie need help in decifering some code

4. Help ! Newbie need help

5. <help> newbie need help

6. Utter utter boogerhead question - spreadsheet?

7. Help - I need Example of Code to Help Print National Characters

8. ***HELP***HELP***NEED INFORMATION***HELP***HELP

9. quick newbie question, please help, .bmp of code attached - code.bmp [0/4]

10. Extremely basic _Newbie_ question - help!?

11. Need Help: Converting Clarion DOS Code to CW Code

12. Please Help - Need to Convert Fortran Code to C Code

 

 
Powered by phpBB® Forum Software