User guide
Table 1. hex_to_asc.asm: Converts Hex Data to Its Equivalent ASCII
;example to explain the usage of MAX-IDE
 SEGMENT DATA ; DATA segment starts here
 ; Default location = 00
; Initialize Data memory
ch: DB 0 ;holds ASCII value of upper HEX nibble
ch1: DB 0 ;holds ASCII value of lower HEX nibble
ch2: DB 0 ;holds HEX byte
ch3: DB 0 
 SEGMENT CODE ; CODE segment starts here
 ORG 0 ; SET Absolute address of code = 0
MAXQ30 EQU 3
MAXQ20 EQU 2
MAXQ10 EQU 1
;Choose MAXQ to be MAXQ10, MAXQ20 or MAXQ 30 depending 
;on the architecture you want to use.
MAXQ EQU MAXQ30
; This example is with MAXQ30
IF(MAXQ=MAXQ30)
 #define data_pointer DP[0].b 
; for maxq30 , the data pointer is specified to be in byte mode or word mode 
by using the 
; notation DP[0].b or DP[0].w 
ENDIF
IF(MAXQ=MAXQ20)
 #define data_pointer DP[0]
 MOVE DPC,#18h
; for maxq 20, the data pointer is specified to be in byte mode or word mode
through the 
; DPC register 
ENDIF
IF(MAXQ=MAXQ10)
 #define data_pointer DP[0]
 MOVE DPC,#18h
; for maxq 10, the data pointer is specified to be in byte mode or word mode
through the 
; DPC register 
ENDIF
 JUMP main
 ORG 20h ; SET Absolute address of code = 32 
HEX
Hex2Asc:
 MOVE A[1], A[0] ; store the HEX value for future use
 MOVE DP[0], #ch2 
 MOVE @data_pointer, A[0] ; store the HEX value @ #ch2 location
 MOVE A[0], A[1] ; Process upper nibble
 MOVE AP,#0
 SRA4
 ADD #030h ; value = value + '0'
 MOVE A[2],A[0]
 SUB #03ah
 MOVE A[0],A[2]
 SJUMP C,??Hex2Asc_0
 ; if value > '9', value = value + 
('A' - '9') + 1
 ADD #07h
 AND #0ffh
??Hex2Asc_0:
 MOVE DP[0],#ch ; store ASCII value of upper HEX 
nibble
Page 6 of 11










