Files
RomWBW/Source/BPBIOS/Z34RCP11/rcph.lib
2020-02-14 17:22:56 -08:00

119 lines
3.0 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
page
; Library: RCPH for Z34RCP
; Author: Carson Wilson
; Version: 1.0
; Date: June 15, 1988
;
; Command: HELP
; Function: This command displays a list of all resident commands that
; are supported, including those in the CPR (command processor),
; RCP, and FCP.
;
; Syntax: H
clist:
; Print the FCP-resident command names
if listfcp
call print ; Print header for FCP
db lf
db 'FC','P'+80h
ld hl,(fcp) ; Get FCP address dynamically from ENV
ld a,h ; See if still there
or l
jr z,nofcp ; FCP has been removed
ld bc,5 ; Calculate address of FCP command table
add hl,bc
call cmdlist ; Display list of commands
nofcp:
endif ;listfcp
; Print the CPR-resident command names
if listcpr
call print ; Print "CPR"
db cr,lf ; Need CR if no FCP
db 'CP','R'+80h
ld hl,(ccp) ; Get CCP address from ENV
ld bc,offcmd ; Point to command table in CPR
add hl,bc
call cmdlist ; Display the list of commands
endif ;listcpr
; Print the RCP-resident command names
call crlf ; Skip a line
ld hl,rcpname ; Print RCP name
call printhl
ld hl,RCPbegin+5 ; Point to RCP command table
; Fall through to CMDLIST
;----------------------------------------
; Subroutine to display list of commands in a command table (code above
; falls through to this routine -- do not move it). The commands are
; displayed 5 per line with 8 character spaces allowed for each command
; (subject to equates below).
cmdlist:
call crlf ; Start with new line
ld e,(hl) ; Get size of each command name into DE
ld d,0
inc hl ; Point to name of first command
ld c,cmdsline ; Set names-per-line value
cmdlist1:
ld a,(hl) ; Get first character of the command name
or a ; See if it is null
jr nz,cmdlist1a ; If not, continue
ld a,cmdsline ; See if we are already on a new line
cp c
call nz,crlf ; If not, skip a line
ret
cmdlist1a:
if noshow ; Option to suppress wheel-limited cmds
rla ; Shift high bit of name into carry bit
jr nc,cmdlist2 ; If not restricted, go on
call getwhl ; Otherwise, check wheel byte
or a
jr nz,cmdlist2 ; If wheel set, continue as usual
add hl,de ; Otherwise skip this command
jr cmdlist5
endif
; Print leading spaces between names
cmdlist2:
ld a,cmdspace ; Spacing between command names
sub e ; Less length of each command name
ld b,a
cmdlist3:
call spac
djnz cmdlist3
; Print name of command
ld b,e ; Length of each name into B
cmdlist4:
ld a,(hl) ; Get command name character
call conout
inc hl ; Point to next
djnz cmdlist4
dec c ; Decrement count of names on this line
jr nz,cmdlist5 ; Branch if room for more names
call crlf ; Otherwise, end this line and
ld c,cmdsline ; ..reset count for another line of commands
; Skip to next command name
cmdlist5:
inc hl ; Skip jump vector
inc hl
jr cmdlist1 ; Back to process next name
; End RCPH.LIB