Path: utzoo!attcan!uunet!husc6!mailrus!utah-gr!uplherc!sp7040!obie!wes From: wes@obie.UUCP (Barnacle Wes) Newsgroups: comp.sys.atari.st Subject: Re: Modula2 and Peeking Summary: Modula-2 can do that for you, BUT... Keywords: Peek, Memory, TDI, Modula2 Message-ID: <259@obie.UUCP> Date: 30 Jun 88 18:43:36 GMT References: <490@dalcsug.UUCP> Organization: Great Salt Lake Yacht Club, north branch Lines: 52 In article <490@dalcsug.UUCP>, euloth@dalcsug.UUCP (George Seto) writes: > > Can anyone using TDI's Modula 2 help a friend of mine out with a > question? He is trying to access the System Timer at location $4AB > to read the count there. However he can't find a way of doing a > peek or actually Long Peek. He has been trying to use the > TakeALong command in Modula, but so far, two weeks, no luck. In general, to peek at a location in Modula-2, you would use something like: FROM System IMPORT BYTE, WORD, LONG; SysTimer : LONG @ 4ABH; ... WhatEver := SysTimer; The "@" notation tells the compiler the absolute address of this variable is fixed in memory. You can't do this for the system timer on the ST, however, because the system timer is in "protected" memory. To access this protected memory, the CPU has to be in supervisor mode. You can do this with the SuperExec procedure in module XBIOS. This is an example: FROM XBIOS IMPORT SuperExec; FROM System IMPORT LONG; PROCEDURE GetSysTimer : LONG; VAR TheTimer : LONG; PROCEDURE GetIt; VAR SysTimer : LONG @ 4ABH; BEGIN TheTimer := SysTimer; END. BEGIN SuperExec(GetIt); RETURN TheTimer; END. This is probably not entirely correct; it has been a while since I worked in Modula-2. It should be enough to give you an idea of what you have to do, however. Good Luck! -- {uwmcsd1, hpda}!sp7040!obie!wes | "If I could just be sick, I'd be fine." +1 801 825 3468 | -- Joe Housely --