Instruction manual

030f db 0f in a,(0fh) ;clear INTRQ
0311 c9 ret
0312 ;
0312 ;Strings used in subroutines
0312 .. 00 length_entry_string: defm "Enter length of file to load (decimal): ",0
033b .. 00 dump_entry_string: defm "Enter no. of bytes to dump (decimal): ",0
0362 .. 00 LBA_entry_string: defm "Enter LBA (decimal, 0 to 65535): ",0
0384 08 1b .. 00 erase_char_string: defm 008h,01bh,"[K",000h ;ANSI seq. for BS, erase to end of line.
0389 .. 00 address_entry_msg: defm "Enter 4-digit hex address (use upper-case A through F): ",0
03c2 .. 00 address_error_msg: defm "\r\nError: invalid hex character, try again: ",0
03ee .. 00 data_entry_msg: defm "Enter hex bytes, hit return when finished.\r\n",0
041b .. 00 data_error_msg: defm "Error: invalid hex byte.\r\n",0
0436 .. 00 decimal_error_msg: defm "\r\nError: invalid decimal number, try again: ",0
0463 ;
0463 ;Simple monitor program for CPUville Z80 computer with serial interface.
0463 31 ff db monitor_cold_start: ld sp,ROM_monitor_stack
0466 cd 03 00 call initialize_port
0469 21 dc 05 ld hl,monitor_message
046c cd 18 00 call write_string
046f cd 89 02 monitor_warm_start: call write_newline ;re-enter here to avoid port re-init.
0472 3e 3e ld a,03eh ;cursor symbol
0474 cd 0c 00 call write_char
0477 21 08 db ld hl,buffer
047a cd 4c 00 call get_line ;get monitor input string (command)
047d cd 89 02 call write_newline
0480 cd 84 04 call parse ;parse command, returns with jump add. in HL
0483 e9 jp (hl)
0484 ;
0484 ;Parses (interprets) an input line in buffer for commands as described in parse table.
0484 ;Returns with address of jump to action for the command in HL
0484 01 ba 07 parse: ld bc,parse_table ;bc is pointer to parse_table
0487 0a parse_start: ld a,(bc) ;get pointer to match string from parse table
0488 5f ld e,a
0489 03 inc bc
048a 0a ld a,(bc)
048b 57 ld d,a ;de will is pointer to strings for matching
048c 1a ld a,(de) ;get first char from match string
048d f6 00 or 000h ;zero?
048f ca aa 04 jp z,parser_exit ;yes, exit no_match
0492 21 08 db ld hl,buffer ;no, parse input string
57