Thread: Assembly Language Question

  1. #1
    Registered User
    Join Date
    Sep 2007

    Assembly Language Question

    I'm trying to write a subroutine that prints out memory between two given addresses. I'm not exactly sure how do accomplish this. I already have a subroutine that can print a hex value to console. So I guess I just print out all the hex values in all the corresponding memory locations. But how do I load a memory location, then print all the memory locations up to the last memory location given as a parameter? Can anyone help?


    Memory between 3010 and (where ???? is the hex value there)
    3010 ????
    3011 ????
    3012 ????
    3013 ????

    Addresses to use, i.e. could use num1 to num4 or any other combination

    num1 .fill 1
    num2 .fill 8
    num3 .fill 256
    num4 .fill 1024

  2. #2
    Chinese pâté foxman's Avatar
    Join Date
    Jul 2007
    Well, if we suppose you are targeting the x86 architecture and want to output to the console every byte, it would looks like...

       // Save the context first
       mov ebx, lowestMemoryAdressToPrint
       mov ecx, highestMemoryAdressToPrint
       sub ecx, lowestMemoryAdressToPrint
       xor eax, eax
       // Well i don't know how you call your subroutine, but the value you are interested
       // is at byte ptr [ebx][eax]
       inc eax
       cmp eax, ecx
       jne beg
       // Restore the contexte
    I didn't test and it shouldn't works since it's been a while i have written assembly and i feel quite lazy right now. By the way, your question isn't clear. Which architecture are you targeting ? What have you done so far ? And it might also help if you tell us which tools are you using (are you using a compiler like VS or GCC or simply an assembler like MASM?).
    I hate real numbers.

  3. #3
    Registered User
    Join Date
    Sep 2007
    I'm using the primitive LC-3 editor and simulator. Limited instructions...It's on wikipedia if you've never heard of it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Assembly newbie question
    By geek@02 in forum Tech Board
    Replies: 2
    Last Post: 08-27-2008, 08:09 AM
  2. Assembly language in C
    By lruc in forum C Programming
    Replies: 5
    Last Post: 08-27-2008, 07:29 AM
  3. Assembly question
    By geek@02 in forum Tech Board
    Replies: 8
    Last Post: 08-11-2008, 06:48 AM
  4. Replies: 8
    Last Post: 07-30-2008, 05:37 AM
  5. Strange loop
    By D@rk_force in forum C++ Programming
    Replies: 22
    Last Post: 12-18-2004, 02:40 PM