;
PutADRESH
movf ADRESH,W ; 0..255 |B0
call PutByte ; send it as ASCII Hex, 00..FF |B0
movlw ' ' ; |B0
call Put232 ; send space char |B0
movf ADRESH,W ; 0..255 |B0
call PutDec ; send it as ASCII Dec, 000..255 |B0
movlw '\n' ; |B0
call Put232 ; send line feed |B0
movlw '\r' ; |B0
call Put232 ; send return |B0
return ; |B0
;
; Print byte in W as two ASCII nybbles
;
PutByte movwf Temp ; save byte |B0
swapf Temp,W ; swap nybbles in W |B0
call Hex2Asc ; process left nybble |B0
movf Temp,W ; process right nybble |B0
Hex2Asc andlw b'00001111' ; mask off left nybble |B0
addlw a'6' ; 0-9>36-3F, A-F>40-45 |B0
btfsc STATUS,DC ; A..F? no, skip, else |B0
addlw h'07' ; A-F (40-45) > 47-4C |B0
addlw 0-6 ; '0'..'9' or 'A'..'F' |B0
goto Put232 ; print ASCII nybble |B0
;
; Print byte in W as three ASCII chars, 000..255
;
PutDec
clrf Tens ; 15 words |B0
clrf Huns ; |B0
div10a
movwf Ones ; |B0
incf Tens,F ; |B0
addlw -10 ; |B0
bc div10a ; |B0
decf Tens,W ; |B0
div100
movwf Tens ; |B0
incf Huns,F ; |B0
addlw -10 ; |B0
bc div100 ; |B0
decf Huns,W ; |B0
iorlw '0' ; make it ASCII '0'..'9' |B0
call Put232 ; print Huns |B0
movf Tens,W ; |B0
iorlw '0' ; make it ASCII '0'..'9' |B0
call Put232 ; print Tens |B0
movf Ones,W ; |B0
iorlw '0' ; make it ASCII '0'..'9' |B0
goto Put232 ; print Ones |B0