.title listxt
.inclu "b:global.mac"
MEETIN = 4
RECEIV = 7
MAXHDR = 60. ; Maximum width of a header
.macro log kind, a, ?tmplbl, ?forwrd
mov kind, r0
call ttyout
write #ifatal
write #tmplbl
call pcrlf
br forwrd
tmplbl: .str
.even
forwrd:
.endm
.macro fault a
log #'?,
return
.endm
.macro warn a
push
log #'%,
pop
.endm
sect texts, d
ifatal: .str <"Internt fel - ">
sect code
;+ List all entries in This meeting
;-
lisent:
mov #2, TMP ; List only those text without bit
; #1 set
br dolist
;+ List all texts in This meeting (indicated by thsgr)
;-
listxt:
clr TMP ; This is a flag word
dolist: clr FB2-2 ; Initialize a few things..
clr FB3-2
clr FB4-2
mov thsgr, r0 ; Meeting #
bne 5$ ; Must be non-zero
write #YAN ; Maybe this is a suitable text?
jmp 60$ ; Exit
5$: mov #GRPLST, r1
call findcm ; Find it
tst r0 ; EQ means not found -> BAD!
bne 10$
;---
fault <"FINDCM misslyckades">
;---
10$: gos getrec <#1, rArg-rStr(r0), #FB1, #unlock>
cmp (r1), #MEETIN ; Really a meating?
beq 20$
;---
warn <"felaktig nod-typ p} M\TEs-noden">
;---
20$: mov thsgr, r0 ; This is our meeting
call gethig ; Get HIGH!
mov r0, r3 ; Make r3 number of texts to scan
beq 60$ ; No texts? skip it!
mov 32(r1), r2 ; Start of received text list
beq 60$ ; Skip it if there is no rec list
30$:
gos tryrec <#1, r2, #FB1, #unlock>
cmp (r1), #RECEIV ; Correct record type?
beq 35$
;---
warn <"felaktig nod-typ p} MOTTAGET-noden">
;---
35$: mov r1, r4
add #200, r4 ; Make r4 point past end of record
mov 2(r1), r2 ; Set up next pointer
add #10, r1 ; Advance pointer to the real stuff
40$: tst r3
beq 60$ ; End of texts?
; Now we're ready to make a nice printout
mov TMP, r0 ; Fetch the "what-to-print flagword"
call shwtxt ; SHow one-line info
bcs 70$ ; Maybe we should exit immediately?
dec r3 ; One less
add #4, r1 ; Advance pointer to next text #
cmp r1, r4 ; At end?
blo 40$ ; No continue (at 40$)
tst r2 ; ANy 'next record' ?
50$: bne 30$ ; Yes -> 30$
60$: call PCRLF ; Make a CRLF!
70$: return
;+ Make a nice-looking one-line summary of a text
;
; Data passed: r0 - Mask used for testing if a text should be displayed
; r1 - points to long text #
;
; Data returned: r0 - positive == mask missmatch
; negative == OK
; 0 == The text was deleted
;
; Uses: FB2 (used for file 5 records), FB3 (file 2) & FB4 (file 3)
;-
dsplst: ; This label are not to be used!/AG
shwtxt:
push
mov r0, r2 ; Save the bitmask
mov #FB2, r0 ; Use FB2 when fystst:ing
call fystst ; Get physical # to r0
tst r0 ; Deleted?
beq 99$ ; Then exit at 99$
push
gos tryrec <#2, r0, #FB3, #unlock>
mov r1, r3 ; Save pointer to TEXT record!
bit r2, 14(r1) ; Test the status word
beq 5$ ; If OK jump to 5$
pop ; If we're here we lost. Clean stack
mov #1, r0 ; Indicate exit status - rejected
br 99$ ;and exit
5$: pop
mov #11., r0 ; Normal format
call deco32 ; Printit
write #csq ; Write a Colon-Space-Quote combination
mov r3, r0 ; r0 = pointer to TEXT record in memory
mov #FB4, r1
call fixhdr ;Subset of gethdr
cmpb TmpStr, #MAXHDR ; Does this header fit?
blos 10$ ; If yes - advance to 10$
movb #MAXHDR, TmpStr ; Otherwise make i fit!
10$: write #TmpStr ; Then show the header
mov #'", r0
call ttyout ; Write closing quote
call PCRLF ; And then return the carriage
mov #-1, r0 ; negative means OK
99$: pop
return
;+ List marked texts
;
LiMar:
;--test
clr FB2-2
clr FB3-2
clr FB4-2
;--eotest
gos getrec, <#1, MyRec, #FB1, #Unlock>
clr r4
mov 74(r1),r5 ; Antal Markerade inl{gg
beq 800$
mov 76(r1),r2
clr FB1-2
10$: gos TryRec, <#2, r2, #FB1, #Unlock>
mov 2(r1),r2
mov #6,r3
add #10,r1
20$: inc r4
; push r1
; mov r4,r1
; mov #3,r0
; call deco16
; Write #STXTS
; mov (sp), r1
clr r0
;---test
call shwtxt ; Show text # + header
bcs 900$
tst r0 ; Did the text exist?
bne 25$ ; If so - skip to 25$
mov #11., r0 ; Use same format as "shwtxt"
push r1
call deco32
write #erased
pop r1
;--- eotest
; call deco32
; call pcrlf
; pop r1
bcs 900$
25$: cmp (r1)+,(r1)+
dec r5
beq 900$
sob r3,20$
br 10$
800$: Write #DHIM
900$: call pcrlf
rts pc
sect texts, d
csq: .str <': "'>
.even
.end