From slogin@optonline.net Fri Nov  4 00:10:03 2005
Date: Thu, 03 Nov 2005 23:56:14 -0500
From: slogin@optonline.net
Subject: PHONE does properly reset the scrolling region on program exit
To: tops-20@lingling.panda.com
Message-id: <e436d6bc15c49.436aa39e@optonline.net>
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii
Content-language: en
Content-transfer-encoding: 7BIT
Content-disposition: inline
X-Accept-Language: en
Priority: normal
References: <e1dcf5c213cc8.436a8a65@optonline.net>

Symptom:

    On exit, PHONE always resets the scrolling region to 1,24.

Problem:

    Code in .EXIT uses a hardwired value: 1,24

Analysis:

    Back when PHONE was written (1984 timeframe) it probably would
    have been mostly reasonable to assume a fixed size for a terminal
    as this was, by far, the most common case.  However, a number of
    points come to mind:

     1) Not all scrolling terminals had 24 line monitors.  One example
        was the Ann Arbor Ambassador (which I had after my Concept-100
        finally died, sniff)
     2) Terminal emulators had been in existence for a number of
        years.  Kermit was one example.
     3) The rest of the program handles arbitrary terminal lengths.

Solution:

    The length of the terminal has already been gotten from Tops-20
    and recorded.  Use it by constructing a TTY$ LUUO on the stack
    with the correct length and then issuing it.
    
Code:

File 1) DSK:PHONE.MAC[4,123]    created: 2315 03-Nov-05
File 2) DSK:PHONE.BAK[4,123]    created: 2137 03-Nov-05

1)1     ;[TOMMYT]STAR:<PHONE>PHONE.MAC.1711,  3-Nov-2005 22:44:19, Edit by SLOGIN
1)      ;[T33] Properly set scroll region on exit in PHONE.MAC
1)      ;[TOMMYT]STAR:<PHONE>PHONE.MAC.1710,  1-Nov-2005 15:24:22, Edit by SLOGIN
****
2)1     ;[TOMMYT]STAR:<PHONE>PHONE.MAC.1710,  1-Nov-2005 15:24:22, Edit by SLOGIN
**************
1)1     PHNEDT==^D1711                  ;[T33] PHONE's edit version
1)      PHNWHO==7                       ;[T32] who last edited PHONE (non-DEC)
****
2)1     PHNEDT==^D1710                  ;[T32] PHONE's edit version
2)      PHNWHO==7                       ;[T32] who last edited PHONE (non-DEC)
**************
1)13            CALL    SCREST          ;[T33] RESET SCROLL REGION
1)      ;[T33]  TTY     <SCR,1,24>      ;RESET SCROLL REGION
1)              TTY     <JME>           ;CLEAR SCREEN
****
2)13            TTY     <SCR,1,24>      ;RESET SCROLL REGION
2)              TTY     <JME>           ;CLEAR SCREEN
**************
1)83            SUBTTL  SCREST - Reset scroll region
1)      SCREST: STKVAR  <<REGION,2>>    ;[T33] Allocate space on the stack
1)              MOVEI   T5,REGION       ;[T33] for the TTY LUUO and argument
1)              MOVEI   T1,1(T5)        ;[T33] Calculate address of argument
1)              HRLI    T1,(TTY$)       ;[T33] Construct LUUO instruction
1)              MOVX    T2,<<BYTE (9) TT$SCR,1,24>&-1> ;[T33] Initial region
1)              MOVE    T3,SCRSIZ       ;[T33] Load screen size
1)              DPB     T3,[POINT 9,T2,26] ;[T33] Store in LUUO argument
1)              DMOVEM  T1,(T5)         ;[T33] Store on the stack
1)              XCT     (T5)            ;[T33] Execute the LUUO
1)              RET                     ;[T33] Done
1)              ENDSV.                  ;[T33] End context of REGION
1)84            SUBTTL  LUUO HANDLR
****
2)83            SUBTTL  LUUO HANDLR
**************


