Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/31/02 01:13
Read: times


 
#23674 - converting an assembly to C
hello,
help needed on converting an assembly prog "tw2hx" to C. if u can provide even a few steps that would be helpful. I am providing the entire code...


--------------------------------------------
----- main program -----

TW2HX :
PUSH ACC
MOV A,R0
PUSH ACC
CALL SWAP_DPTR
MOVX A,@DPTR
INC DPTR
CALL CH2HX
SWAP A
MOV R0,A

MOVX A,@DPTR
INC DPTR
CALL CH2HX
XCH A,R0
ORL A,R0
CALL SWAP_DPTR
MOVX @DPTR,A
INC DPTR

POP ACC
MOV R0,A
POP ACC
RET

---------------------------------------------
CH2HX :

CLR OV
CLR C
SUBB A,#48
CJNE A,#23,IS_1 JMP HX_BAD

IS_1 :
JNC HX_BAD
CJNE A,#09,IS_2
JMP HX_GOOD
IS_2 :
JC HX_GOOD
CJNE A,#16,IS_3
JMP HX_BAD
IS_3 :
JC HX_BAD
CLR C
SUBB A,#07

JMP HX_GOOD

HX_BAD: SETB OV


HX_GOOD:
CLR C
RET

---------------------------------------------
SWAP_DPTR :
PUSH ACC

MOV A,DPL
MOV DPL,R7
MOV R7,A
MOV A,DPH
MOV DPH,R6
MOV R6,A

POP ACC
RET
--------------------------------------------

regards,
roger

List of 6 messages in thread
TopicAuthorDate
converting an assembly to C            01/01/70 00:00      
RE: converting an assembly to C            01/01/70 00:00      
RE: converting an assembly to C            01/01/70 00:00      
RE: converting an assembly to C            01/01/70 00:00      
RE: converting an assembly to C            01/01/70 00:00      
RE: converting an assembly to C            01/01/70 00:00      

Back to Subject List