Utility for entering machine code in hexadecimal and other formats.
Appears on
Gallery
Source Code
9400 REM "Codeloader---------by PATRICK FAGAN" 9402 PRINT "YOU MUST SET A RAMTOP ADDRESS AND BLOCK OF MEMORY TO USE THIS PROGRAM PROPERLY." 9405 REM 9410 PRINT '"PRESS ENTER TO START PROGRAM. IF THE PROGRAM STOPS WITH AN ERROR, YOU CAN RESTART WITH GOTO 9512." 9415 REM 9420 PRINT '"NOTE--THE PROGRAM IS FASTER IF YOU RESERVE SMALL BLOCKS OF MEMORY (100 OR 200 BYTES)ABOVE THE RAMTOP YOU WISH TO SET." 9425 REM 9430 PRINT '"SPECIAL NOTE-IF YOU WANT TO PEEK AND RELOCATE CODE,YOU MUST HAVE A BLOCK OF MEMORY RESERVED ABOVE RAMTOP THAT IS AS LARGE AS THE BLOCK OF MEMORY YOU WISH TO RELOCATE." 9435 PAUSE 4000: CLS 9500 PRINT AT 10,1; INVERSE 1; BRIGHT 1;"MACHINE CODE LOADING AND EDITING PROGRAM. " 9502 PRINT : PRINT "ENTER YOUR STARTING CODE ADDRESS THIS WILL SET RAMTOP" 9503 INPUT "START ADDRESS? ";X 9504 CLEAR X: LET X=(PEEK 23730+256*PEEK 23731): LET Y=X 9506 PRINT AT 10,1;"ENTER YOUR ENDING CODE ADDRESS?" 9507 INPUT "END ADDRESS? ";E 9508 PRINT AT 15,2; BRIGHT 1;"ADDRESS ";X;" TO ";E: PAUSE 150: CLS 9510 DIM H$(1+E-X,3): LET D=9500 9512 CLS 9516 PRINT BRIGHT 1;"LOAD HEX, 0NLY CAPITOL LETTERS. " 9518 PRINT '"#1 LOAD HEX CODE?" 9520 PRINT '"#2 LOAD DECIMAL CODE?" 9522 PRINT '"#3 LOAD HEXDECIMAL DATA LIST?" 9524 PRINT '"#4 LOAD DECIMAL DATA LIST?" 9526 PRINT '"#5 PEEK RAMTOP AND EDIT CODE?" 9528 PRINT '"#6 EXECUTE USR CODE?" 9530 PRINT '"#7 RETURN TO PROGRAM LISTING?" 9532 PRINT '"#8 STACK ANOTHER CODE ROUTINE?" 9534 PRINT '"#9 PEEK AND RELOCATE CODE?" 9535 PRINT '"#10 DECIMAL TO BINARY CONVERSION" 9538 INPUT " CHOOSE OPTION NUMBER. ";W 9540 IF W=1 THEN CLS : GO TO 9554 9542 IF W=2 THEN CLS : GO TO 9612 9544 IF W=3 THEN CLS : GO TO 9664 9546 IF W=4 THEN CLS : GO TO 9686 9548 IF W=5 THEN CLS : GO TO 9710 9549 IF W=6 THEN CLS : GO TO 9796 9550 IF W=7 THEN CLS : LIST D: STOP 9551 IF W=8 THEN CLS : PRINT AT 6,3;"YOUR PREVIOUS END CODE WAS ADDRESS ";E: GO TO 9500 9552 IF W=9 THEN CLS : GO TO 9702 9553 IF W=10 THEN CLS : GO TO 9810 9554 PRINT AT 2,1; BRIGHT 1;" HEX LOAD PROGRAM " 9556 PRINT '"TO ENTER INPUT HEX NUMBERS ONE AT A TIME AND PRESS ENTER." 9558 PRINT '"TO LOAD ENTER 'L' AND ENTER." 9560 PRINT '"FOR A NEW LINE AND FOR THE TOTAL BYTES SO FAR,PRESS ENTER." 9564 PRINT '"TO EDIT ENTER LETTER 'Z' AND BYTE NUMBER YOU WISH TO CHANGE.." 9566 PRINT '"NOTE.TO CONTINUE AFTER EDITING, ENTER BYTE YOU WISH TO START AT AND THEN LETTER 'R'." 9570 FOR A=1 TO E-X 9572 INPUT "ENTER HEX CODE. ";H$(A) 9576 IF H$(A)=" " THEN PRINT TAB 28;"#";A-1: GO TO 9572 9578 IF H$(A)="Z " THEN GO TO 9584 9580 IF H$(A)="L " THEN GO TO 9594 9581 PRINT H$(A);" "; 9582 NEXT A 9584 INPUT "ENTER BYTE# TO CHANGE ";C 9586 LET A=C 9588 INPUT "ENTER NEW HEX BYTE IN LOCATION.";H$(A) 9590 IF H$(A)="R " THEN LET H$(A)=H$(A-1): PRINT TAB 31;" ";: GO TO 9572 9591 PRINT "C";C;"=";H$(A);" "; 9592 GO TO 9584 9594 LET A=0 9596 LET A=A+1 9597 IF A>1+E-Y THEN GO TO 9792 9598 IF CODE H$(A)=76 THEN GO TO 9792 9599 LET K=48: LET L=48 9600 IF CODE H$(A)>57 THEN LET K=K+7 9602 IF CODE H$(A,2)>57 THEN LET L=L+7 9604 POKE X,(CODE H$(A)-K)*16+CODE H$(A,2)-L 9608 LET X=X+1 9610 GO TO 9596 9612 PRINT AT 2,1; BRIGHT 1;" DECIMAL LOAD PROGRAM " 9614 PRINT '"TO ENTER, INPUT DECIMAL NUMBERS ONE AT A TIME AND PRESS ENTER." 9616 PRINT '"TO LOAD,ENTER 'L' AND PRESS ENTER." 9618 PRINT '"FOR A NEW LINE AND FOR THE TOTAL BYTES SO FAR,PRESS ENTER." 9622 PRINT '"TO EDIT ENTER LETTER 'Z' AND BYTE NUMBER YOU WISH TO CHANGE.." 9624 PRINT '"NOTE.TO CONTINUE AFTER EDITING,ENTER BYTE YOU WISH TO START AT THEN LETTER 'R'." 9628 FOR A=1 TO E-X 9630 INPUT "ENTER DECIMAL CODE. ";H$(A) 9632 IF H$(A)="Z " THEN GO TO 9642 9636 IF H$(A)=" " THEN PRINT TAB 28;"#";A-1: GO TO 9630 9638 IF H$(A)="L " THEN GO TO 9652 9639 PRINT H$(A);" "; 9641 NEXT A 9642 INPUT "ENTER BYTE# TO CHANGE ";C 9644 LET A=C 9646 INPUT "ENTER NEW DECIMAL BYTE .";H$(A) 9648 IF H$(A)="R " THEN LET H$(A)=H$(A-1): PRINT TAB 31;" ";: GO TO 9630 9649 PRINT "C";C;"=";H$(A);" "; 9650 GO TO 9642 9652 LET A=0 9654 LET A=A+1 9655 IF A>1+E-Y THEN GO TO 9792 9656 IF CODE H$(A)=76 THEN GO TO 9792 9657 POKE X,VAL H$(A) 9660 LET X=X+1 9662 GO TO 9654 9664 PRINT AT 10,0; BRIGHT 1;"HEXDECIMAL DATA LOAD PROGRAM" 9666 PRINT '"ENTER STARTING LINE# OF DATA LIST TO LOAD." 9668 INPUT "DATA LINE# ? ";D 9670 RESTORE D 9672 FOR A=X TO E 9674 READ B$: LET K=48: LET L=48 9676 IF CODE B$>57 THEN LET K=K+7 9678 IF CODE B$(2)>57 THEN LET L=L+7 9680 POKE A,(CODE B$-K)*16+CODE B$(2)-L 9682 IF B$="C9" THEN GO TO 9792 9684 NEXT A 9686 PRINT AT 10,0; BRIGHT 1;"DECIMAL DATA LOAD PROGRAM" 9688 PRINT '"ENTER STARTING LINE# OF DATA LIST TO LOAD." 9690 INPUT "DATA LINE# ? ";D 9692 RESTORE D 9694 FOR A=X TO E 9696 READ B: POKE A,B 9698 IF B=201 THEN GO TO 9792 9700 POKE A,B: NEXT A 9702 PRINT AT 10,0;"TO PEEK ANY CODE ADDRESS AREA, ENTER THE START AND END ADDRESS IN DECIMAL." 9703 INPUT " START & END ADDRESS? ";J;" TO ";K: CLS 9704 LET B=0: LET A=0: LET C$="0" 9705 FOR P=J TO K: PRINT P;" ";PEEK P;: IF PEEK P>31 THEN PRINT TAB 11;CHR$ PEEK P; 9706 PRINT : LET B=B+1: LET A=A+1: LET H$(A)=STR$ PEEK P: NEXT P 9707 INPUT "'1'RETURN TO MENU '2'LOAD CODE INTO NEW ADDRESS?";U: IF U=1 THEN GO TO 9512 9708 IF U=2 THEN CLS : INPUT "START & END ADDRESS? ";Y;" TO ";E: GO TO 9760 9710 LET B=0: LET A=0: LET C$="0" 9711 INPUT "1'VIEW & EDIT DECIMAL, 2'VIEW & EDIT HEX. ";F 9712 PRINT TAB 5;"I'M WORKING ON IT NOW!" 9714 IF F=1 THEN GO TO 9718 9716 IF F=2 THEN GO TO 9726 9718 FOR P=Y TO E 9720 LET B=B+1: LET A=A+1 9722 LET H$(A)=STR$ PEEK P 9724 NEXT P: GO TO 9759 9726 LET A=0 9728 FOR P=Y TO E 9730 LET G=PEEK P: LET A=A+1 9732 LET J=INT (G/16) 9734 LET K=INT (G-J*16) 9736 LET H$(A,1)=STR$ J 9738 LET H$(A,2 TO )=STR$ K 9739 IF J<10 AND K<10 THEN GO TO 9758 9740 FOR C=10 TO 15 9742 IF C=10 THEN LET A$="A" 9744 IF C=11 THEN LET A$="B" 9746 IF C=12 THEN LET A$="C" 9748 IF C=13 THEN LET A$="D" 9750 IF C=14 THEN LET A$="E" 9752 IF C=15 THEN LET A$="F" 9754 IF J=C THEN LET H$(A,1)=A$ 9756 IF K=C THEN LET H$(A,2 TO )=A$ 9757 NEXT C 9758 NEXT P 9759 PRINT TAB 10;"EDIT,BYTE#" 9760 LET A=0: LET B=0: LET I=0 9762 FOR P=Y TO E 9764 LET B=B+1: LET I=I+1 9766 LET A=I: PRINT P;" ";PEEK P;TAB 11;H$(A);" ";I;" "; 9768 IF PEEK P>31 THEN PRINT CHR$ PEEK P; 9770 PRINT 9772 IF B=20 THEN INPUT "#1,STOP #2,EDIT #3,CONT ";C$: LET B=0 9774 IF C$="1" THEN GO TO 9512 9776 IF C$="2" THEN GO TO 9780 9778 NEXT P: LET B=20: GO TO 9772 9780 INPUT "0',CONT, OR ENT BYTE# TO CHANGE,RELOAD CODE,-1'DEC,-2'HEX. ";C: LET X=Y: LET C$="0" 9782 IF C=0 THEN GO TO 9778 9784 IF C=-1 THEN GO TO 9652 9786 IF C=-2 THEN GO TO 9594 9788 LET A=C: INPUT "ENT BYTES IN SAME CODE AS EDIT LIST ";H$(A) 9790 GO TO 9780 9792 PRINT AT 21,8; INVERSE 1;"CODE USR ";Y;" ENTERED" 9794 PAUSE 70: GO TO 9512 9796 PRINT USR Y 9798 PAUSE 200: GO TO 9512 9800 PRINT "ENTER START AND END ADDRESS OF CODE YOU WISH TO VIEW." 9801 INPUT "START & END ADDRESS? ";Y;" TO ";E 9802 FOR P=Y TO E 9804 PRINT P;" ";PEEK P; 9805 IF PEEK P>31 THEN PRINT TAB 11;CHR$ PEEK P; 9806 PRINT 9807 NEXT P 9808 INPUT "PRESS ENTER TO RETURN TO MENU. ";Z$: IF Z$="" THEN GO TO 9512 9810 PRINT "DECIMAL TO BINARY CONVERSION." 9812 INPUT "ENT DEC#:ENT -0 TO EXIT: ";A: PRINT A;"= ";TAB 7; 9813 IF A=-0 THEN GO TO 9512 9814 FOR I=15 TO 0 STEP -1 9816 IF A<2^I THEN GO TO 9824 9818 PRINT "1"; 9820 LET A=A-2^I 9822 GO TO 9826 9824 PRINT "0"; 9826 NEXT I: PRINT : GO TO 9812 9828 STOP 9900 SAVE "codeloader" LINE 9500