disp MACRO Table1, Table2
local Display_1
local Display_2
local Display_3
local Display_4
call LCD_Clr
clrf offset ;set offset register to zero
movlw d'1' ;set count register to the first
movwf count ;|character in the table
Display_1
movf count, w ;put count value in offset
movwf offset ;|
movlw LOW Table1 ;get low address of the table
addwf offset, f ;add the low address of the offset value
movlw HIGH Table1 ;get high adress of the table
btfsc STATUS, C ;check if carry bit is set from the add operation
addlw 1 ;if carry set add 1 to w
movwf PCLATH ;place the high address in PCLATH
movf offset, w ;place low address in w
call Table1 ;get a character from the text table
xorlw 0x00 ;is it a zero?
btfsc STATUS, Z ;check if zero bit is set from the above compare
goto Display_2 ;if zero set get out of here
call LCD_Char ;zero not set, display character
incf count, f ;increment count register
goto Display_1 ;start again and get next character in table
Display_2
call LCD_Line2
clrf offset ;set offset register to zero
movlw d'1' ;set count register to the first
movwf count ;|character in the table
Display_3
movf count, w ;put count value in offset
movwf offset ;|
movlw LOW Table2 ;get low address of the table
addwf offset, f ;add the low address of the offset value
movlw HIGH Table2 ;get high adress of the table
btfsc STATUS, C ;check if carry bit is set from the add operation
addlw 1 ;if carry set add 1 to w
movwf PCLATH ;place the high address in PCLATH
movf offset, w ;place low address in w
call Table2 ;get a character from the text table
xorlw 0x00 ;is it a zero?
btfsc STATUS, Z ;check if zero bit is set from the above compare
goto Display_4 ;if zero set get out of here
call LCD_Char ;zero not set, display character
incf count, f ;increment count register
goto Display_3 ;start again and get next character in table
Display_4
bcf flags, SWITCH ;Changed page, reset SWITCH on button pressed flag
endm