-- (c) William Welch 2004 -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; -- you must not claim that you wrote the original software. -- If you use this software in a product, an acknowledgment in -- the product documentation would be appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must -- not be misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source distribution. -- -- This license is commonly known as the zlib/libpng License. -- -- console.jal bvwelch 15 may 2004 -- revised 16 June 2004 -- User interface and "debugging" routines. Feel free to replace them. include ./javi_lib/f452_serial -- from wisp628 by Wouter van Ooijen function hex_to_ascii( byte in x ) return byte is const c1 = 0 - 0x0A const c2 = ( "A" - "9" ) - 1 const c3 = "0" + 0x0A assembler bank movfw x addlw c1 ; to get a carry for A..F skpnc ; got a carry? addlw c2 ; yes, add 9+1 .. F offset addlw c3 ; add remaining offset for '0' bank movwf x end assembler return x end function procedure puthex ( byte in v ) is putc = hex_to_ascii (v >> 4) putc = hex_to_ascii (v & 0x0f) putc = " " end procedure procedure pr_err ( byte in m1, byte in m2, byte in m3 ) is putc = "E" putc = "r" putc = "r" putc = ":" putc = " " putc = m1 putc = m2 putc = m3 putc = 13 putc = 10 end procedure