|
Для примера - одна команда AND. Длинно и тухло...
; ***********
; *** AND ***
; ***********
; logical AND (word or bit) with accumulator
; modifiers: N,b,#,(
; flags: Z
H_AND bsf INTCON,GIE ; restore interrupt
btfsc OPCODE,BIT_BRACKET ; "(" ?
goto H_BRACKET ; yes; *** can execute now
btfsc MODIFIER, BIT_I ; immediate?
goto H_AND_I ; yes; *** direct
movf PARAM2,W ; get addr
movwf FSR ; set pointer to lo byte
btfsc MODIFIER,BIT_B ; boolean?
goto H_AND_B_D ; yes; *** direct word
disable_GIE ;
movf 0,W ; get lo byte
andwf ACCL,W ; AND low byte
movwf HWRK ; temp store
btfsc MODIFIER,BIT_N ; negation?
comf HWRK,W ; yes
movwf ACCL ; store result
incf FSR ; point to hi byte
movf 0,W ; get hi byte
andwf ACCH,W ; AND hi byte
movwf HWRK ; temp store
btfsc MODIFIER,BIT_N ; negation?
comf HWRK,W ; yes
movwf ACCH ; store result
bsf INTCON,GIE ; enable
goto H_LD_ZCHK ; check if result is zero; *** immediade
H_AND_I
btfsc MODIFIER,BIT_B ; boolean?
goto H_AND_B_I ; yes
; *** immediate word
movf PARAM2,W ; get low byte
andwf ACCL,W ; AND low byte
movwf HWRK ; temp store
btfsc MODIFIER,BIT_N ; negation?
comf HWRK,W ; yes
movwf ACCL ; store result
movf PARAM1,W ; get hi byte
andwf ACCH,W ; AND hi byte
movwf HWRK ; temp store
btfsc MODIFIER,BIT_N ; negation?
comf HWRK,W ; yes
movwf ACCH ; store result
goto H_LD_ZCHK ; check if result is zero; *** direct bit
H_AND_B_D
btfsc MODIFIER,BIT_3 ; bit in hi byte?
incf FSR ; yes
call H_GET_BIT ; read bit into HWRK,0
movf IFLAGS,W ; bit acc is in IFLAGS,0
andwf HWRK ; HWRK:= HWRK and IFLAGS
H_AND_B_STORE
btfsc MODIFIER,BIT_N ; negation?
goto H_AND_B_DN ; yes
bcf IFLAGS,BIT_ACC ; transfer result
btfsc HWRK,0 ; =1?
bsf IFLAGS,BIT_ACC ; yes
goto H_LD_B_CHK ; check for 0 result and exit
H_AND_B_DN
bsf IFLAGS,BIT_ACC ; transfer result
btfsc HWRK,0 ; =1?
bcf IFLAGS,BIT_ACC ; yes
goto H_LD_B_CHK ; check for 0 result and exit
; *** immediate bit in PARAM2,0
H_AND_B_I
movf IFLAGS,W ; bit acc in IFLAGS,0
andwf PARAM2,W ; operand in PARAM2,0
movwf HWRK ; HWRK:=IFLAGS and PARAM2
goto H_AND_B_STORE ; store result; *** bracket
H_BRACKET
call H_CMD_TO_STACK ; push to stack
goto H_LD_GIE ; load operand into acc
E-mail: info@telesys.ru