***********************************************************************
#include <GENERAL.H>
; ================ EQUATES =========================================
NUM1 EQU 0x5A
NUM2 EQU 0x39
REG1 EQU 0x40
REG2 EQU 0x41
; =======================================================================
__CONFIG 0X3FF2 ;This is the control bits for CONFIG register
ORG 0X0000 ;RESET or WDT reset vector
GOTO START
ORG 0X0004 ;Regular INT vector RESERVE THIS SPACE. DON'T USE IT
RETFIE
START
CLRW
BSF STATUS,RP0
MOVWF TRISB
BCF STATUS,RP0
MOVWF PORTB
BTFSC PORTA,0 ;skip next instruction if RA0 = 0 and go to SUM
GOTO SUM
CLRW
MOVLW NUM2 ;put NUM2 in W
SUBLW NUM1 ;subtract NUM2 in W from NUM1
MOVWF REG1 ;save the result in REG1
MOVF STATUS,W ;copy the STATUS register value to W (not necessary but requested by professor)
MOVWF REG2 ;and then to REG2 (not necessary but requested by professor)
MOVWF PORTB
GOTO DONE
SUM
CLRW
MOVLW NUM1 ;put NUM1 in W
ADDLW NUM2 ;add NUM2 with the result in W
MOVWF REG1 ;save the result in REG1
MOVF STATUS,W ;copy the STATUS register value to W
MOVWF REG2 ;and then to REG2
MOVWF PORTB
DONE
END