0 REM MACHINE CODE LOADER
2 REM ***********************
3 REM contributed by R. Lussier
4 REM ***********************
5
6
10 INPUT "enter start address start with H or D to indicate hex or decimal "; LINE a$
20 IF a$(1)="d" OR a$(1)="D" THEN LET addr=VAL a$(2 TO )
30 IF a$(1)="h" OR a$(1)="H" THEN LET a$=a$(2 TO ): GO SUB 1000: LET addr=a
40 INPUT "do you want to clear to this address-1 (Y or N) "; LINE b$: IF b$="y" OR b$="Y" THEN CLEAR addr-1: LET addr=PEEK 23730+256*PEEK 23731+1
50 INPUT "Are you going to enter code in Hex or Decimal (H or D) "; LINE b$
100 IF b$="d" OR b$="D" THEN GO TO 200
110 INPUT "enter hex codes "; LINE c$
120 IF c$="s" OR c$="S" THEN STOP
130 FOR j=1 TO LEN c$ STEP 2: LET a$=c$(j TO j+1): GO SUB 1000: GO SUB 2000: NEXT j: GO TO 110
200 INPUT "enter codes one at a time "; LINE a$: IF a$="s" OR a$="S" THEN STOP
210 LET a=VAL a$
220 GO SUB 2000: GO TO 200
999 STOP
1000 LET a=0: FOR i=LEN a$ TO 1 STEP -1: LET a=a+(CODE a$(i)-48-(7 AND a$(i)>"9")-(32 AND a$(i)>"#"))*(16↑((LEN a$)-i)): NEXT i
1010 RETURN
2000 POKE addr,a: PRINT addr;"-";a$: LET addr=addr+1: RETURN
M/C LOADER instructions
This is a general purpose program for those who would like to enter machine code programs but lack experience.
The program will ask for the start address which may be entered in Hex or Decimal, but you must indicate which you are using by preceeding the address by an ‘h’ or ‘d’. As most programs need the area of memory to be reserved by CLEAR address-1. This option is included from within the program.
Sometimes the code is given in decimal & sometimes in hex. The program allows both modes of entry, the main difference being that in decimal mode you can only enter codes one at a time. In hex modes a string of codes may be entered(with 0 spaces between them) and the program caters for both upper & lower case or even a mixed input.
The addresses and the code poked into them are displayed as they are entered for checking. If you make a mistake then enter ‘s’ to stop, make a note of the error address & re-run the program entering the error address as the start address, do NOT use the CLEAR option, & then continue to enter your codes from where the error occured. At any time when prompted for code entry press ‘s’ to STOP.
MACHINE CODE LOADER-ZX81
CONTRIBUTED: R. LUSSIER
This program has 5 functions. You can enter one or two bytes of decimal (so full address eg. 16396,can be entered)or 1 byte of Hex. You can print what youve entered so far on to the screen (if the screen fills up then you press ‘cont’) and RUN yout machine code program. In addition the address of last byte entered and its decimal contents are displayed at the top of the screen.
10 REM
20 LET A=16514
25 CLS
30 PRINT A-1,PEEK (A-1)
40 PRINT "1=1*DEC,2=2*DEC,3=1*HEX"
45 PRINT "4=PRINT,6=RUN"
50 PRINT
60 INPUT B
70 GO TO B*200
400 PRINT B;"*DEC"
410 INPUT C
420 POKE A+1,INT (C/256)
430 POKE A,C-256*PEEK (A+1)
440 LET A=A+B
450 GO TO 25
600 PRINT "1*HEX"
610 INPUT A$
620 POKE A,16*(CODE (A$)-28)+CODE A$(2)-28
630 LET A=A+1
640 GO TO 25
800 CLS
810 FOR C=16514 TO A
820 PRINT C,PEEK C
830 NEXT C
840 INPUT A$
850 GO TO 25
1200 PRINT USR 16514
1201
1202 REM Insert 40 graphic spaces after the REM statement in line 10 ----
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.