poll_vector = 0x80 ;; pointer to serial poll routine idle_vector = 0x82 ;; pointer to idle routine cli_vector = 0x84 ;; pointer to cli routine send_vector = 0x86 ;; pointer to send routine prompt_vector = 0x88 ;; pointer to prompt routine utility_vector = 0x8a ;; pointer to generic utility vector ;; to be used for adding drivers for external hardware ; ; print_hex prints the 16-bit quantity in R7:R6 on the console ; print_hex: mov a, r7 acall phex mov a, r6 ;; falls thru to phex ; ; phex prints the 8-bit value in the accumulator on the console ; phex: push acc swap a acall ph pop acc ;; falls thru to ph ; ; ph prints the 4-bit value in the accumulator on the console ; ph: anl a, #0xf cjne a, #0xa, ph1 ph1: jc ph2 add a, #('A'-'0')-0xa ph2: add a, #'0' mov r1, a ; ; send() prints the character in r1 on the console ; send: mov r0, #send_vector do_icall: mov a, @r0 inc r0 mov dpl, a mov a, @r0 mov dph, a clr a jmp @a+dptr ; ; print_str prints te null terminated string pointed to by dptr ; on the console ; print_str: mov r7, dph mov r6, dpl l1: mov dph, r7 mov dpl, r6 movx a, @dptr mov r1, a jz d1 inc r6 acall send sjmp l1 d1: ret ; ; crlf prints a carriage return and linefeed on the console ; crlf: mov r1, #13 acall send mov r1, #10 ajmp send ; ; poll returns the input character from the console if there's ; one else 0 in the accumulator ; poll: mov r0, #poll_vector ajmp do_icall ; ; ;