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
/
MBUG
/
MBUG084.ARC
/
BEEMON.ASC
< prev
next >
Wrap
Text File
|
1979-12-31
|
8KB
|
496 lines
; *** MICROBEE MONITOR V2.0 12/8/83 ***
CTRC EQU 03H
CLS EQU 0CH
ACR EQU 0DH
ALF EQU 0AH
CTRH EQU 08H
CTRS EQU 13H
CTRX EQU 18H
DEL EQU 7FH
PROMPT EQU '.'
BUFLEN EQU 128D
EXIT EQU 8021H ;BACK TO BASIC ??
ORG 0400H
MONITR LD SP,STK
CALL BOOT ;JUST CLEAR THE SCREEN
CALL INTRO ;INTRODUCTION
; *** MAIN PROGRAM OF THE MONITOR ***
MON1 CALL CRLF
LD C,PROMPT
CALL PUTCH
LD HL,BUFF
CALL GETLN
LD A,(BUFF)
CP ACR
CALL NZ,SCANER
JP MON1 ;GO AGAIN
;**** SUBROUTINES ****
GETLN LD E,0
GETLN1 CALL CONIN
CP ' '
JP C,GETLN4
CP 'Z'+1
JP C,GETLN2
AND 5FH
GETLN2 LD (HL),A
LD A,BUFLEN
CP E
RET Z
LD A,(HL)
INC HL
INC E
LD C,A
CALL PUTCH
JP GETLN1
GETLN4 CP CTRH
JP Z,GETLN5
CP CTRX
JP Z,CLLINE
CP ACR
JP NZ,GETLN1
LD (HL),A
CRLF LD C,ACR
CALL PUTCH
LD C,ALF
CALL PUTCH
RET
GETLN5 LD A,E
OR A
JP Z,GETLN1
LD C,CTRH
CALL CONOUT
LD C,' '
CALL CONOUT
LD C,CTRH
CALL CONOUT
DEC E
DEC HL
JP GETLN1
CLLINE LD C,CTRH
CLINE1 LD A,E
OR A
JP Z,GETLN
CALL CONOUT
LD C,' '
CALL CONOUT
LD C,CTRH
CALL CONOUT
DEC HL
DEC E
JP NZ,CLINE1
JP GETLN
;
PUTCH CALL CONOUT
CALL CONST
ëOR A
RET Z
CALL CONIN
CP CTRS
JP Z,PAWZ
JP MON1
PAWZ CALL CONIN
CP CTRC
JP Z,MON1
RET
;**** SIMPLE SCANNER *****
SCANER LD HL,BUFF
LD A,(HL)
INC HL
LD (CURSOR),HL
SUB 'A'
JP C,ERROR
CP 'Z'-'A'+1
JP NC,ERROR
ADD A,A
LD HL,TABLE
LD D,0
LD E,A
ADD HL,DE
LD E,(HL)
INC HL
LD D,(HL)
EX DE,HL
JP (HL)
TABLE DW ERROR
DW BREAK
DW ERROR
DW DUMP
DW EXIT
DW ERROR
DW GO
DW HELP ;CALL INTRO COMMANDS
DW ERROR
DW ERROR
DW ERROR
DW ERROR
DW ERROR
DW ERROR
DW ERROR
DW ERROR
DW ERROR
DW RESUME
DW SUBST
DW ERROR
DW ERROR
DW ERROR
DW ERROR
DW ERROR
DW ERROR
DW ERROR
; ** ERROR HANDLER **
ERROR LD C,'?'
CALL CONOUT
CALL CRLF
JP MON1
;** SCANNER TOOLS **
SPSKIP LD HL,(CURSOR)
SPSKL LD A,(HL)
INC HL
CP ACR
JP Z,ERROR
CP ' '
JP Z,SPSKL
CP ','
JP Z,SPSKL
; CP TAB ;MAY HAVE TO CHANGE THIS
; JP Z,SPSKL
DEC HL
LD (CURSOR),HL
RET
GETPAR PUSH DE
PUSH BC
LD HL,0
GP1 CALL GETCHR
CALLëGP2
JP C,GP3
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
OR L
LD L,A
JP GP1
GP2 SUB '0'
RET C
CP 'F'-'0'+1
CCF
RET C
CP 10
CCF
RET NC
SUB 'A'-'9'-1
RET
GP3 CALL UNGETC
POP BC
POP DE
RET
; ** GETCHAR AND UNGETCH **
GETCHR PUSH HL
LD HL,(CURSOR)
LD A,(HL)
INC HL
LD (CURSOR),HL
POP HL
RET
UNGETC PUSH HL
LD HL,(CURSOR)
DEC HL
LD (CURSOR),HL
POP HL
RET
DUMP CALL SPSKIP
CALL GETPAR
EX DE,HL
CALL SPSKIP
CALL GETPAR
EX DE,HL
D0 PUSH HL
CALL H16 ;PRINT INIT ADDRESS
CALL TAB ;TAB ACROSS 2 SPACES
D1 LD A,(HL) ;GET BYTE FROM MEMORY
CALL H8 ;
LD C,' ' ;PRINT A
CALL PUTCH
INC HL ;POINT TO NEXT BYTE
CALL D8 ;REACHED THE END ?
JP C,D2 ;DUMP REMAINING ASCII
LD A,L ;
AND 0FH ;MASK LOWER BITS
JP NZ,D1 ;IF NOT ZERO KEEP DUMPING
D2 LD C,' ' ;ELSE SPACE AND DUMP
CALL PUTCH ;ASCII
POP HL ;GET BASE POINTER
D4 LD A,(HL) ;GET CHAR FROM MEMORY
AND 7FH ;STRIP MSB
CP ' ' ;IF LESS THAN SPACE THEN
CALL M,D7 ;REPLACE WITH DOT
LD C,A
CALL PUTCH ;OUTPUT CHAR
INC HL ;POINT TO NEXT BYTE
CALL D8 ;
JP C,CRLF
D5 LD A,L
AND 0FH
JP NZ,D4
CALL CRLF
JP D0
;
; ** HEX OUTPUT SUBROUTINES **
D7 LD A,'.' ;PRINT DOT
RET
D8 LD A,E
SUB L
LD A,D
SBC A,H
RET
H16 LD A,H
CALL H8
LD A,L
H8 PUSH AF
RRCA
RRCA
RRCA
RRCA
CALL H4
POP AF
H4 AND 0FH ;MASK OUT UNWANTED NIBBLE
ADD A,'0' ;CONVERT IT TO ASCII
CP '9'+1 ;IF > 9 THEN ADJUST IT TO
CALL P,HADJ ;BE A HEX DIGIT
LD C,A
CALL PUTCH
RET
HADJ ADD A,'A'-1-'9' ;MAKE UP THE DIFFERENCE
RET
; ** ROUTINE TO PROVIDE A TAB OF 2 SPACES **
TAB LD A,' ' ;8 SPACES
LD C,A ;PUT SPACE IN C
CALL CONOUT ;SPACE
LD C,A
CALL CONOUT ;ANOTHER SPACE
RET
; ** SUBSTITUTE MEMORY ROUTINE **
SUBST CALL SPSKIP
CALL GETPAR
SUBST1 CALL H16
LD C,' '
CALL PUTCH
PUSH HL
LD A,(HL)
CALL H8
LD C,' '
CALL PUTCH
LD HL,BUFF
CALL GETLN
LD HL,BUFF
LD (CURSOR),HL
LD A,(HL)
CP '.'
JP Z,MON1
CP ACR
JP Z,SUBST2
CALL GETPAR
LD A,L
POP HL
LD (HL),A
INC HL
JP SUBST1
SUBST2 POP HL
INC HL
JP SUBST1
;
; ** GO TO MEMORY LOCATION AND RUN PROGRAM **
GO CALL SPSKIP
CALL GETPAR
EX DE,HL
LD HL,WBOOT
PUSH HL
EX DE,HL
JP (HL)
;**** BREAKPOINT COMMAND ****
BREAK CALL SPSKIP
CALL GETPAR
LD A,(HL)
LD (INSTR),A
LD (HL),000EFH
LD (TEMPAD),HL
RET
;***** TRAP ROUTINE *****
TRAP EX (SP),HL
DEC HL
LD (TEMPAD),HL
PUSH DE
PUSH BC
PUSH AF
LD HL,0
ADD HL,SP
LD A,(HL)
CALL FLPRT
CALL ILPRT
DEFM ' A= 0'
INC HL
LD A,(HL)
CALL H8
CALL ILPRT
DEFM ' BC= 0'
CALL TRL
CALL ILPRT
DEFM ' DE= 0'
CALL TRL
CALL ILPRT
DEFM ' HL= 0'
CALL TRL
CALL ILPRT
DEFM ' SP= 0'
LD HL,8
ADD HL,SP
CALL H16
CALL ILPRT
DEFM ' PC= 0'
LD HL,(TEMPAD)
CALL H16
LD HL,(TEMPAD)
LD (LASTBR),HL
LD A,(INSTR)
LD (HL),A
JP MON1
TRL INC HL
INC HL
LD A,(HL)
CALL H8
DEC HL
LD A,(HL)
CALL H8
INC HL
RET
FLPRT LD D,8
FLL RLA
LD B,A
LD A,'0'
ADC A,0
LD C,A
CALL PUTCH
LD A,B
DEC D
JP NZ,FLL
RET
ILPRT EX (SP),HL
ILL LD A,(HL)
CP '0'
JP Z,ILEX
LD C,A
CALL PUTCH
INC HL
JP ILL
ILEX INC HL
EX (SP),HL
RET
;**** RESUME COMMAND ****
RESUME POP AF
POP AF
POP BC
POP DE
LD HL,(LASTBR)
EX (SP),HL
RET
;**** INTRODUCTION ****
INTRO LD HL,MSG0
CALL MESS
CALL CRLF
CALL CRLF
LD HL,MSG1
CALL MESS
CALL CRLF
HELP CALL CRLF ;HELP COMMAND CALLS TO HERE
LD HL,MSG2
CALL MESS
CALL CRLF
LD HL,MSG7
CALL MESS
CALL CRLF
LD HL,MSG3
CALL MESS
CALL CRLF
LD HL,MSG6
CALL MESS
CALL CRLF
LD HL,MSG5
CALL MESS
CALL CRLF
LD HL,MSG9
CALL MESS
CALL CRLF
LD HL,MSG8
CALL MESS
CALL CRLF
LD HL,MSG4
CALL MESS
CALL CRLF
CALL CRLF
RET
;**** ROUTINE TO PRINT MESSAGES ON THE SCREEN ****
MESS LD A,(HL)
CP '$' ;CHECK FOR TERMINATION CONDITION
RET Z ;TERMINATION CONDITION
LD C,A ;GET READY FOR PRINTING
CALL CONOUT ;PRINT IT
INC HL ;POINT TO NEXT CHARACTER
JP MESS ;GO AGAIN
;**** FAKE BIOS ****
; JUMP TABLE
FBIOS JP BOOT
JP WBOOT
JP CONST
JP CONIN
JP CONOUT
JP LIST
JP PUNCH
JP READER
BOOT LD A,0C3H ;CODE FOR JUMP INSTRUCTION
LD (00028H),A
LD HL,TRAP
LD (00029H),HL
LD C,CLS ;CLEAR THE SCREEN
CALL CONOUT
RET
WBOOT LD SP,STK
JP MON1
; I/O ROUTINES
CONST CALL 8009H ;MICROBEE MCHINL ROUTINE
LD A,0 ;RETURN WITH 00H IF NO CH AVAIL
RET Z
DEC A ;RETURN WITH FFH IF CHAR AVAIL
RET
CONIN CALL 8006H ;MICROBEE MCHINW ROUTINE
AND 7FH ;STRIP HIGH BIT
RET
CONOUT LD B,C ;PUT CHAR INTO C READY FOR CALL
CALL 800CH ;TO MICROBEE ROUTINE DGOS_VDR
RET
LIST LD A,C ;NEED PRINTER ROUTINE
RET
PUNCH RET ;TO BE INSERTED
READER RET
;
;*** NECESSARY CONSTANTS ***
BUFF DS 128
DS 64
STK EQU $
CURSOR DS 2
INSTR DS 1
TEMPAD DS 2
LASTBR DS 2
;
;**** INTRODUCTION MESSAGES ****
MSG0 DEFM ' <<<< BEE-MON V2.0 >>>>$'
MSG1 DEFM ' Converted by Ian D. Jolly, August 1983$'
MSG2 DEFM ' Commands...$'
MSG3 DEFM ' (2) D(ump) XXXX,YYYY$'
MSG4 DEFM ' (7) S(ubstitute) XXXX$'
MSG5 DEFM ' (4) G(o) XXXX$'
MSG6 DEFM ' (3) E(xit) to Basic$'
MSG7 DEFM ' (1) B(reakpoint) XXXX$'
MSG8 DEFM ' (6) R(esume) after Breakpoint$'
MSG9 DEFM ' (5) H(elp)$'
END