;Instead of
IF A>=0x03
 SETB GAIN_ERROR
 RET
ENDIF
;I have written
CJNE A, #0x03, INC_A_1

 SETB GAIN_ERROR
 RET
INC_A_1
; I just have to hope that there is no error above 4

;Check the carry flag here. If A > 3 it will be clear

;and for
IF A=#0x00
 SETB GAIN_ERROR
 RET
ENDIF
; I made a simple JZ opperation
JZ ERR