home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
GENASM
/
DISPMEN.LBR
/
DISPMEN.LQB
/
DISPMEN.LIB
Wrap
Text File
|
2000-06-30
|
2KB
|
96 lines
;DISPMEN (Display Menu) Macro by R. Buckman
;File name: DISPMEN.lib
;
MENFLG SET FALSE ;CONDITIONAL ASSEMBLY FLAG
DISPMEN MACRO TOP,BOT,CPE ;TOP, BOTTOM, CHARS PER ENTRY
;
LOCAL COMOF0,COMOF1,PRTLN,PRTSPC,PRTENT0,PRTENT1
;
IF NOT MENFLG
JMP AROUND
?SETUP:
LDA TMNENT ;COMPUTE NO. OF MENU ENTRIES
STC
CMC ;CLEAR CARRY FLAG
RAR ;DIVIDE BY 2
JNC COMOF0 ;EVEN NO. OF ENTRIES
INR A ;ODD NO. OF ENTRIES
COMOF0: ;COMPUTE OFFSET TO RT COL
MOV C,A ;NO. OF ENTRIES TO PRT IN LF COL
LDA LEN ;LENGTH OF ONE ENTRY
MVI D,0
MOV E,A ;[DE] HAS LENGTH OF ONE ENTRY
COMOF1: ;COMPUTE 1ST ADDR FOR RIGHT COLUMN
DAD D ;ADD LENGTH OF ONE ENTRY TO [HL]
DCR C
JNZ COMOF1 ;KEEP IT UP UNTIL [C]=0
SHLD RCOL ;SAVE 1ST ADDR FOR RIGHT COLUMN
LDA TMNENT
MOV B,A ;[B] HAS NO. OF ENTRIES TO PRINT
LDA LEN ;COMPUTE SPACES TO PRINT..
MOV C,A ;..BETWEEN COLUMNS
MVI A,41 ;COL NO. TO PRINT RIGHT SIDE
SBB C
MOV D,A ;[D] HAS NO. OF SPACES
PRTLN:
LHLD LCOL ;GET LEFT COLUMN ADDRESS
CALL PRTENT0
RZ ;ALL DONE PRINTING MENU
SHLD LCOL ;SAVE NEXT LEFT COL ADDR
MOV C,D
PRTSPC: MVI A,32 ;SPACE
CALL CTYPE
DCR C
JNZ PRTSPC
LHLD RCOL
CALL PRTENT0
RZ ;ALL DONE
SHLD RCOL
CALL CRLF
JMP PRTLN
;
PRTENT0:
LDA LEN
MOV C,A ;NUMBER OF CHARACTERS TO PRINT
CALL PRTENT1 ;PRT ENTRY POINTED TO BY [HL]
DCR B
RET
PRTENT1: ;PRT ONE ENTRY, [HL]=1ST CHAR
;[C] = NUMBER OF CHAR (LENGTH)
MOV A,M ;PLACE CHAR IN [A] FOR CTYPE
CALL CTYPE ;PRT 1 CHAR POINTED TO BY [HL]
INX H ;POINT TO NEXT CHAR
DCR C
JNZ PRTENT1
RET
;
;Local variables for menu routine
;
LEN: DS 1 ;NO. OF CHARACTERS PER ENTRY
LCOL: DW 0 ;LEFT COLUMN POINTER
RCOL: DW 0 ;RIGHT COLUMN POINTER
TMNENT: DS 1 ;TOTAL NO. OF MENU ENTRIES
;
MENFLG SET TRUE
;
AROUND:
ENDIF
PUSH H
PUSH D
PUSH B
PUSH PSW
MVI A,(BOT-TOP)/CPE ;COMPUTE TOTAL NO. OF MENU ENTRIES
STA TMNENT
MVI A,CPE ;CHARS PER ENTRY
STA LEN
LXI H,TOP ;MENU START ADDRESS
SHLD LCOL
CALL ?SETUP
POP PSW
POP B
POP D
POP H
ENDM
;