I have a programming assignment for assembly and am having a bit of trouble figuring out where i've gone wrong. This is the assignment:
I. Write an assembly language program with a data segment that creates the following labels and values (values in angle brackets are descriptions of the value -- you must determine what data type to use by yourself). Do not simplify constant expressions, and use the smallest data type that will handle the value.
myName ; your actual name, up to 100 characters
nameLen ; a constant expression that calculates this value (byte)
nationalDebt ;[7,975,482,431,119.47] (you may search to find the ; current) (quadword)
usPop ; [297,358,643] (search to find current one) (dword)
kindaNegative ; [-2,147,483,648] (sdword)
my1337Sk1LLz ; [1337h]
negUnit ; [-1] (sbyte)
half ; [0.5] (byte)
calcResult ; 16-bit uninitialized value that can be a positive or ; negative integer (sword)
starField ; an array of asterisk characters, just enough to fill ; every space in a 80x25 character screen
bigLoss ; [-50,000] (sword)
Then add statements to:
1. Create a symbolic constant named secondE with the binary value: 00000000010001010000000000000000 (DWORD)
secondE = ……….
2. Start your program with a call to interrupt 3, to allow the debugger to start:
int 3 ; required for WinDbg debugger
3. Add my1337Sk1LLz to usPOP and store the least-significant 16 bits of the result in calcResult
4. Store bigLoss in the general-purpose register EDX
5. Store the mnemonic name (as characters) for each of the two general-purpose registers (EAX, EBX) in the least-significant bits of the same register. For example, in the EBX register, you would store 0 in the first byte, 'E' in the second byte, 'B' in the third byte, and 'X' in the fourth byte.
(Hint: E in the 2nd byte of a 32-bit value with 0's in the other bytes would be the binary number
00000000010001010000000000000000.)
6. Label the beginning of the storage to the other basic program execution registers as "FillRegs"
7. Print out the values of the registers at the end of the program.
This is what I've put for the program:
TITLE Assignment 2 (assign2.asm)
; Program Description:
; Author:
; Date Created:
; Last Modification Date:
INCLUDE Irvine32.inc
.data
myName BYTE "John Doe"
nameLen = ($ - myName)
nationalDebt QWORD 7975482431119.47d
usPop DWORD 305245279
kindaNegative SDWORD -2147483648
my1337Sk1LLz DWORD 1337h
negUnit SBYTE -1
half byte 0.5d
calcResult SWORD ?
starField BYTE 2000 DUP("*")
bigLoss SWORD -50000
secondE = 00000000010001010000000000000000b
.code
main PROC
int 3 ; required for WinDbg debugger
mov eax,my1337Sk1LLz ; store 1337h into eax
add eax,usPop ; add 305245279
mov edx,bigLoss ; store -50000 into edx
mov eax,secondE ; store 0E00 into eax
mov ah,'A' ; store string A into ah
mov al,'X' ; store string X into al
mov ebx,secondE ; store 0E00 into ebx
mov bh,'B' ; store string B into bh
mov bl,'X' ; store string X into bl
call DumpRegs ; display registers
exit ; exit to operating system
main ENDP
END main
i've gotten rid of all the errors except this one:
Error 1 error PRJ0019: A tool returned an error code from "Assembling..." Project Project
Any hints as to where im going wrong?
edit: forgot to encase the code.
also for clarification: the main things im not getting are numbers 1 and 5 where i have to store (i assume) the letter 'E' as ascii binary as a symbolic constant which im not sure if i have done right, and then store 0EAX and 0EBX. i assume that I stored the AX and BX incorrectly, tho im not sure how to do it right.
i appreciate any tips you could give so I can understand this better. I'm not here for a quick fix, I would like to understand this eventually lol