Forums

passing arguments to subroutine

Started by qmadd November 23, 2005
Hello Everyone,
i need to implement a subroutine that fills memory form address XXXX
to YYYY with value NN. The command format should be:
F XXXX YYYY NN,
where XXXX and YYYY are the addresses, and NN is the value. how do i
do that? how do i pass arguments to the subroutine? can anyone help
me? Thanks, Bye all



> F XXXX YYYY NN,
> where XXXX and YYYY are the addresses, and NN is the value. how do i
> do that?

the program may look something like this

LDX #$XXXX
LDAA #$NN
LOOP STAA 0,X
INX
CPX #$YYYY
BNE LOOP
STAA 0,X
> how do i pass arguments to the subroutine?
there are quite a lot of methods. The simple one would be save the value into memory location and extract it out in your subroutine.
You may utilize the stack as well. But you must be careful with this method. Because the program counter will be stored into stack memory before sub routine is being executed.
---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.



----- Original Message -----
From: "qmadd" <qmadd@qmad...>
To: <m68HC11@m68H... > Hello Everyone,
> i need to implement a subroutine that fills memory form address XXXX
> to YYYY with value NN. The command format should be:
> F XXXX YYYY NN,
> where XXXX and YYYY are the addresses, and NN is the value. how do i
> do that? how do i pass arguments to the subroutine? can anyone help
> me? Thanks, Bye all

Seems to me you need not implement but rather copy the routine from Buffalo
source code. Locate BUF34.ASM or similar and you'll only have to isolate a
few routines from the larger program.

tonyp@tony...


yes, but in the simulator, i have to type f xxxx yyyy nn and it should work.
is it enough just to write that routine and just type in the main program jsr f? ---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.



ohohoooooo, i didn't expect this.......
i am very familiar with 8051, avr, ADSP and many other microcontrollers. and i thought i shouldn't have problems with programming a few routines for motorola 6811. so i downloaded the simulator, and some asm files. i tried sim6811 file.asm, but it says "could not open symbol file". I am really sorry for the stupid question, but how do i use this simulator.
and another thing: where do i locate buf34.asm?

One more thing: here's what i have to do:
"Write a program that fills memory with NN from XXXX to YYYY.
Command format: F XXXX YYYY NN"

what is this suppose to mean? where do i type this command, in the simulator? i may not know too much about motorola, but it doesn't seems logic to me. Thank you all guys, Bye

---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.



----- Original Message -----
From: "mada" <qmadd@qmad...>
To: <m68HC11@m68H...>

First of all, it'd be nice if you quoted just the header so we know who you're
replying to. > ohohoooooo, i didn't expect this.......
> i am very familiar with 8051, avr, ADSP and many other microcontrollers. and
i thought i shouldn't have problems with programming a few routines for motorola
6811. so i downloaded the simulator, and some asm files. i tried sim6811
file.asm, but it says "could not open symbol file". I

SIM6811 needs a S19 (object) file, similar to the HEX format of other
processors. The ASM file is the source code. As you know, you can't have the
simulator run source code. The symbol file for the particular simulator refers
to a SYM extension file of the same base name with symbols in simple format such
as (name, hex value):

ONE_SYMBOL C000
ANOTHER_SYMBOL F800

> and another thing: where do i locate buf34.asm?

Google! First page, sixth link from top.

> One more thing: here's what i have to do:
> "Write a program that fills memory with NN from XXXX to YYYY.
> Command format: F XXXX YYYY NN"
>
> what is this suppose to mean? where do i type this command, in the
simulator? i may not know too much about motorola, but it doesn't seems logic to
me. Thank you all guys, Bye

This looks exactly (?) like the command you would type at the Buffalo prompt.
Buffalo being BUF34.ASM you already know about. It's a monitor for the 68HC11
written in assembly language. Use the source to extract just the portions that
will complete your task. You need some initialization code, a couple of SCI
(RS-232) routines, some text to hex conversion and the actual routine that does
the filling.

Good luck.

tonyp@tony...