Prints a hex dump of memory. You enter a start address, which is rounded down to a multiple of 8, and an end address, both in decimal. Each line then shows a four-digit hex address followed by the next eight bytes in hex. The listing scrolls up from the bottom of the screen without stopping for the “scroll?” prompt, and the program stops when it reaches the end address.
The opening REM reads “HEXDUMP by Barry Mulligan” with “Timex Sinclair User V1, #7”, the December 1983 issue in which the program was printed.
Program Analysis
The program has 25 lines. Lines 30–70 take the start and end addresses, and the loop at lines 90–210 PEEKs each byte. When the address is a multiple of 8 it starts a new line and prints the address, converting the high and low bytes separately, then tabs to column 7 for the data. The subroutine at lines 220–250 converts one byte into two hex digits. It splits the byte into high and low nibbles, adds 48 to each to get a digit character, and adds a further 7 when the result passes 57 (“9”) so that 10–15 become A–F.
Notable Techniques
POKE 23692,255before each new line keeps the scroll counter high, so the listing never stops for the scroll prompt.PRINT AT 21,0'prints at the bottom row and forces a scroll, so each new line appears at the foot of the screen.- Hex digits come from character arithmetic (
CHR$ (48+n), plus 7 for A–F) instead of a lookup string.
This program came from an Oliger (JLO SAFE) disk in the SNUG library set and was converted for tape. It has no disk commands, so no changes were needed. It was tested in ZEsarUX on a stock TS2068 with a dump of ROM addresses 0–159.
Source Code
10 REM >> HEXDUMP << by Barry Mulligan * Timex Sinclair User V1, #7
20 PRINT AT 19,10;"- HEXDUMP -"
30 PRINT AT 21,1;"START ";
40 INPUT a
50 LET a=8*INT (a/8)
60 PRINT a," END ";
70 INPUT z: PRINT z
80 POKE 23692,255: PRINT AT 21,0'
90 FOR i=a TO z
100 IF i<>8*INT (i/8) THEN GO TO 180
110 POKE 23692,255: PRINT AT 21,0'
120 LET x=INT (i/256)
130 GO SUB 220
140 LET y$=x$
150 LET x=i-256*INT (i/256)
160 GO SUB 220
170 PRINT y$;x$;TAB 7;
180 LET x=PEEK i
190 GO SUB 220
200 PRINT x$;" ";
210 NEXT i: STOP
220 LET x$=CHR$ (48+INT (x/16)): LET z$=CHR$ (48+x-16*INT (x/16))
230 IF CODE x$>57 THEN LET x$=CHR$ (CODE x$+7)
240 IF CODE z$>57 THEN LET z$=CHR$ (CODE z$+7)
250 LET x$=x$+z$: RETURNNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
