-- (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. -- -- whack452.jal 27 may 2005 -- This is for a 18F452 connected to a EDTP PacketWhacker card -- -- FIXME -- double check all of these fuses !!! pragma target fuses 0x00, 0 pragma target fuses 0x01, 0b_00_1_00_010 -- no switching, HS, no PLL pragma target fuses 0x02, 0b_0000_11_1_0 -- Vbor=2.0, bor, PWRT pragma target fuses 0x03, 0b_0000_111_0 -- no wdt pragma target fuses 0x04, 0 pragma target fuses 0x05, 0 pragma target fuses 0x06, 0b_1_0000_0_0_0 -- no debug, no LVP, no stov reset pragma target fuses 0x07, 0 pragma target fuses 0x08, 0b_1111_0000 -- no code readout protection pragma target fuses 0x09, 0b_11_000000 -- no data readout protection pragma target fuses 0x0A, 0b_0000_1111 -- no code self-write protection pragma target fuses 0x0B, 0b_111_00000 -- no various write protections pragma target fuses 0x0C, 0b_0000_1111 -- no table read protection pragma target fuses 0x0D, 0b_0_1_000000 -- no boot block read protection pragma target fuses 0x0E, 0 pragma target fuses 0x0F, 0 -- picmicro i/o port and i/o pin assignments. -- The original NE2000 card was plugged into the "ISA" bus on the PC. And some of the chips -- that claim to be "NE2000 compatible" used the "ISA" bus naming conventions. -- So that is why I using these names for the I/O pins. -- ISA address bus, low 5 bits port_b_direction = all_output var byte isa_addr is portb -- ISA 8 bit data bus port_d_direction = all_output var byte isa_data_direction is port_d_direction, isa_data is portd isa_data = 0 -- ISA read and write strobes. Both are active low signals var bit isa_ior is pin_e0, isa_iow is pin_e1 isa_ior = high isa_iow = high -- ISA reset signal. Active high. var bit isa_reset is pin_e2 port_e_low_direction = 0 isa_reset = low -- one-time init of the system procedure init_board is ADCON1 = 0b_0000_0110 TRISA = 0 LATA = 0xff end procedure -- debugging LED, not essential procedure toggle_led is LATA = LATA ^ 1; end procedure procedure isa_write ( byte in addr, byte in v ) is isa_addr = addr & 0x1F -- only 5 lower bytes active isa_data = v isa_data_direction = all_output isa_iow = low isa_iow = high isa_data_direction = all_input end procedure function isa_read ( byte in addr ) return byte is var byte v isa_data_direction = all_input isa_addr = addr & 0x1F -- only 5 lower bytes active isa_ior = low v = isa_data isa_ior = high return v end function