; ==== ISUAL Flight Software -- Univ of California, Berkeley, SSL ==== ; FDEBUG.A -- stub debug entry points for flight ; ; Revision History: ; 18-Dec-2002 - SPG - ISUAL Flight Software rev 7.3 ; First Official Release include ioports.i ; send byte to output queue ; A - the byte DEBUG_PUTBYTE: ret DEBUG_ASC: ; text follows call: look for '$' or '~' in following string ; (don't show '~' or '$') xthl ; exchange top of stack (TOS) with HL push psw a1: mov a,M ; get string byte cpi '$' ; end of string? jz a2 ; yes cpi '~' ; end with no newline? jz a2nl call debug_putbyte ; no send out byte inx h ; keep looking jmp a1 a2: mvi a,10 ; send Newline call debug_putbyte a2nl: inx h pop psw xthl ; set new return-address as TOS ret ; DEBUG_ASC_HL: ; HL - data value to display in Hex ; text follows call: look for '=' in following string xthl ; exchange top of stack (TOS) with HL push psw stl1: mov a,M ; get string byte call debug_putbyte ; send it out cpi '=' ; end of string? jz found_eq ; yes inx h ; no; keep looking jmp stl1 found_eq: inx h pop psw xthl ; set new return-address as TOS ; call HEXOUT ; tell monitor to display (original) HL as hex ret ; DEBUG_ASC_DEC: ; HL - data value to display in decimal ; text follows call: look for '=' in following string xthl ; exchange top of stack (TOS) with HL push psw ttl1: mov a,M ; get string byte call debug_putbyte ; send it out cpi '=' ; end of string? jz fnd_eq ; yes inx h ; no; keep looking jmp ttl1 fnd_eq: inx h pop psw xthl ; set new return-address as TOS ; call DECOUT ; tell monitor to display (original) HL as decimal ret ; show A= as 2-digit hex DEBUG_SHOWA: ret ; ; show A as 2-digit hex DEBUG_SHOW_HEX1: ret ; ; ================================ ; Serial Input or Output Handler ; ================================ public DEBUG_ISR DEBUG_ISR: ei ret ; ================== ; TRAP handler ; ================== DEBUG_TRAP: di ; no more interrupts out 0 ; force reset trap7: lxi b,7 jmp debug_trap trap6: lxi b,6 jmp debug_trap trap5: lxi b,5 jmp debug_trap trap4: lxi b,4 jmp debug_trap trap3: lxi b,3 jmp debug_trap trap2: lxi b,2 jmp debug_trap trap1: lxi b,1 jmp debug_trap trap05: lxi b,0a5h jmp debug_trap trap15: lxi b,15h jmp debug_trap trap25: lxi b,25h jmp debug_trap trap35: lxi b,35h jmp debug_trap trap45: lxi b,45h jmp debug_trap trap55: lxi b,55h jmp debug_trap trap65: lxi b,65h jmp debug_trap trap0: lxi b,0 jmp debug_trap ; =================== ; Initialization DEBUG_INIT: push psw push h ; stuff all the interrupt vectors except ; RST 3 (used by this DTP serial port) ; ; this will make jumps to 0000 do a Trap mvi a,0CDh ; "CALL" OPCODE sta RST_0 ; 0 lxi h,TRAP0 shld RST_0+1 ; wild RST 7 is also a trap sta RST_7 lxi h,TRAP7 shld RST_7+1 ; sta RST_0+4 ; 0.5 lxi h,TRAP05 shld RST_0+5 ; sta RST_1 ; 1 lxi h,TRAP1 shld RST_1+1 ; sta RST_1+4 ; 1.5 lxi h,TRAP15 shld RST_1+5 ; sta RST_2 ; 2 lxi h,TRAP2 shld RST_2+1 ; sta RST_2+4 ; 2.5 lxi h,TRAP25 shld RST_2+5 ; sta RST_3+4 ; 3.5 lxi h,TRAP35 shld RST_3+5 ; sta RST_4 ; 4 lxi h,TRAP4 shld RST_4+1 ; sta RST_4+4 lxi h,TRAP45 shld RST_4+5 ; sta RST_5 ; 5 lxi h,TRAP5 shld RST_5+1 ; sta RST_6 lxi h,TRAP6 shld RST_6+1 ; sta RST_55 lxi h,TRAP55 shld RST_55+1 ; sta RST_65 lxi h,TRAP65 shld RST_65+1 ; sta RST_75 lxi h,TRAP5 shld RST_75+1 ; ; set TRAP vector mvi a,JMP_OPCODE ; JMP opcode sta TRAP lxi h,DEBUG_TRAP ; address of Trap handler shld TRAP+1 ; set as JMP address ; pop h pop psw ret ; ; display message ; HL - points to null-terminated message string DEBUG_SHOW: ret ; ; make "U" packet to display number in HL as signed decimal public DEBUG_SHOW_DECN DEBUG_SHOW_DECN ret ; ; DEBUG_REGSET: ret ; DEBUG_DUMP: ret ; ; display spacecraft time as hh:mm:ss DEBUG_SHOWMET: ; HL - points to 6 bytes of MET ret ; display ISUAL 10-byte time as hh:mm:ss.xxx DEBUG_SHOWUT: ; HL - points to 10 bytes of UT ret ; ; Called from places the program shouldn't get to DEBUG_ASSERT: out 0