To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 3636
3635  |  3637
Subject: 
BrickOS Assembler
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sat, 17 Jan 2004 15:47:01 GMT
Viewed: 
3606 times
  
Okay, I'm working on a proc in ASM, and I need help with using MOV to move stuff
back and forth between memory and registers. I have the following (very simple)
program working, but I can't for the life of me get the MOV to work. I've got
the official software manual from Hitachi, and it explains how to transfer from
a memory location to a register, but I can't seem to get from a variable into
one.

#include <conio.h>
#include <unistd.h>

int main(int argc, char **argv) {
  cputs("in");
  sleep(1);

  unsigned short total;
  total = 10;

  __asm__("
  .text
  .align 1

    push.w r2

    mov.b #0x00,r2h
    mov.b #0x08,r2l

    aloop:
      add.b #0x01,r2h
      cmp.b r2h,r2l
      bge loopout
    bra aloop

    loopout:

    pop.w r2
  ");

  cputs("out");
  sleep(1);
  cls();

  return 0;
}



Message has 1 Reply:
  Re: BrickOS Assembler
 
Hi, Michael. I had some trouble with getting variables into registers, as well. I can think of three ways: 1) Pass the variable to a function - the first function argument seems to be r0. You can easily experiment with this by inspecting the (...) (20 years ago, 18-Jan-04, to lugnet.robotics.rcx.legos)

11 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR