本帖最后由 冷漠 于 2010-1-23 12:49 编辑
?PR?_binary_to_ascii?TYPEDEF SEGMENT CODE
?PR?main?TYPEDEF SEGMENT CODE
?CO?TYPEDEF SEGMENT CODE
EXTRN CODE (_putchar)
EXTRN CODE (?C_STARTUP)
PUBLIC main
PUBLIC _binary_to_ascii
RSEG ?CO?TYPEDEF
?SC_0:
DB '0' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9'
DB 'A' ,'B' ,'C' ,'D' ,'E' ,'F' ,000H
; #include <stdio.h>
;
; binary_to_ascii( char value )
RSEG ?PR?_binary_to_ascii?TYPEDEF
_binary_to_ascii:
USING 0
; SOURCE LINE # 16
;---- Variable 'value?040' assigned to Register 'R7' ----
; {
; SOURCE LINE # 17
;
; putchar("0123456789ABCDEF"[ value ] );
; SOURCE LINE # 19
MOV A,R7
RLC A
SUBB A,ACC
MOV R6,A
MOV A,#LOW (?SC_0)
ADD A,R7
MOV DPL,A
MOV A,#HIGH (?SC_0)
ADDC A,R6
MOV DPH,A
CLR A
MOVC A,@A+DPTR
MOV R7,A
LJMP _putchar
; END OF _binary_to_ascii
;
; }
END |