🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.modula2
3 messages
3 total messages Started by Stuart Elliott CES92 Thu, 01 Feb 1996 10:45
Assembler + Modula-2 HOW ?
#3219
Author: Stuart Elliott CES92
Date: Thu, 01 Feb 1996 10:45
45 lines
1952 bytes
Hi,

	I have a problem using the (shareware) Fitted Technologies
Modula-2 compiler and I was wondering if anyone in here could help.

	I've already checked the FAQ as well as several books, all
without success.

	I should also state that this is my first Modula-2 program
and have had to fight to be allowed to use this language. So, please
folks, don't let me down.  ;-)

	I need to include some DSP assembly language into my Modula-2
program. So far I've discovered that I need to use a "code" statement
for each assembly language opcode, e.g. CODE(57).

	However, when this was put into the program, the compiler seemed
to accept the command word "CODE" but then barfed at the "5", giving an
"unknown id" error message.

	I really need the following questions answered.

	1. Is it possible to include non-Intel opcodes in a Modula-2
	   program that is being compiled on a standard Intel-based PC ?

	2. If so, do I put the assembly opcodes into a separate module ?

	3. How do I "transfer" control to the assembly opcodes, let them
	   run to conclusion and then return control back to the Modula-2
	   program ?

	   e.g. do I use TRANSFER/IOTRANSFER, NEWPROCESS/PROCESS ... ?

	As I stated previously, all that I could uncover so far was that
it was necessary to use the "CODE" instruction. However, that was shown
using Intel opcodes.

	If anyone can offer some answers to these problems could they please
reply to :-

	selliott@cs.strath.ac.uk

	Thanks very much in advance for any help given.

Stuart
Re: Assembler + Modula-2 HOW ?
#3223
Author: "Mark Morgan Lloyd "
Date: Thu, 01 Feb 1996 14:22
31 lines
1761 bytes
>       1. Is it possible to include non-Intel opcodes in a Modula-2
>          program that is being compiled on a standard Intel-based PC ?

Depends entirely on the compiler. There are some things that _have_ to be 
done as inline operations so I'd expect most implementations to support 
inline assembler (or equivalent).

>       2. If so, do I put the assembly opcodes into a separate module ?

Again, compiler-specific. On a PC you may find that standard .obj files 
are used, in which case a fairly frequent protocol is to have a 
definition module with a precompiled .obj as its implementation. Note 
that like (1) above, this normally implies language extensions.

>       3. How do I "transfer" control to the assembly opcodes, let them
>          run to conclusion and then return control back to the Modula-2
>          program ?
> 
>          e.g. do I use TRANSFER/IOTRANSFER, NEWPROCESS/PROCESS ... ?

No, RTFM about these operations. In general, CODE (if it's anything like 
the Logitech one which I have experience with) works by having a standard 
procedure with a CODE() statement somewhere between the BEGIN and END, it 
is down to the programmer to deduce the register contents immediately 
before and after the inline code.

Mark Morgan Lloyd
mark_tbu@cix.compulink.co.uk

[Opinions above are the author's, not those of his employers or 
colleagues]
Re: Assembler + Modula-2 HOW ?
#3259
Author: Michel De Rosa
Date: Sun, 11 Feb 1996 19:31
26 lines
1601 bytes
Stuart Elliott CES92 (selliott@cs.strath.ac.uk) wrote:
: Hi,
: 
: 	I have a problem using the (shareware) Fitted Technologies
: Modula-2 compiler and I was wondering if anyone in here could help.
: [...]
: 	I need to include some DSP assembly language into my Modula-2
: program. So far I've discovered that I need to use a "code" statement
: for each assembly language opcode, e.g. CODE(57).

With FST-M2 (at least up to v3.1), you use the 'asm' keyword, to insert
assembly language statements, into your code. These statements have
a syntax similar to stand-alone assemblers (e.g.  mov ax, bx).

You should read the documentation file, fmodula.doc if i remember correctly,
since there's more there, than i could (reasonably) cover in a single post.

But that would take care of x86 machine language, for your DSP, it depends
entirelly on exactly how you communicate with it.. You might not even need
to use 'asm' (or CODE), to send instructions to it.. Is this a expansion
board? How to you talk to it (thru I/O ports, or perhaps some common Memory
area shared between the pc and the board? a combination of both?).

Ciao!
Michel De Rosa
aliath@nyongwa.montreal.qc.ca
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads