Path: utzoo!attcan!uunet!snorkelwacker!apple!vsi1!zorch!xanthian From: xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) Newsgroups: comp.sys.amiga.tech Subject: Re: Modula-2 and Assembly Message-ID: <1990Sep28.013538.3231@zorch.SF-Bay.ORG> Date: 28 Sep 90 01:35:38 GMT References: <4676@crash.cts.com> Organization: SF-Bay Public-Access Unix Lines: 39 lkoop@pnet01.cts.com (Lamonte Koop) writes: > > I'm about to go out of my mind here. I have a rather large program >written in Modula-2, in which I suddenly find a need to have the ability to >Get/Set a 68030 or 68020's cache control register (CACR). In assembly, no >problem...in Modula-2..big problem. Using Benchmark Modula-2 there is a >utility for converting asm load files to M2 OBM files (for use as the >Implementation portion of a library module)..BUT, I am beginning to think that >this particular path isn't going to work for me (nothing's going my way with >this...). You can also use INLINE or CODE procedures, which are basically >inline lists of machine code (hex op-codes, the whole works...what fun; NO >mnemonics, labels, etc...just the pure machine code...), but these so far have >produced nothing but rather spectacular GURUs (one managed to blank vd0:...and >other bells and whistles). If ANYONE has ides post them or E-Mail me... Well, I cannot _guarantee_ that this will work, because I've never found the need for it, but ... Modula-2 itself supports memory mapped i/o, through the low level ability to address a particular physical word of memory by its (constant) address. See, for example, "Modula-2, A Seafarer's Manual and Shipyard Guide", Edward J. Joyce section 6.1 "Absolute Memory Locations" (page 168, in my edition), or "Programming in Modula-2", Niklaus Wirth, Fourth Edition, Section 29 of the manual or sections 12 and especially 13.2 of the Report. The trick, better illustrated in Joyce's book, is to declare the variable with the decimal or hex absolute address in brackets right after the variable name. From Joyce: VAR EndMemory[65535] : CARDINAL; ResetPntr[0FFFEH] : INTEGER; NMIPntr[0FFFCH] : INTEGER; Try it! This might let you finess the assembly problem altogether. Kent, the man from xanth.