; 1802 Membership Card .bin loader by Jonathan Mordosky ; Edited by Lee Hart Oct 29 2015, JOnathan Mordosky Nov 3 2015 ; ; first, here is the original by Jonathan Mordosky in cosmacelf Oct 2015 ; Loads binary file starting at address XX00, Where XX is any page in memory above 00 ; For 1802 Membership Card, serial port configured as Normal (not inverting) ; Tested at 300 baud 8N1. Should work at slightly higher baud rates ; ; To Use: Toggle in program as usual. ; Start up and configure communications program on host computer. ; On 1802MC, make sure write protect is off. Flip switch to Clear, then Run. ; Hit exactly once on host computer, watching that the output LEDs do not change. ; On newer revision boards, the green LED will blink as the space character is received. ; Send BIN file as ASCII from host computer. Make sure program settings don't strip the 8th bit. ; Output LEDs should now change and show the data as it is received. ; ; When blinking stops, verify that the LEDs match the last byte of the program. ; Toggle in a long jump instruction to start of program (0xC0 0xXX 0x00) and run. ; If unsuccessful, check com settings and try again. ; hex listing ;0000 F8 XX B2 90 A2 E2 36 06 ;0008 3E 08 FC 01 36 0A FF 04 ;0010 B3 3E 11 F8 09 A3 36 16 ;0018 93 F6 38 93 FF 01 3A 1C ;0020 02 F6 3E 26 F9 80 52 23 ;0028 83 3A 1B 64 30 11 ORG 0000H ;initialization Page equ 00 ; desired page destination ; LDI Page ;Set destination starting address PHI 2 ;R2 points to destination GHI 0 ; LSB of destination is 00 PLO 2 ; (assumes this program is at 00XX) SEX 2 LoopA B3 LoopA ;Wait for Start bit (EF3 pin to go high) LoopB BN3 LoopB ;Wait for Data bit D5 = 1 (EF3 pin low) ;time Data bit D5 ; starts with D=00 (from GHI instruction at 0003) Time ADI 1 ; D=D+1 for each loop B3 Time ; ...until end of bit ;each loop is 2 instructions, ;so Delay x 2 = number of instructions per bit SMI 4 ;Subtract 4 extra instructions PHI 3 ;Store Delay Constant in R3.1 ; so (Delay+4) x 2 = # of instructions in one bit time ;OK, we're ready to receive data Main BN3 Main ;Wait for Stop Bit (EF3 pin low) LDI 9 ;R3.0 = #bits = 9 PLO 3 LoopC B3 LoopC ;Wait for Start bit (EF3 pin high) GHI 3 ;Delay 1/2 bit time SHR ; to move to middle of bit SKP NextBit GHI 3 ;Delay one bit time Delay SMI 001H BNZ Delay LDN 2 ;Get bits received so far... SHR ; Shift right, and set most.sig.bit=0 BN3 Zero ; if serial input=1 (i.e. EF3 pin is low) ORI 080H ; then set most.sig.bit=1 Zero STR 2 ;Store Data DEC 3 ;Count out bits GLO 3 BNZ NextBit ;Loop until byte Finished OUT 4 ;Show Data and INC Pointer BR Main ;Get next byte END