; PROGRAM BGECP ; AUTHOR JAY SAGE ; DATE MARCH 21, 1987 ; This program pokes a new name for the extended command processor into the ; BGii command processor in memory. It checks for the presence of the BG ; ID string and displays an error message if it cannot be found. Since the ; location of the ECP name in the BG command processor may change from one ; release to the next, you will have to change the ECPOFF equate below to ; match your version of BGii. Use a debugger to find the address of the ; string CMDRUN in the unmodified command processor. BGECP does perform some ; checking and will display an error message if the program is not configured ; correctly. ; NOTE: THE FOLLOWING EQUATE MUST BE SET TO CONFIGURE THIS PROGRAM ; ---------------------------------------------------------------- ecpoff equ 559h ; Offest to ECP name in command processor idoff equ 5bh ; Offset to BGii ID string in command processor fcb1 equ 005ch ; Default FCB cr equ 0dh lf equ 0ah tab equ 09h bel equ 07h ext print,cout jp bgecp defb 'OFFSET=' defw ecpoff bgecp:: call print ; Skip a line on the screen db cr,lf,0 ; Check for help or information request ld a,(fcb1+1) ; Get first character in name cp '/' ; If help request jp z,help ; ..display built-in screen call check ; Make sure we have valid BGii CPR ; ..terminates if there is an error ld de,ecpoff ; Compute address of ECP name call setaddr ex de,hl ; Put address into DE ld hl,fcb1+1 ; Source for new name ld a,(hl) ; Check first character for blank cp ' ' ; If it is jr z,report ; ..report current ECP ; Copy new name into position push de ; Save pointer to name ld bc,8 ; Characters to copy ldir pop de report:: call ecpprt ; Display ECP name exit:: call print db cr,lf,0 ret check:: ld de,idoff ; Offset to BGii ID call setaddr ld de,idstr ; ID string to compare ld b,4 ; Characters to check call compare jr z,check1 ; Branch if BG loaded call print defb ' BGii not loaded' defb 0 pop hl ; Clean up stack jr exit ; Terminate program check1:: ld de,ecpoff+8 ; Get address of 'COM' in ECP FCB call setaddr ld de,comstr ; Reference string 'COM' ld b,3 ; Characters to compare call compare ret z ; Return if OK call print defb ' BGECP not configured for this version of BGii.' defb 0 pop hl ; Clean up stack jr exit idstr:: defb 'BGii' comstr:: defb 'COM' ; Compare strings compare:: ld a,(de) ; Get reference character cp (hl) ; Compare to actual character ret nz djnz compare ret ; Calculate offset address in command processor setaddr:: ld hl,(1) ; Get BIOS warmboot address add hl,de ; Add offset passed in DE ld de,-1603h ; Offset from BIOS warmboot to CPR entry point add hl,de ret ; Print name of ECP from the FCB in the CPR ecpprt:: call print db 'BGii ECP set to ' db 0 ld b,8 ; Maximum characters to print ecpprt1:: ld a,(de) ; Get current character inc de ; Point to next cp ' ' ; Quit if space ret z call cout ; Display it djnz ecpprt1 ; Loop through name ret help:: call print db tab,tab,'BGECP 1.0' db cr,lf,lf db 'Syntax: BGECP',tab,tab,'Report current BGii ECP' db cr,lf db tab,'BGECP ECPNAME',tab,'Set BGii ECP to ECPNAME' db cr,lf db tab,'BGECP /',tab,tab,'Show this help screen' db cr,lf db 0 ret end