From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Thread: fdd80,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Thread: ffc31,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Thread: 1164f8,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Attributes: gide311f70d09,gidf4c4f7386e,gidd180ab3bd8,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.196.130 with SMTP id im2mr13971726pbc.3.1326902581947; Wed, 18 Jan 2012 08:03:01 -0800 (PST) Path: lh20ni196497pbb.0!nntp.google.com!news1.google.com!eweka.nl!feeder.eweka.nl!feeder.erje.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: paramucho@hotmail.com (paramucho) Newsgroups: alt.sys.pdp11,vmsnet.pdp-11,comp.sys.dec Subject: Re: PDP11 Values from MFPT Date: Wed, 18 Jan 2012 16:02:56 GMT Organization: Aioe.org NNTP Server Message-ID: <4f16e707.10168332@nntp.aioe.org> References: <4f12e49d$0$295$14726298@news.sunsite.dk> <4f175c07.15409279@nntp.aioe.org> Reply-To: paramucho@hotmail.com NNTP-Posting-Host: yPe0Vz9rK3epnEf2vEo6yg.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 1.5/32.451 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit On Wed, 18 Jan 2012 12:28:28 +0100, Johnny Billquist wrote: >> The reason I need detection is because emulators lack standard >> terminal output behavior which I use during startup to detect the >> clock rate of a PDP-11 (I count the number of null characters output >> to the console terminal per clock tick and use a table to determine >> both the clock rate and the terminal rate). The test doesn't work on >> E11, SIMH or V11. > >Timing in general is not a good way to detect systems, but I'm sure you >know that... :-) "In general" is right, but in some controlled environments it does work. An output serial port is a fairly reliable timing device. You just send nulls to the port and treat the interrupts as timer events. I first used this technique when the clock on the PDP-11 I was using at the Hannover computer show died on me a few hours before the show started. The test usually fails benignly. The problem with SimH is that it outputs a space when you send a null to the terminal. I've not seen a DEC terminal do that. The test can be disabled with a .INI file setting. There's a couple of checks which exclude the test. In any case I think it's great to be able to detect 50 or 60 hertz automatically (and at the same time determine the baud rate of the console). >You could make the code work (sortof) on emulators by removing the >dependency on the serial port. Just make a spinning loop with increments >and at the next clock interrupt check how far you got. >However, as emulators don't have a fixed speed, your speed detection >will be rather odd on those machines anyway. I see lots of tiny problems aiming their pointy little arrows at me down that path. >> In fact, the V11 emulator has a little API which is used to pass >> information between the emulator and the system. It's used to >> relinquish control so that the emulator doesn't hog all the CPU time >> and for various other functions. It would be great if there was a >> common API for PDP-11 emulators for this kind of thing, but I'm not >> sure the motivation is there for the effort involved. > >Hmm. How do you use that API? Is it to tell that the emulator isn't >doing anything extremely important, and can run with less CPU right now >and be happy, or is this just an odd way of doing a WAIT? The first. It's called by RUST/SJ when it's waiting for terminal input, so that only works most of the time. It's called RUST/XM, multi-process system, whenever it schedules the idle process, which is much more accurate. The emulator just waits a millisecond and resumes the RUST system. It doesn't seem to impact RUST performance and it stops the emulator from acting as an ugly CPU hog. The API is also used to detect the emulator, get a startup comand and a few other tasks. It's the sort of thing which could grow and grow... Here's the autohertz/baud check from the RUST/SJ bootstrap module. "bnew" and "beqw" combine compare and branch instructions. map hz.bau 2,0 map hz.htz map hz.cnt map hz.bbs b$thtz: .word 0 ; 0=unknown, bt$htz: bnew b$tv11,40$ ; VRT is 50hz bnew b$temu,50$ ; default emulator is 60hz beqw b$tclk,40$ ; no ticks so far, assume no clock btvrb$ ; ; call bt$wai ; wait for silence ; call hz$cnt ; count them cmp r3,#hzmax. ; above max? bhis 40$ ; yep mov #h$ztab,r1 ; mov #177777,r2 ; 10$: mov hz.cnt(r1),r0 ; sub r3,r0 ; get the difference bpl 20$ ; neg r0 ; 20$: cmp r0,r2 ; this a better shot? bhi 30$ ; nope mov r0,r2 ; remember better ; approximation mov r1,r4 ; select entry 30$: add #hz.bbs,r1 ; next entry tst (r1) ; any more? bne 10$ ; nope mov hz.htz(r4),b$thtz ; set result 40$: return 50$: mov #60.,b$thtz ; emulator default return hz$cnt: mov #-2,b$ttik clr r3 ; 20$: cmp b$ttik,#10. ; all done? bge 40$ ; yep cmp b$ttik,#-1 ; got first one? bne 30$ ; nope clr b$ttik ; yep - start counting clr r3 ; reset counter 30$: tstb @r$mtps ; ready for another? bpl 30$ ; nope movb #0,@r$mtpb ; write a null inc r3 ; count it tst b$ttik ; waiting for first tick? bpl 20$ ; nope cmp r3,#400. ; got a clock? blo 20$ ; maybe mov #hzmax.,r3 ; no clock 40$: return .macro hzbau$ bau .word bau, 50., bau/5 .word bau, 60., bau/6 .endm h$ztab: hzbau$ 3840. hzbau$ 1920. hzbau$ 960. hzbau$ 480. hzbau$ 240. hzbau$ 120. hzbau$ 60. hzbau$ 30. hzbau$ 15. .word 0 hzmax. = 3840./5 Ian