jrnegC

Developer(s): Bob Mitchell
Date: 1989
Type: Program
Platform(s): TS 2068

Prints a table of the backward offsets for the Z80 relative jump (JR) instruction: the hex bytes 80 to FF, laid out in rows 8 to F and columns 0 to F, with the negative decimal jump each one means (-128 to -1). It goes with Bob Mitchell’s notebook article on how JR counts backwards from the address after the jump, handy when you follow jumps in a disassembly.

The table is 81 characters wide, made for a dot-matrix printer in condensed mode through the Larken disk system’s “lp” printer channel: RUN 320 opens the channel and sets the printer, and line 290 closes it again. A second listing replaces lines 330 to 360 for Elite mode; the download has both versions. On a TS2068 without the Larken ROM, RUN prints the table on the screen (wrapped) and line 290’s RANDOMIZE USR 100 then resets the computer.

Published in Sinc-Link May-June 1989 (Bob’s Notebook: Jumping Backwards Relatively Speaking).

Related Articles

The Z80 machine language instruction JR e means Jump Relative by e addresses.

Image Gallery

Source Code

Listing 1
100 PRINT
110 LET L$="=================================================================================":REM 81 ='s
120 PRINT TAB 9;"NEGATIVE SIGN CONVENTION FOR BACKWARD JUMPS (JR)"
130 PRINT L$
140 PRINT "    0    1    2    3    4    5    6    7    8    9    A    B    C    D    E    F": REM 4 spaces between characters
150 PRINT L$
160 LET v$="89ABCDEF"
170 LET a=1
180 FOR i=128 TO 1 STEP -16
190 DIM n$(3)
200 PRINT v$(a);
210 FOR j=0 TO 15
220 LET n$=STR$ (i-j)
230 PRINT " -";n$;
240 NEXT j
250 LET a=a+1
260 PRINT
270 NEXT i
280 PRINT L$
290 RANDOMIZE USR 100: CLOSE #2
300 STOP
310 RANDOMIZE USR 100: SAVE "jrnegC.B1" LINE 320: STOP
320 RANDOMIZE USR 100: OPEN #2,"lp": RANDOMIZE USR 100: POKE 16094,8: RANDOMIZE USR 100: POKE 16090,81
330 OUT 127,15
340 GO TO 100

Elite mode: replacement lines
330 GO SUB 350: OUT 127,27: GO SUB 350: OUT 127,77
340 GO TO 100
350 IF IN 127<>237 THEN GO TO 350
360 RETURN

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.