* * Hex Math routine for Solos monitor * * Syntax: HM value1 value2 * Values can be anything from 0 to FFFFH * Only legal Hex permitted. Overflow or * underflow is ignored. Both values must * be present. * * Subroutine addresses within Solos monitor * SOUT EQU 0C019H Output a character from B SCONV EQU 0C33AH Get a 16 bit value to HL ADOUT EQU 0C3E8H Output a 16 bit value from HL NLOOP EQU 0C56AH Output a string pointed to by HL * CUTAB ORG 0C83CH Custom command table entry * ASC 'HM' Command syntax DW HMATH DB 0 End of table mark * HMATH ORG 0C900H Hex Math routine address * CALL SCONV Get value1, abort if missing PUSH H Save it CALL SCONV Get value2, abort if missing PUSH H Save it LXI H,MSG Point to format string MVI D,6 String counter CALL NLOOP Send it out POP D Get value2 to DE POP H Get value1 to HL PUSH H Save value1 again PUSH D Save value2 again DAD D Add DE to HL CALL ADOUT Send out the result POP D Get value2 back to DE POP H Get value1 back to HL * MOV A,D Now get two's complement CMA . of DE to find difference MOV D,A MOV A,E CMA . MOV E,A INX D * DAD D Add it to HL MVI B,'-' Send out minus sign CALL SOUT JMP ADOUT Send out minus result * MSG: ASC ' = +' * END *