All — I’m working on a reconstruction project (an unpublished time slicing OS for an 8080-target) and the command dispatcher code is missing. So, I’m trying to write a functional equivalent and I’m having some problems that I could use some help with. The OS is like a monitor but has a callable API (which I’m ignoring for now). The command loop is pretty generic — set the stack, get a line from the console, parse it and execute, and jump back. The “get line” is pretty generic and actually works fine. Grab chars and put them in a zero-terminated buffer; return on CR. The table of commands is structured like the following. The target address right now simply prints a unique character on the screen and jumps back to the top of the monitor loop via a RET (since the parser is call’ed). ; Command dispatch table, padded to max chars of 4 CMD_LEN equ 5 ; including NULL NUM_CMDS equ 26 CTABLE: db 'AS ',0 ; assign dw ASSIGN ; target address {25 additional entries} Here’s what I’ve come up with for the parse and execute routine, which admittedly is based on some AI stuff. ; ----------------------------- ; SEARCH - see of the command entered is valid. ; ----------------------------- PARSE: lxi H,TBUFF ; get ptr of command buffer MVI B,NUM_CMDS ; Set command count LXI D,CTABLE ; Point to command table LOOP: PUSH H ; Save input buffer pointer PUSH D ; Save table pointer CALL STR_COMPARE ; Compare input with table entry JZ CMD_FOUND ; If Zero flag set, strings match POP D ; Restore table pointer POP H ; Restore input pointer ; Move to next table entry LXI H,CMD_LEN + 2 ; Size of entry (string + address) DAD D XCHG DCR B ; Decrement command count JNZ LOOP ; Continue if more commands JMP CMD_NOT_FOUND CMD_FOUND: POP D ; Clean stack (table pointer) POP H ; Clean stack (input pointer) INX D INX D ; DE points to target address in table XCHG ; move to HL MOV A,M ; Get low byte of routine address MOV E,A ; set (DE) to command number MVI D,0 DAD D DAD D ; (HL)=(CMDADR)+2*(command number) MOV A,M ; now pick out this address INX H MOV H,M MOV L,A PCHL ;now execute it. ; Routines return to the monitor via a RET ; RET CMD_NOT_FOUND: XRA A ; sets Z-flag ret ;--- String Comparison Subroutine --- ; Inputs: HL = Input Buffer, DE = Table Entry ; Destroys: A, HL, DE ; Z=1 if match STR_COMPARE: MVI C,CMD_LEN ; Comparison length COMP_LOOP: LDAX D CMP M RNZ ; Return if not equal INX D INX H DCR C ; decrement count JNZ COMP_LOOP ; Loop XRA A ; Match found: set Zero flag RET In no case that I’ve experimented with does the parser print the right character for the routine that’s typed in. The character case is right — upper-case is returned from the keyboard input routine. It’s been a long time since I’ve worked in 8080 so a different set of eyes would be greatly appreciated. Thanks! Rich -- Rich Cini http://cini.classiccmp.org https://github.com/RichCini