Assigning a value to RAM[8000]

classic Classic list List threaded Threaded
4 messages Options
Tom
Reply | Threaded
Open this post in threaded view
|

Assigning a value to RAM[8000]

Tom
How do you interactively assign a value to RAM[8000]? Do you have to use a debugger or write a script?
Reply | Threaded
Open this post in threaded view
|

Re: Assigning a value to RAM[8000]

ybakos
You can either find that address in the GUI, click and enter the value you wish; include the necessary instructions in your .asm; or modify the .tst script to do this explicitly (carefully).
Tom
Reply | Threaded
Open this post in threaded view
|

Re: Assigning a value to RAM[8000]

Tom
Thank you. I was using a script to assign a value to RAM[8000].

I had a problem doing it on the GUI. In the VMEmulator, I can search for the address and see the value assigned to it. I can click on the address but the value box didn't become an editable box. After reading your reply, I tried again, and I noticed that sometimes I had to click it multiple times to make the text field editable. Depending on where you click, the whole line can be highlighted in blue or only the value box is highlighted in black. I think it all boiled down to whether I was double-clicking the value box fast enough.

I believe this feature of changing the value of a RAM address by double-clicking the value box was not mentioned in the VMEmulator tutorial slides. In fact, on page 8, the Global stack and RAM portion are marked as "Not Part of VM.. for references only." This slide caused me to think that perhaps I cannot manipulate the RAM address value from here.

Thank you for your help.
Reply | Threaded
Open this post in threaded view
|

Re: Assigning a value to RAM[8000]

bader
In reply to this post by Tom
 i modified the main function in the test as follows(added one line):

 /**
     * Initializes RAM[8001]..RAM[8016] to -1, and converts the value in
     * RAM[8000] to binary.
     */
    function void main() {
        var int result, value;
        do Memory.poke(8000, number); // added this line, where number is what u assign to RAM[8000]
        do Main.fillMemory(8001, 16, -1); // sets RAM[8001]..RAM[8016] to -1
        let value = Memory.peek(8000);    // reads a value from RAM[8000]
        do Main.convert(value);           // perform the conversion
   
    return;
    }
    ------------------------------
    this should work :)