; ; LDENC - based on CONALT, loads encoded binary from MS input ; Req's DMS build w/ ALTSAVE 8/19/07 ; OCTAL DEFINE LDENC MS_SAVE ;save MS vectors ALTSAVE ;put swap prog at 77000 ;clear alt mem... #0 ZEROBLOCK #0 37 +DO @BLK GET INDEX 2000 MUL DUP IFZ DROP 2 ENDIF 2000 C>ACOPY +LOOP MS_RESTORE ;restore MS vectors (ZEROBLOCK alters) MS$IN ;get input string to prime DO ;for all blocks #0 ;checksum for read DO ;until start address > 0 #0 5 $SLICE ;push first 6 chars "BEGIN " $EQUAL $DROP ;CHECK FOR BEGIN and drop temp string IFZ ;if NOT equal $DROP MS$IN ;get next line #0 ELSE ;if BEGIN found 6 $LEN DEC $SLICE ;push string containing start address $VAL ;push startadr #1 ;found ENDIF UNTIL $DROP ;the BEGIN line ;checksum, starting address on stack ;get and push endadr.. MS$IN 4 $LEN DEC $SLICE $VAL $DROP MS$IN ;load 1st line to process +DO ;loop thru all values ; get encoded data... string on stack $LEN IFZ ;if empty $DROP MS$IN ;get next string ENDIF ;decode 3 chars and push to stack... $HEAD 74 SUB $HEAD 74 SUB 100 MUL ADD $HEAD 74 SUB 10000 MUL ADD DUP 150 SWAP PUT ;put in location 150 150 INDEX #1 C>ACOPY ;put loc 150 into alt at index ADD ;to file checksum on stack INDEX 777 AND IFZ "." $PRINT ENDIF ;print load progress +LOOP $DROP ;input line (now empty) MS$IN ;load CHECK line 6 $LEN DEC $SLICE $VAL $DROP ;get value from file OVER OVER SUB IFNZ ;compare CRLF "Checksum error - expected " $PRINT PNUM "but calculated " $PRINT PNUM CRLF ;keep going anyway ELSE DROP DROP ;drop checksums ENDIF MS$IN ;get next line, either next BEGIN or empty line $TRIM $LEN ;terminate when empty line received WHILE ;stop when line is empty $DROP ;the empty next-line string CRLF "Binary loaded, to run: -TBG -IRQ 77000 RUN" $PRINT END ; CONSOLE