[comp.sys.amiga.tech] ModulaII and Assembly Pt.2

lkoop@pnet01.cts.com (Lamonte Koop) (09/30/90)

     I want to thank everyone who sent and posted replies (so far) to my
question about interfacing an assembly routine into a Modula-2 program to
allow me to manipulate an 020 or 030 CACR register.  Unfortunately, to this
time, no joy.  Basically, the easiest way to do this is to write the routine
in assembly, assemble it, grab the actual machine code listing, and insert it
into an M2 procedure using an INLINE statement, which basically just inserts
the code sequence into the instruction program as is.  Unfortunately, the code
for grabbing the CACR blows up on me.  I've even used Dave Haynie's EXACT code
sequence from SetCPU, assembled that and tried the machine code in my INLINE
statement.  Still no luck.  (I'm usually ending up with something like GURU
$0000000E or the like)  This code SHOULD work!  The assembled version works
great...the M2 INLINE version, which is just the machine code itself inserted
in the program, dies.  Any clues from anyone else???  I'm lost. (Semms to be a
fairly normal state of being for me lately...)
 
--LaMonte
 
"The MOST original .sig file yet: A non-existant one!"

UUCP: {hplabs!hp-sdd ucsd nosc}!crash!pnet01!lkoop
ARPA: crash!pnet01!lkoop@nosc.mil
INET: lkoop@pnet01.cts.com

jcs@crash.cts.com (John Schultz) (10/01/90)

In article <4727@crash.cts.com> lkoop@pnet01.cts.com (Lamonte Koop) writes:
>
>     I want to thank everyone who sent and posted replies (so far) to my
>question about interfacing an assembly routine into a Modula-2 program to
>allow me to manipulate an 020 or 030 CACR register.  Unfortunately, to this
>time, no joy.  Basically, the easiest way to do this is to write the routine
>in assembly, assemble it, grab the actual machine code listing, and insert it
>into an M2 procedure using an INLINE statement, which basically just inserts
>the code sequence into the instruction program as is.  Unfortunately, the code
>for grabbing the CACR blows up on me.  I've even used Dave Haynie's EXACT code
>sequence from SetCPU, assembled that and tried the machine code in my INLINE
>statement.  Still no luck.  (I'm usually ending up with something like GURU
>$0000000E or the like)  This code SHOULD work!  The assembled version works
>great...the M2 INLINE version, which is just the machine code itself inserted
>in the program, dies.  Any clues from anyone else???  I'm lost. (Semms to be a
>fairly normal state of being for me lately...)
>

  It will work: the stack and registers must be preserved upon exit. That's
probably why it's blowing up with address errors. Also, disassemble your
M2 code to make sure the INLINE's are corrects.


  John