;define a verion number
;
VMAJOR=3. ;version 3.1
VMINOR=1.
;define a program header
;
PHDR -1,0,PH$REE!PH$REU
;now get the input from user input buffer (bootstrap OR from VUE)
;
TIN ;instruction overwritten by RVINI
;perform the instruction here
;puts input character into D1
;now save everything and see if RV was entered by searching for
; REVUE.MOD in the user's Memory Partition. If not there, the user
; must have entered "VUE..", not "RV..". If just "VUE..", then don't
; journal.
;
SAVE D0,D2-D7,A0-A6 ;save all registers except D1
PUSH D1 ;save the input character
LEA A4,RVMOD ;point A4 to "REVUE.MOD"
SRCH @A4,A1,F.USR ;is it in the user's memory partition?
BEQ 10$ ;yup, user entered "RV...", A1 pointer
; to REVUE.MOD
JMP VUEA ;nope, just return like normal
;User entered "RV...". See the status of REVUE.MOD.
; if INIT flag is 321, then simply back to VUE
; if INIT flag is 123, then INIT already done for "*.RV"
; if REVUE in progress flag = 123, then TRMICP next character
;
10$: CMPB @A1,#321 ;if just done with RESTORE
JEQ VUEA ; then back to VUE
CMPB @A1,#123 ;if INIT flag is not 123
JNE VUEA ; then something is wrong
CMPB 1(A1),#123 ;if not in RESTORE mode
BNE SAVCHR ; then save the character entered
CALL RESTOR ; else restore next keystroke
JMP VUEA ; and return to VUE
;Initialize all pointers before saving the keystroke
;
SAVCHR: LEA A4,2(A1) ;point A4 to DDB in REVUE.MOD
LEA A0,1152(A1) ;point A0 to block buffer pointer
LEA A2,1152(A1) ;same goes for A2
LEA A3,1162(A1) ;point A3 to character count
LEA A5,1166(A1) ;point A5 to total character count
;Now save the keystroke in the 512. byte block buffer area. This
; will overwrite the initial -1's in the buffer area.
;
MOV @A0,A0 ;A0 points to space in 512. buffer
MOVB D1,(A0)+ ;move in character, increment pointer
MOV A0,@A2 ;save pointer in block buffer pointer
INC @A3 ;increment character count
CMP @A3,#16. ;16 characters processed since WRITE?
JNE VUEA ;nope, do not perform a WRITE, return
;If 16 characters have been queued, it is time for a WRITE
;
MOV #0,@A3 ;clear character count
ADD #16.,@A5 ;add 16 to total character count
WRITE @A4 ;and record the changes on the disk
;If all 512. bytes have been recorded, time for a new block in the
; buffer area. All pointers need to be reset.
;
CMP @A5,#512. ;all 512. bytes written?
JNE VUEA ;nope, return to VUE
INC 1156(A1) ;yup, increment block count
MOV #0,1162(A1) ; clear character count
MOV #0,1166(A1) ; clear total character count
LEA A2,152(A1) ; point A2 to block buffer area
LEA A3,1152(A1) ; point A3 to pointer storage area
MOV A2,@A3 ; save the buffer pointer
INCW D.REC+2(A4) ; increment block number
;If we are on the last block of "*.RV", warn the user that their
; keystroke file is getting full.
;
CMP 1156(A1),#19. ;on the last block of "*.RV"?
JNE 50$ ;nope, do not warn user
CALL WARNIN ;yup, warn user of "fill"
;Read in a "new" block. Fill the block with -1's and WRITE this
; update out before continuing with the program.
;
50$: READ @A4 ;read in the "new" block
LEA A2,152(A1) ;point to block just read in
MOV #-1,D3 ;D3 will hold the -1's
MOV #128.,D2 ;D2 holds total number of lwords
60$: MOV D3,(A2)+ ;initialize the lword to -1
DEC D2 ;one less lword to init
BNE 60$ ;but still more to do
WRITE @A4 ;all done, WRITE changes
;Jump back to VUE here (first TIN replacement). Notice the NOPs. These
; will be "filled in" by RVINI with the exact instructions overwritten
; by RVINI, plus the return address where the program should jump back
; to VUE.
;
VUEA: POP D1
REST D0,D2-D7,A0-A6
NOP
NOP
NOP
NOP
NOP
;now get the input from user input buffer (bootstrap OR from VUE)
;
XXXXXX: TIN ;instruction overwritten by RVINI
;perform the instruction here
;puts input character into D1
;now save everything and see if RV was entered by searching for
; REVUE.MOD in the user's Memory Partition. If not there, the user
; must have entered "VUE..", not "RV..". If just "VUE..", then don't
; journal.
;
SAVE D0,D2-D7,A0-A6 ;save all registers except D1
PUSH D1 ;save the input character
LEA A4,RVMOD ;point A4 to "REVUE.MOD"
SRCH @A4,A1,F.USR ;is it in the user's memory partition?
BEQ 10$ ;yup, user entered "RV...", A1 pointer
; to REVUE.MOD
JMP VUEB ;nope, just return like normal
;User entered "RV...". See the status of REVUE.MOD.
; if INIT flag is 321, then simply back to VUE
; if INIT flag is 123, then INIT already done for "*.RV"
; if REVUE in progress flag = 123, then TRMICP next character
;
10$: CMPB @A1,#321 ;if just done with RESTORE
JEQ VUEB ; then back to VUE
CMPB @A1,#123 ;if INIT flag is not 123
JNE VUEB ; then something is wrong
CMPB 1(A1),#123 ;if not in RESTORE mode
BNE CHRSAV ; then save the character entered
CALL RESTOR ; else restore next keystroke
JMP VUEB ; and return to VUE
;Initialize all pointers before saving the keystroke
;
CHRSAV: LEA A4,2(A1) ;point A4 to DDB in REVUE.MOD
LEA A0,1152(A1) ;point A0 to block buffer pointer
LEA A2,1152(A1) ;same goes for A2
LEA A3,1162(A1) ;point A3 to character count
LEA A5,1166(A1) ;point A5 to total character count
;Now save the keystroke in the 512. byte block buffer area. This
; will overwrite the initial -1's in the buffer area.
;
MOV @A0,A0 ;A0 points to space in 512. buffer
MOVB D1,(A0)+ ;move in character, increment pointer
MOV A0,@A2 ;save pointer in block buffer pointer
INC @A3 ;increment character count
CMP @A3,#16. ;16 characters processed since WRITE?
JNE VUEB ;nope, do not perform a WRITE, return
;If 16 characters have been queued, it is time for a WRITE
;
MOV #0,@A3 ;clear character count
ADD #16.,@A5 ;add 16 to total character count
WRITE @A4 ;and record the changes on the disk
;If all 512. bytes have been recorded, time for a new block in the
; buffer area. All pointers need to be reset.
;
CMP @A5,#512. ;all 512. bytes written?
JNE VUEB ;nope, return to VUE
INC 1156(A1) ;yup, increment block count
MOV #0,1162(A1) ; clear character count
MOV #0,1166(A1) ; clear total character count
LEA A2,152(A1) ; point A2 to block buffer area
LEA A3,1152(A1) ; point A3 to pointer storage area
MOV A2,@A3 ; save the buffer pointer
INCW D.REC+2(A4) ; increment block number
;If we are on the last block of "*.RV", warn the user that their
; keystroke file is getting full.
;
CMP 1156(A1),#19. ;on the last block of "*.RV"?
JNE 50$ ;nope, do not warn user
CALL WARNIN ;yup, warn user of "fill"
;Read in a "new" block. Fill the block with -1's and WRITE this
; update out before continuing with the program.
;
50$: READ @A4 ;read in the "new" block
LEA A2,152(A1) ;point to block just read in
MOV #-1,D3 ;D3 will hold the -1's
MOV #128.,D2 ;D2 holds total number of lwords
60$: MOV D3,(A2)+ ;initialize the lword to -1
DEC D2 ;one less lword to init
BNE 60$ ;but still more to do
WRITE @A4 ;all done, WRITE changes
;Jump back to VUE here (first TIN replacement). Notice the NOPs. These
; will be "filled in" by RVINI with the exact instructions overwritten
; by RVINI, plus the return address where the program should jump back
; to VUE.
;
VUEB: POP D1
REST D0,D2-D7,A0-A6
NOP
NOP
NOP
NOP
NOP
;WARNIN Subroutine. Called when user is about to fill the keystroke
; file. Byte 1172 in REVUE.MOD is set to 123 once the warning has
; been made to insure only 1 warning will be given.
;
WARNIN: CMP 1172(A1),#123 ;WARNIN already presented to user?
JEQ 10$ ;yup, do not execute the rest...
MOV #123,1172(A1) ;nope, set the WARNIN flag
;Now place the cursor at 20,1 and present message and bell
;
PRTTAB 20.,1 ;TAB to 20,1
MOV #7,D1 ;get a bell
TTY ;"beep"
TYPE < WARNING - your keystroke buffer is getting full.>
PRTTAB 21.,1 ;tab down 1 row
TYPE < Please FINISH from VUE as soon as possible.>
PRTTAB 22.,1 ;tab down 1 row
TYPE < (Hit ESC to clear this message)... >
10$: RTN ;end of WARNIN Subroutine
;RAD50 value of REVUE.MOD
;
RVMOD: RAD50 /REVUE MOD/
;bootstrap restore, or just restore?
RESTOR: CMP 1206(A1),#123 ;bootstrap flag set?
BEQ 10$ ;yup, need to parse etc...
CMP 1176(A1),#123 ;parsed a block yet?
BNE PRSCHK ;nope, see if block parsed
JMP TRMIC ;yup, time for a new character
10$: CLR 1206(A1) ;clear bootstrap flag
;Read the "new" block and make sure there are
; some keystrokes available.
;
FIRST: LEA A4,2(A1) ;point A4 to *.RV that exists
READ @A4 ;read in first block (keystrokes)
LEA A3,152(A1) ;point A3 to block buffer area
CMPB @A3,#-1 ;if -1
JEQ NOCRS ;then done with "RESTORE"
;Find out if this is the last block in the file marked by "-1".
;If it is, we need to look for a "Q,15,-1" combination....
;
PRSCHK: CLR D1 ;clear character register
MOV #512.,D4 ;set byte count register
10$: CMPB @A3,#-1 ;if block buffer area has a -1
BEQ GOT1 ;then we found a "-1"
INC A3 ;else point to next character
DEC D4 ;one less byte to check
BNE 10$ ;and still more to check
SETPRS: MOV #123,1176(A1) ;done, all ok, set PARSED flag
BR TRMIC ;and get a character from the file
;Found a "-1", now look for "Q,15,-1" and change to "Q,-1" if found.
;
GOT1: DEC A3 ;repoint back one character
CMPB @A3,#15 ;looking for a "Q,15" sequence
BNE SETPRS ;no 15, so no need to check further
DEC A3 ;15 found, point back another char.
CMPB @A3,#'Q ;looking for a "Q"
BEQ 10$ ;found one, eliminate this character
CMPB @A3,#'q ;or looking for a "q"
BNE SETPRS ;not there, no need to overwrite
10$: INC A3 ;point to the 15
MOVB #-1,@A3 ;overwrite the 15 with a -1
MOV #123,1176(A1) ;and set PARSED flag
;Block all parsed and ready to get next character from *.RV.
;First see if we are on the "bootstrap" sequence....
;
TRMIC: MOV D.BUF+2(A1),A3 ;A3 points to block of *.RV
CMP 1156(A1),#0 ;are we on the first block?
BNE POISE ;nope, bypass below
CMP 1166(A1),#0 ;yup. Are we on the first character?
BNE POISE ;nope, bypass below
MOV 4(SP),D1 ;yup. Get saved TIN character
CLR D1 ;wipe it out
MOVB @A3,D1 ;get "real" character from *.RV
MOV D1,4(SP) ;and replace the character on stack
INC 1162(A1) ;increment character count
INC 1166(a1) ;increment total count
;Get a character ready and poised in D1
;
POISE: MOV #350.,D6 ;sleep for just a bit
SLEEP ;like so
CLR D1 ;clear D1
JOBIDX A4 ;A4 points to your IDX
MOV 1166(A1),D4 ;get character count into D4
ADD D4,A3 ;point to "next character" in *.RV
CMPB @A3,#-1 ;is it a "-1"?
BEQ DONE ;yup, DONE!
MOVB @A3,D1 ;nope, poise it into D1
MOV JOBTRM(A4),A5 ;get the JOBTRM pointer into A5
TRMICP ;place "new" character into Input Buff
INC 1162(A1) ;increment "write" count
CMP 1162(A1),#16. ;if 16 then needs to be 0
BNE 10$ ;it's not 16
CLR 1162(a1) ;here it gets zero'd
10$: INC 1166(a1) ;increment total block count
CMP 1166(a1),#512. ;done with the block?
BNE NOCRS ;nope, just return
;All done with the current block - get a new block into the buffer
;
INCW D.REC+4(A1) ;increment the block number of *.RV
READ 2(A1) ;read in the new block
INC 1156(A1) ;increment the block count
CMP 1156(A1),#014 ;all done with the file?
BEQ DONE ;yup, DONE!
CLR 1176(A1) ;else clear the PARSEd flag
CLR 1166(A1) ;and clear the character count
NOCRS: RTN ;and return from RESTOR
;All through restoring the VUE file - let em know you're done.
;
DONE: MOV A3,1152(A1) ;set current block pointer
CLR 1206(A1) ;clear bootstrap
CLR 1176(A1) ;clear parse
CMP 1156(a1),#014 ;keystroke file full?
BNE 10$ ;nope
MOV #7,D1 ;get a bell
TTY ;BEEP!
PRTTAB 20.,9. ;yup, type warning message
TYPE <Please FINISH from VUE - your keystroke file is full>
MOVB #321,@a1 ;set don't save flag
RTN ;and return
10$: MOVB #123,@A1 ;set INIT flag
CLRB 1(A1) ;clear REVUE IN PROGRESS flag
MOV #7,D1 ;get a bell
TTY ;beep!
RTN ;and return