I am currently attempting to learn the 8086 Assembler. This is a Lab that I am having problems with. Could someone please help?
Write complete programs for the following problems.
1. Place any binary number is register DX and count the number of binary ones in the number in DX in register AL.
For example, the binary number 3F62h contains nine binary ones. Include a flowchart
describing the program.
2. Write a program that takes the smaller of two words stored in memory locations DS:1234h and DS:5678h and store in register AX.
4. Add together all of the 2-word numbers that are stored from address 6000h to 60FFFh in memory. Store the sum starting at location
61020h. Each 2-word number may range in size from 00000000h to FFFFFFFFh. State your assumptions as to how the words for each number are stored in memory and how large the final sum can be.
Include a flowchart clearly describing your solution.
5. Count the number of bytes located in memory from DS:1000h to DS:1200h that are greater than 77h. Place the count on register CX.
Care to show us what you have attempted?
I'd do this backwards. Write down your flowchart or pseudo code and then hand compile it, line by line. Far easier than trying to handle assembly by hand with no clear picture of how your code will work.
THis is what I came up with but having major problems with it. Any inputs??
1.)
code segment
starthere:
mov dx, al
mov al, 000fh
rcl al, 1
rcl al, 1
rcl al, 1
rcl al, 1
mov al, dx
code ends
2.)
code segment
starthere:
mov ds, [1234h]
mov w[s], ax
mov ds, [5678h]
mov w[s], ax
code ends
3.)
code segment ;
starthere:
mov ax, 6000h
mov ds, ax
mov al, [03h]
mov al, [0ch]
mov [20h], al
mov al, [04h]
adc al, [0dh]
mov [21h], al
mov al, [05h]
adc al, [0eh]
mov [22h], al
mov al, 00h
adc al, 00h
mov [23h], al
jmp starthere
code ends
4.)
code segment
starthere:
mov ax, [6000h]
adc w[2], ax
mov 61020h, ax
code ends
5.)
code segment
mov ax, [1000h]
starthere:
rcr ax, 01h
jg great, 77h
mov cx, ax
great:
nop
code ends
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks