To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 4661
4660  |  4662
Subject: 
RE: AS11_IC
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Wed, 4 Nov 1998 04:19:42 GMT
Original-From: 
HECTOR NORIEGA <(110060.2126@compuserve)NoMoreSpam(.com)>
Viewed: 
2020 times
  
        From: Hector Noriega                Date: 3OCT98

to:  makarraj@cse.msu.edu

To Integrate Assembly Code into a "C" Program

The variables declared here become globals in C.
A simple example to double a number entered from a
"C" program, multiply it in assembly code,
then displayed on the Handy Board LCD display,
will be explained here .
The process is as follows:  write the assembly code,
assemble the ASM file and convert it to an "ICB" file,
add "ICB" to lib_hb.lis file, and call the variable or
subroutine from the MAIN "C" file. For Example,
the name of the file is ASMTEST and the extensions
determine the type of data on files.
ASMTEST.ASM    ; a file written in assembly code
ASMTEST.ICB    ; a file that was assembled into "S"
               ; records.
ASMTEST.C      ; "IC" MAIN function program
LIB_HB.LIS     ; list of files to be executed
AS11_IC        ; a batch file that assembles, creates
       ; lables definitions of entry points and C variables

For this example the commands were as follows:
AS11_IC ASMTEST  ;this batch assembles the ASMTEST.ASM
file and outputs ASMTEST.ICB. The following programs
were tested for the example multiply by 2 and display:

* file: asmtest.asm, first assembly file to be tested 29SEP98*/
* Sample icb file */
* origin for module and variables */
#include "6811regs.asm"
            ORG      MAIN_START
* program to return twice the argument passed to us */
subroutine_double:
            ASLD        ; shift left accumulator to multiply by 2
            RTS          : return of subroutine
********************end of ASMTEST.ASM*********************
**********ASMTEST.ICB FILE*******************
S105802005391C
S9030000FC
S105872B05390A
S9030000FC
6811 assembler version 2.1  10-Aug-91
  please send bugs to Randy Sargent (rsargent@athena.mit.edu)
  original program by Motorola.
subroutine_double 872b *0007
******************END OF ASMTEST.ICB FILE *****************
***********************ASMTEST.C FILE BEGINS HERE**************
/* file:asmtest.c, by  Hector Noriega, 28SEP98 */
/* To test writting assembly*/

void main()
  {
   while(1)
    {
         printf("asmtest # = %d\n",double(5)); /*assembly subroutine*/
     }
    }
**********************ASMTEST.C FILE ENDS HERE***********
****************LIB_HB.LIS *******************
lib_hb.c
c:\ic\ic\work\asmtest.icb
asmtest.c
*******************END OF LIB_HB.LIS***************
To finish this procedure run "IC"  which automatically
downloads and executes the MAIN() , the turn
the Handy Board "OFF" and then "ON".
"The asmtest # = 10" should be displayed on the
Handy Board's LCD screen.

Good luck
Hector Noriega.
Long Beach State University
Electrical Engineering "Controls" Dept.



1 Message 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