Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program called SUB64 to subtract the 64-bit integer in memory locations 0x0150 and 0x154 from the 64-bit integer in 0x0160 and 0x0164. Store

Write a program called SUB64 to subtract the 64-bit integer in memory locations 0x0150 and 0x154 from the 64-bit integer in 0x0160 and 0x0164. Store the result in memory location 0x0170 and 0x0174.

/** this is the first question on my 12 question homework and I was given very little to understand assembly code other than a history of the 8086 and a 1300 page pdf called the art of assembly.

I understand that there is not a 64 bit memory address, so we have to subtract it in pieces (i think 16 bits at a time?) starting with the least significant bits. In fact, I understand most of the logic behind doing this problem. I just have no clue how to code it. What i need help on is the following.

does assembly need headers or anything like a c++ program?

How do i know where each address is? What i am confused about for example is when it gives me an address, is there a specific place for each address? Or can I point the contents of it to a register like AX? and in that case, how do i choose a register, or can any register be used?

does assembly code need a return such as a c++ program?

I guess if you can just clearly do this problem out, or even one similar to get me going that would be great. This seems like something I really need to learn and understand.

If it matters, we are using NASM and DosBox, but im writing my .asm files in xcode. We were given this shell to use as "a starting point for each program" but this is what ultimately left me more confused.

I have so many questions about it for example, what is org 100h? is that a memory location? Why are we starting the program there? what is it doing?

THANKS FOR YOUR HELP!

; org 100h section .text ; beginning address of code = 0x0100 ;******************************************************* ; ; ; start: MOV BX,[LSTL] MOV CL,0 ;USE CL FOR LARGEST VALUE LP1: MOV AL,[BX+DLST] CMP CL,AL ;TEST IF BL > AL JA LPC ;CONTINUE IF NOT MOV CL,AL ;ELSE STORE NEW MAX LPC: DEC BX JGE LP1 MOV [MAXV],CL ; ; end of your code ; ;******************************************************* ILP: JMP ILP ;infinite loop ; TIMES 50H -($-$$) DB 0 section .data ; beginning address of data = 0x0150 ;******************************************************* ; ; put your data items here ; LSTL: DB 14 MAXV: DB 0 DLST: DB 254,5,25,250,100,150,30,200,253,15,23,46,73,175,0 ; ; end of your data ; ;*******************************************************

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

4. Explain the strengths and weaknesses of each approach.

Answered: 1 week ago