error A2031: gisters not allowed [How to Solve]

Error condition

.WHILE CL < BUF_L
			.IF BUF[CX] > MAX
				MOV MAX , BUF[CX]
			.ENDIF
		.ENDW

Cause of occurrence

It can only be used as an address register in the stack segment for BX, BP, Si, Di BP

Solution:

Change CXin the code to BX

Read More: