;*************************** AMUS Program Label ******************************
; Filename: TYPRAN.M68 Date: 05/9/90
; Category: UTIL Hash Code: 631-607-230-272 Version: 1.0(101)
; Initials: GR/AM Name: James A. Jarboe IV
; Company: Educational Video Network, Inc. Telephone #: 4092955767
; Related Files:
; Min. Op. Sys.: AMOSL 1.3B Expertise Level: INT
; Special: Works best on trms with hi/lo intensity; 132/80 cols; reverse video
; Description: Types out a RANDOM file to display on a terminal screen.
; Assumes block of random data is 512 bytes/block.
; Updated to work with field and mode terminals.
;*****************************************************************************
;****************************************************************************
;* *
;* TYPRAN.M68 *
;* *
;* Written By: James A. Jarboe IV *
;* 1401 19th Street *
;* Huntsville, TX 77340 *
;* 409-295-5767 *
;* *
;* 12-08-88 *
;* GR/AM *
;****************************************************************************
; Edit History:
;
; [101] 09-May-90 Fixed help display's to accomodate Mode and field
; terminals. Minor cleanups. /JAJ
;
; [100] 08-Dec-88 Written by James A. Jarboe IV
;
;
; Note : This program is donated to AMUS and its users.
; Tested on AMOS : 1.3B(151)-7
; LOKSER : Yes
; Risk : None
; Suggestions : Works best with a terminal capable of high & low
; : intensity screen display and capable of 132 and 80
; : column display, and reverse and normal graphics
;
; Description: Types out a RANDOM file to display on a terminal screen.
; Unprintable ascii characters are represented with
; a . (period). This program assumes that a block of RANDOM
; data is 512 bytes per block. There is no writing of data
; only reading of data files. All options are envoked from
; within the TYPRAN program. No external / options are allowed
;
; Options: Space bar - Start or Stop display
; S - Start or Stop display
; ^S - Stop display
; ^Q - Restart display
; ESC - Quit
; Q - Quit
; ^C - Quit
; 0 - 9 - Change display speed. 0 = fast, 9 = slow
; R - Change bytes per line display
; B - Change relative block display
; D - Display Alpha Accounting Style Dummy record
; Home - Restart display with first block
; H - Display help
;
; Notes: All references to Relative Block Number is relative to the
; first block of the file, not the actual block number.
; I.E. Relative block #1 is the first block of the file
; Relative block #11 is the eleventh block of the file
ASMMSG " "
ASMMSG "( TYPRAN )"
ASMMSG "( By James A. Jarboe IV )"
ASMMSG "( TYPRAN.LIT = 631-607-230-272 )"
ASMMSG " "
PAGE
;***************************************************************************
; *
; P R O G R A M M A C R O D E F I N I T I O N S *
; *
;***************************************************************************
;
DEFINE PRTTAB ROW, COL
PUSH D1
MOVW #<ROW_8.+COL>, D1
TCRT
POP D1
ENDM
PAGE
;***************************************************************************
; *
; C U R R E N T V E R S I O N *
; *
;***************************************************************************
;
VMAJOR = 1. ; Author James A. Jarboe IV
VMINOR = 0
VEDIT = 101. ; 09-May-90 Current Release.
VSUB = 0
VWHO = 0
PAGE
;***************************************************************************
; *
; P R O G R A M I M P U R E A R E A *
; *
;***************************************************************************
;
.OFINI
.OFDEF FILE,D.DDB ; File DDB
.OFDEF BYTPER,4 ; Bytes per line
.OFDEF PAUSE,8. ; Pause time
.OFDEF HMEBLK,8. ; Home block
.OFDEF TOTBLK,8. ; Total blocks
.OFDEF CURBLK,8. ; Current block
.OFDEF ALPFL1,2 ; Alpha accounting flag 1
.OFDEF ALPFL2,2 ; Alpha accounting flag 2
.OFDEF ALPORG,8. ; Alpha accounting organized count
.OFDEF ALPREC,8. ; Alpha accounting record count
.OFDEF ALPMAX,8. ; Alpha accounting maximum record
.OFDEF ALPDEL,8. ; Alpha accounting delete count
.OFDEF TRMWID,8. ; Terminal width flag
.OFSIZ IMPSIZ
PHDR -1,0,PH$REE!PH$REU
GETIMP IMPSIZ,A5
;Process input line of TYPRAN filename string
TOP: BYP ; bypass all whitespace
LIN ; just a CR?
JNE 10$ ; nope
5$:
CALL RANHLP ; Call help
CRLF ;
EXIT ; and quit
; A2 should be pointing to filespec
10$: MOV A2,A0
FSPEC FILE(A5),DAT ; fill the DDB, default to DAT
INIT FILE(A5) ; find the driver & get buff
LOOKUP FILE(A5) ; is file there?
BEQ 20$ ; yep
PRTTAB -1,11.
TYPE <?Cannot find >
PRTTAB -1,12.
TTYL @A0
PRTTAB -1,12.
EXIT ; and quit
;see if file is random file....
20$: CMPW FILE+D.WRK+6(A5),#-1 ; random?
BEQ 40$ ; yep, continue
PRTTAB -1,11.
TYPE <?File is >
PRTTAB -1,12.
TYPE <not >
PRTTAB -1,11.
TYPECR <a random file.> ; mssg
PRTTAB -1,12.
EXIT
40$:
MOV #64.,BYTPER(A5) ; Set 64 chars per line
CRLF ; output a blank line
ONEKEY ; Set one key input dat mode
MOV #1,PAUSE(A5) ; Set pause time
50$:
OPENR FILE(A5) ; Open the file
CLR D2
MOVW FILE+D.WRK+2(A5),D2 ; Number of blocks
CLR TOTBLK(A5)
MOV D2,TOTBLK(A5) ; Set total number of blocks
MOV FILE+D.REC(A5),HMEBLK(A5) ; store 1st block
SUB #1,HMEBLK(A5) ; Subtract one for recount
CLR D5 ; block count
MOV #1,D5 ; Set 1st block
READ: CTRLC CLSFIL ; if ^C then quit
READ FILE(A5) ; read in a block
MOV FILE+D.BUF(A5),A4 ; A4 points to block read in
CMP D5,#1 ; Is this the first block read
BNE 10$ ; No
CALL LOALP ; Load alpha dummy record just in case
10$:
PRTTAB -1,11. ; DIM
TYPE <Current Block # > ; Label output
PRTTAB -1,12. ; BRIGHT
MOV FILE+D.REC(A5),D1 ; Get the block number
OCVT 0,OT$TRM ; Type out the number
PRTTAB -1,11. ; DIM
TYPE < > ; and space over
TYPE <Relative Block # >
PRTTAB -1,12. ; BRIGHT
CLR D1 ;
MOV D5,D1 ; Relative block to display
DCVT 0,OT$TRM ; Print it out
CRLF
INCW D5 ; Next relative block
;now look for the string....
MOV #512.,D0 ; D0 counter (512 bytes per block)
CLR D3
POINT:
MOVB (A4)+,D1 ; Get the byte
CMPB D1,#32. ; Is it printable?
BLO 10$ ; No
CMPB D1,#126. ; Test Are you sure?
BHI 10$ ; No
BR 20$ ; Yep ..print it
10$:
MOVB #'.,D1 ; Default to . for unprintable
20$:
TTY ; Print it out
NO: INC D3 ; Inc bytes per line counter
CMM D3,BYTPER(A5) ; Are we at max?
BNE 20$ ; No
CALL KEYSCN ; Check for keyboard input
CLR D3 ; Clear bpl counter
MOV PAUSE(A5),D6 ; Move pause counter to D6
SLEEP ; To sleep
CRLF ; Do a CR & LF
20$:
DEC D0 ; one less byte in block
BNE POINT ; Get next byte
NXTBLK:
DECW D2 ; one less block to read
JNE INCBLK ; still more to read
CLSFIL:
CLOSE FILE(A5) ; Close the file
CRLF
CRLF ; And tell us how many
PRTTAB -1,11. ; DIM
TYPE <Total of >
PRTTAB -1,12. ; BRIGHT
MOV D5,D1 ; get total
SUB #1,D1 ; Set to right number
DCVT 0,OT$TRM ; type out number
PRTTAB -1,11. ; DIM
TYPE < block>
CMP D1,#1 ; Check for sssss
BEQ 10$
TYPE <s>
10$:
TYPE < displayed out of >
PRTTAB -1,12.
CLR D1
MOV TOTBLK(A5),D1
DCVT 0,OT$TRM
PRTTAB -1,11.
TYPE < possible block>
CMP D1,#1
BEQ 20$
TYPE <s>
20$:
TYPE <. >
PRTTAB -1,12.
TSTW TRMWID(A5) ; Wide display ?
BEQ 30$ ; No
PRTTAB -1,81. ; Reset to normal
30$:
CRLF ; return
EXIT ; and quit
INCBLK:
INCW FILE+D.REC+2(A5) ; point to next block
CRLF
JMP READ ; and read it
; check for keyboard input
KEYSCN:
TCKI ; is character there
JNE 99$ ; no .. then back to display
KBD ; Yes then get it
UCS ; Set to upper case
CMPB D1,#'H ; H for help
JEQ HELP ;
CMPB D1,#40 ; Space for stop or start
JEQ DSTOP ;
CMPB D1,#23 ; Check for ^S stop display
JEQ DSTOP
CMPB D1,#'Q ; Q for quit
JEQ CLSFIL
CMPB D1,#33 ; ESCape to quit
JEQ CLSFIL
CMPB D1,#'S ; S for stop display
JEQ DSTOP
CMPB D1,#'B ; B for relative block change
JEQ TOBLK
CMPB D1,#71 ; 9 for slow display
BHI 20$
CMPB D1,#61 ; 1 for fast
BLO 10$
SUB #56,D1 ; Set to a number
MUL D1,#500. ; Multiply by 500
BR 15$ ; Go back to work
10$:
CMPB D1,#60 ; If 0 then real fast
BNE 20$ ; Must be another command
CLR D1
MOV #1,D1
15$:
MOV D1,PAUSE(A5) ; Move 1 to sleep counter
RTN ; Back to work
20$:
CMPB D1,#36 ; Home key to restart from first blk
JEQ HOME
CMPB D1,#'D ; D- for dummy record display
JEQ DUMMY
CMPB D1,#'R ; R to record length on a line
JEQ RECSIZ
99$:
RTN ; go home
; do the stop display
DSTOP: CTRLC CLSFIL
KBD
CMPB D1,#23 ; ^s then still stop
BEQ DSTOP
RTN
; restart display from first block of file
HOME:
MOV HMEBLK(A5),FILE+D.REC(A5) ; reset first block
CLR D5
MOV #1,D5 ; Set relative block displayed
CLR D2
MOV TOTBLK(A5),D2 ; Reset total number of blocks
ADD #1,D2 ; Restart correct count
RTN
; change the relative block number to display
; The relative block number is relative to the first block of the file
; I.E. to display the 3rd block of the file enter 3 which will display
; the third block of the file.
TOBLK:
CRLF
CRLF
MOV D5,D1
PRTTAB -1,11.
TYPE <Relative Block # >
PRTTAB -1,12.
SUB #1,D1
DCVT 0,OT$TRM
PRTTAB -1,11.
TYPECR < is currently being displayed. >
CRLF
TYPE <Enter the >
PRTTAB -1,12.
TYPE <Relative Block Number >
PRTTAB -1,11.
TYPE <to display next. >
PRTTAB -1,12.
MLTKEY ; Set multiple key input
KBD ; Get keyboard input
BYP ; Bypass spaces etc
NUM ; Check for number input
JNE TOBLK ; Try again
GTDEC ; Get decimal to d1
JMI TOBLK ; Try again
ONEKEY ; Set onekey input
CMP D1,#0
JEQ TOBLK ; C'mon no 0 relative record
CMP D1,TOTBLK(A5) ; Compare the number to total of blks
JLE 10$ ; If less than then all is OK
PRTTAB -1,11.
TYPE <There are only >
PRTTAB -1,12.
MOV TOTBLK(A5),D1
DCVT 0,OT$TRM
PRTTAB -1,11.
TYPECR < Blocks in this file. >
CRLF
CRLF
CALL ANYK ; Call anykey to continue
JMP TOBLK ; Try again
10$:
CLR D4
MOV HMEBLK(A5),D4 ; Set home block
SUB #1,D4 ; Subtract one for correct count
ADD D1,D4 ; Add the number input
MOVW D4,FILE+D.REC+2(A5) ;point to next block
CLR D2
MOV TOTBLK(A5),D2 ; Get total number of blocks
SUB D1,D2 ; Subtract the relative count
ADD #2,D2 ; Set to correct number
CLR D5
MOV D1,D5 ; Set relative block count
RTN
; the help screen
HELP:
PRTTAB -1,0
CALL TYPHLP
; any key to continue
ANYK:
PRTTAB 23.,1
PRTTAB -1,11.
TYPE <Press >
PRTTAB -1,12.
TYPE <Any Key >
PRTTAB -1,11.
TYPE <to continue. >
PRTTAB -1,12.
KBD
CRLF
CRLF
CRLF
RTN
; load the Alpha Accounting Style Dummy record
; Should be mapped for a RANDOM file similar to below
; MAP1 DUMMY'RECORD,@MAIN'RECORD
; MAP2 SORT'FLG,S,1 ! sort flag for resorting data file
; MAP2 DELT'FLG,S,1 ! deleted record flag
; MAP2 ORGCNT,F,6 ! organized record count
; MAP2 RECCNT,F,6 ! used record count
; MAP2 MAXCNT,F,6 ! maximum record count
; MAP2 DELCNT,F,6 ! deleted record count
LOALP:
PUSH A4 ; Push a4 to stack
MOVB (A4)+,ALPFL1(A5) ; Get 1st byte
MOVB (A4)+,ALPFL2(A5) ; Get 2cnd byte
LEA A2,ALPORG(A5) ; Point to ALPORG
CALL MOVA4 ; And load it with disk data
LEA A2,ALPREC(A5) ; Point to ALPREC
CALL MOVA4 ; And load it with disk data
LEA A2,ALPMAX(A5) ; Point to ALPMAX
CALL MOVA4 ; And load it with disk data
LEA A2,ALPDEL(A5) ; Point to ALPDEL
CALL MOVA4 ; And load it too.
POP A4 ; Reset a4
RTN
; the disk data loader
MOVA4:
MOVB (A4)+,(A2)+
MOVB (A4)+,(A2)+
MOVB (A4)+,(A2)+
MOVB (A4)+,(A2)+
MOVB (A4)+,(A2)+
MOVB (A4)+,(A2)+
RTN
; display the alpha accounting style dummy record
DUMMY:
PRTTAB -1,0
PRTTAB 1,79.
PRTTAB -1,33.
PRTTAB 1,1
PRTTAB -1,32.
TYPE < Alpha Accounting Style Dummy Record >
PRTTAB -1,33.
CRLF
CRLF
CRLF
MOVB ALPFL1(A5),D1 ; First flag
PRTTAB -1,11.
TYPE < Flag 1 >
PRTTAB -1,12.
TTY
CRLF
MOVB ALPFL2(A5),D1 ; Second flag
PRTTAB -1,11.
TYPE < Flag 2 >
PRTTAB -1,12.
TTY
CRLF
PRTTAB -1,11.
TYPE < Orgcnt >
PRTTAB -1,12.
LEA A2,ALPORG(A5) ; Organized record count
FCVT @A2,0,OT$TRM,0,0 ; Floating point to dec display
CRLF
PRTTAB -1,11.
TYPE < Reccnt >
PRTTAB -1,12.
LEA A2,ALPREC(A5) ; Record record count
FCVT @A2,0,OT$TRM,0,0 ; Floating point to dec display
CRLF
PRTTAB -1,11.
TYPE < Maxcnt >
PRTTAB -1,12.
LEA A2,ALPMAX(A5) ; Maximum record count
FCVT @A2,0,OT$TRM,0,0 ; Floating point to dec display
CRLF
PRTTAB -1,11.
TYPE < Delcnt >
PRTTAB -1,12.
LEA A2,ALPDEL(A5) ; Delete count
FCVT @A2,0,OT$TRM,0,0 ; Floating point dec display
TYPECR < >
CRLF
CRLF
CALL ANYK ; Any key to continue
CRLF
CRLF
RTN
; reset bytes per line to display
; records are easier to read if they are displayed
; as a full record per line
RECSIZ:
CRLF
CRLF
PRTTAB -1,11.
TYPE <Current Display is set at >
PRTTAB -1,12.
CLR D1
MOV BYTPER(A5),D1 ; Current bytes per line displayed
DCVT 0,OT$TRM ;
PRTTAB -1,11.
TYPE < byte> ;
CMP D1,#1
BEQ 10$
TYPE <s>
10$:
TYPE < per line. >
CRLF
TYPE <Enter New >
PRTTAB -1,12.
TYPE <Record Size >
PRTTAB -1,11.
TYPE <to Display >
PRTTAB -1,12.
MLTKEY ; Set multi key input
KBD ; Get keyboard input
BYP ; Bypass junk
NUM ; Is this a number
JNE RECSIZ ; No... try again
GTDEC ; Get decimal number to d1
JMI RECSIZ ; No minus numbers
CMP D1,#0 ; C'mon no 0 line size
JEQ RECSIZ
CMP D1,#512. ; 512 is the max
BLE 20$
TYPE <512 >
PRTTAB -1,11.
TYPECR <is the maximum record size.>
PRTTAB -1,12.
CRLF
CRLF
CALL ANYK
JMP RECSIZ
20$:
MOV D1,BYTPER(A5) ; Reset bytes per line
CMP D1,#80. ; Is it less than 80
BLO 30$ ; Yes .... test for wide screen
PRTTAB -1,80. ; Set 132 column screen > 80
MOV #-1,TRMWID(A5) ; Set wide terminal display
BR 40$ ; Get on with it
30$:
TSTB TRMWID(A5) ; Are we at wide scr
een
BEQ 40$ ; No then bypass
PRTTAB -1,81. ; Reset to 80 column screen
40$:
ONEKEY ; Set one key input
CRLF
CRLF
RTN
EXIT: CRLF
EXIT
; the help screens were made with AlphaPaint M68 code generator
; easy way to build 'em.