New 211BSD idle pattern

174 views
Skip to first unread message

Jeff Thieleke

unread,
Oct 2, 2019, 9:05:08 PM10/2/19
to [PiDP-11]
I never was impressed with the basic 211BSD idle pattern (especially compared to some of the other operating system's patterns), so I made small improvement to the default.  It is now a "Knight Rider" style of left to right and back LEDs.  https://www.youtube.com/watch?v=f5ycXKbjQA8 has a demonstration of what this looks like.


If you want to try this, replace the existing idle() in /usr/src/sys/pdp/mch_xxx.s with the following code, recompile a kernel, and reboot.

/*
 * idle()
 *
 * Sit and wait for something to happen ...
 */


/*
 * If you have a console display it's amusing to see a slowly rotating
 * sequence of lights in the display.  If the system is very active the display
 * will appear blurred.
 */

INT
(LOCAL, rdisply, 037)        / idle pattern
INT
(LOCAL, wcount, 8)           / rotate rdisply every wcount calls
INT
(LOCAL, rotleft, 1)          / initially rotate to the left

ENTRY
(idle)
        mov     PS
,-(sp)        / save current SPL, indicate that no
        mov     $1
,_noproc      /   process is running
        dec     wcount          
/ if (--wcount <= 0) {
        bgt     update  
        mov     $8
,wcount       /   wcount = 8
        tst     rotleft        
/   if (rotleft == 1) {
        beq     right
left
:
        rol     rdisply        
/     rdisply <<= 1
        bpl     update          
/     if not shifted out, update
        mov     $0
,rotleft      /     switch to rotating to the right
        mov     $16
,wcount      /     do a slight pause before switching
        br      update          
/   } else {
right
:
        ror     rdisply        
/     rdisply >>= 1
        bit     $1
,rdisply      /     if not shifted fully right after the next loop, update
        beq     update          
/
        mov     $1
,rotleft      /     switch to rotating to the left
        mov     $16
,wcount      /   } do a slight pause before switching
update
:                         / }
        mov     rdisply,r0      /
wait displays contents of r0
        SPLLOW                  
/ set SPL low so we can be interrupted
        wait                    
/ wait for something to happen
        mov    
(sp)+,PS        / restore previous SPL
        rts     pc              
/   and return


Chase Covello

unread,
Oct 8, 2019, 2:20:03 PM10/8/19
to [PiDP-11]
Thanks, I tried this on my system and I like the pattern a lot better!

Charley Jones

unread,
Oct 8, 2019, 3:06:57 PM10/8/19
to Chase Covello, [PiDP-11]
Ooh, pretty!

Sent from my iPhone Xs!

On Oct 8, 2019, at 11:20 AM, Chase Covello <cha...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "[PiDP-11]" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-11+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pidp-11/f5d1fe10-5e8b-4fd2-b862-3228003b29f7%40googlegroups.com.

Jeff Thieleke

unread,
Oct 8, 2019, 9:07:53 PM10/8/19
to [PiDP-11]
I was hoping/expecting that PDP-11 assembly experts would rip this code to pieces.  I still don't understand 1/10th of idled....  But I think I made it better by 4 bytes by using NEG instead of explicitly moving a 1 or 0 into `rotleft`


/*
 * idle()
 *
 * Sit and wait for something to happen ...
 */


/*
 * If you have a console display it's amusing to see a slowly rotating
 * sequence of lights in the display.  If the system is very active the display
 * will appear blurred.
 */

INT
(LOCAL, rdisply, 037)        / idle pattern
INT
(LOCAL, wcount, 8)           / rotate rdisply every wcount calls
INT
(LOCAL, rotleft, 1)          / initially rotate to the left

ENTRY
(idle)
        mov     PS
,-(sp)        / save current SPL, indicate that no
        mov     $1
,_noproc      /   process is running
        dec     wcount          
/ if (--wcount <= 0) {
        bgt     update  
        mov     $8
,wcount       /   wcount = 8
        tst     rotleft        
/   if (rotleft == 1) {

        bmi     right
left
:

        rol     rdisply        
/     rdisply <<= 1
        bpl     update          
/     if not shifted out,
update
        neg     rotleft        
/     switch to rotating to the right
        mov     $16
,wcount      /     do a slight pause before switching
        br      update          
/   } else {

right
:
        ror     rdisply        
/     rdisply >>= 1
        bit     $1
,rdisply      /     if not shifted fully right after the next loop, update
        beq     update          
/

        neg     rotleft        
/     switch to rotating to the left
        mov     $16
,wcount      /   } do a slight pause before switching
update
:                         / }
        mov     rdisply,r0      /
wait displays contents of r0
        SPLLOW                  
/ set SPL low so we can be interrupted
        wait                    
/ wait for something to happen
        mov    
(sp)+,PS        / restore previous SPL
        rts     pc              
/   and return



We could probably #ifdef this into the 2.11BSD kernel build and if this could end up as patch 452, I'd die a happy man...
Reply all
Reply to author
Forward
0 new messages