lkoop@pnet01.cts.com (Lamonte Koop) (09/27/90)
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... regards, 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
xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) (09/28/90)
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. <xanthian@Zorch.SF-Bay.ORG> <xanthian@well.sf.ca.us>
jcs@crash.cts.com (John Schultz) (09/29/90)
In article <1990Sep28.013538.3231@zorch.SF-Bay.ORG> xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) writes: >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. ><xanthian@Zorch.SF-Bay.ORG> <xanthian@well.sf.ca.us> First, Lamonte wants to change the CACR, which is a register, like "D0" or "A5" etc, and thus doesn't have an "address". Second the above "trick" won't work with Benchmark anyway (at least not with my version). A pointer must be declared and initialized explicitly (no biggie). Playing with the CACR or any of the control registers must be done in assembly, and *must* be done in supervisor mode, as MOVEC is a privileged instruction. Once you get your code working in assembly (you'll need a 68020/030 assembler) it's easy to write a conversion utility to convert the binary to INLINE statements. For something like CACR routines this won't be too much of a pain, but for larger HLL to assembly interfacing, you're better off with C. All of my high performance work is done in C and assembly, and lower performance code in M2 (it's one fast compiler). The Benchmark facility for assembly interfacing only works with a quirky version of the Metacomco assembler (although PD fixes are around). Dave Haynie's SetCPU plays with the CACR. If the source is available, you're all set, else ask Dave or other CBM'rs about the restrictions of putting the Amiga into supervisor mode and banging the CACR. Good luck, John
tmb@davinci.acc.Virginia.EDU (Thomas M. Breeden) (10/03/90)
In article <4676@crash.cts.com> lkoop@pnet01.cts.com (Lamonte Koop) writes: > > I'm about to go out of my mind here. ... >... 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...),... > LaMonte If you have future needs to do more INLINE or CODE use, I've got a definition module, "Assembly.def", which contains a couple of hundred CONSTs giving mnemonic names for 68K opcodes, bitfields, registers, etc. This makes it somewhat easier to INLINE a chunk of machine code, even without an assembler. Anyone interested in a copy? Tom Breeden tmb@virginia.edu -->> Internet tmb@virginia -->> BITNET