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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/26/99 07:17
Read: times


 
#391 - RE: Greater then less then
I had written a few macros for 8051 for Metalink's assembler. There are a number of compare-jump macros. Part of the codes are attached. They were written for single byte compare/jump but you should be able to create 16-bit version from two of these macros. By the way, I had also send a complete version of my macros to 8052com.

; Jump to arg2 if A is equal to arg1
JAEQ macro arg1,arg2
cjne a,arg1,$+6
ljmp arg2
endm

; Jump to arg2 if A is not equal arg1
JANE macro arg1,arg2
cjne a,arg1,$+5
sjmp $+5
ljmp arg2
endm

; Jump to arg1 if A is not zero
JANZ macro arg1
jz $+5 ; jmp zero
ljmp arg1
endm

; Jump to arg1 if A is zero
JAZE macro arg1
jnz $+5 ; jmp not zero
ljmp arg1
endm

; Jump to arg2 if A is greater than arg1
JAGT macro arg1,arg2
cjne a,arg1,$+5
sjmp $+7 ; jmp equal
jc $+5 ; jmp less than
ljmp arg2
endm

; Jump to arg2 if A is less than arg1
JALT macro arg1,arg2
cjne a,arg1,$+3
jnc $+5 ; jmp greater or equal
ljmp arg2
endm

; Jump to arg2 if A is greater or equal to arg1
JAGE macro arg1,arg2
cjne a,arg1,$+3
jc $+5 ; jmp less than
ljmp arg2
endm

; Jump to arg2 if A is less or equal to arg1
JALE macro arg1,arg2
cjne a,arg1,$+6
ljmp arg2 ; jmp equal
jnc $+5 ; jmp greater than
ljmp arg2
endm


List of 6 messages in thread
TopicAuthorDate
Greater then less then            01/01/70 00:00      
RE: Greater then less then            01/01/70 00:00      
RE: Greater then less then            01/01/70 00:00      
RE: Greater then less then            01/01/70 00:00      
RE: Greater then less then            01/01/70 00:00      
RE: Greater then less then            01/01/70 00:00      

Back to Subject List