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 / 3360
3359  |  3361
Subject: 
Re: Programming in Assembly
Newsgroups: 
lugnet.robotics.rcx, lugnet.robotics.rcx.legos
Date: 
Fri, 18 Jul 2003 16:38:15 GMT
Viewed: 
128 times
  
"Aaron Goodman" wrote:

also in you example you specify the data as #0x02, why isn't it #0x02:8
(how the manual says to do data)?

That's because I don't like to type more than is necessary!  :-)

Take this line for example:

  mov.b #0x02:8,r0h

This line is doubly redundant.  The destination operand is an 8-bit
register so the other qualifiers are unnecessary.  It could be
written as:

  mov #0x02,r0h

and the assembler is happy (and so am I).

As for Sensors I was able to find (I think) how to work it:
in the h8300.rcx file (no idea what this is for) I found the addresses of • the sensor ports (0xe0,0xe2 and 0xe4)

to make unactive run 'bclr r6l,@0xbb:8'
to activate run  'bset r6l,@0xbb:8'
where r6l contains the the value for the correct sensor out
Then after that I need to waste around 32 states and make it unactive and • then to read it i do
   mov.b @0xe8:8,r6h
   or.b  r6l,r6h
   mov.b r6h,@0xe8:8
and activate it again when I'm done?
If this is correct please explain what the last two lines do, I just
blindly copied them from the brickos kernel

Ok, for all of the above I'm going to suggest you read the A/D
Converter chapter in the User Manual (aka Hardware Manual).
It explains it in greater detail than I could (and since I don't have
it memorized I'd have to reference it myself to answer your
questions!)

(I'm guessing 0 for sensor 1, 1 for sensor 2 and 2 for sensor 3?)

No, it's actually 2 for sensor 1, 1 for sensor 2, 0 for sensor 3.

Also once I have a program written can I just assemble it with binutils
and then use dll to download it to the rcx? Do I need to specify where it
will be loaded to at the begginining of my program? Do I need to write code
to deal with the on and off buttons or does the rcx take care of that for
me?

If you're writing a standalone asm program (i.e. not using legos), you'd
use firmdl3 to download the compiled .srec file.  Your linker
script (example: the h8300.rcx file) specifies where your program
starts - which is always 0x8000, BTW.

Another thing, do I need to worry about resetting the watchdog timer?

No, it's not being used in that capacity unless you explicitly set
it up to run that way.

and once I finally do get my program writen how do I assemble it? what
command do I use, I have the cross compiler and binutils set up for my legos
installation.

Here, I've extracted a portion of a make script.  This should
give you the basic idea, but of course, the tools all support
a zillion options and it is best to read the docs for anything more
elaborate.

set TOOLDIR=/h8300-000821/H-i686-cygwin32
set TOOLPREFIX=${TOOLDIR}/bin/h8300-hms-
set AS=${TOOLPREFIX}as
set LD=${TOOLPREFIX}ld
set OBJCOPY=${TOOLPREFIX}objcopy

${AS} ldccasm.s -o ldccasm.o
${LD} -T ldcc.lds ldccasm.o ldccbase.o ldccmain.o -Map ldcc.map -o ldcc.out
${OBJCOPY} -O srec ldcc.out ldcc.srec


HTH,

Mark



Message is in Reply To:
  Re: Programming in Assembly
 
Ok, the motor stuff makes sense, I got a little confused with the shift thing. I looked at the proggamming manual some more and it explaned the @ (Register inderect) but I don't see why it is needed, also in you example you specify the data as (...) (21 years ago, 18-Jul-03, to lugnet.robotics.rcx, lugnet.robotics.rcx.legos)

9 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