Manual de-tokenization of a GW-BASIC program from a hexdump of memory --------------------------------------------------------------------- All offsets relative to GW-BASIC's data segment and may vary from one version to the next. Pointer in GW-BASIC's work area: 04A4: 6D 12 ..S.m........... ===== (The address, 04A4 may vary in other versions of GW-BASIC. This holds the address of the currently-loaded GW-BASIC program.) The GW-BASIC program in memory: 126D: 00 ................ 00 -- A dummy end-of-line marker for the non-existant program line assumed, when interpteing starts, to be the line that precedes the current (first) program line. Effectively a "GOTO 1000" with a line-pointer, "89 20 0D 6D 12" is executed to start the program. 126E: 8E 12 ................ 1270: E8 03 3A 8F D9 20 20 53 54 41 52 54 20 4F 46 3A ..:.. START OF: 1280: 20 64 65 6D 6F 74 65 73 74 2E 6E 62 73 00 demotest.nbs. 8E 12 -- 128E, the offset of the next line. E8 03 -- 03E8 hex., 1000 decimal, the current line number. 3A 8F D9 -- ' tokenised as ":REM'" 20 20 ... 62 73 -- The remark, " START OF: demotest.nbs" 00 -- the end of the line. Program line: 1000 ' START OF: demotest.nbs 128E: AB 12 .. 1290: ED 03 3A 8F D9 20 77 68 69 6C 65 20 69 74 20 69 ..:.. while it i 12A0: 73 20 72 75 6E 6E 69 6E 67 2E 00 s running....... AB 12 -- 12AB, the offset of the next line. ED 03 -- 03ED hexadecimal, 1005, the current line number. 3A 8F D9 -- ' tokenised as ":REM'" 20 77 ... 67 2E -- The remark, " while it is running." 00 -- end-of-line Program line: 1005 ' while it is running. 12AB: FC 12 F2 03 89 s running....... 12B0: 20 0D 49 16 20 3A 8F D9 20 74 6F 20 65 78 65 63 .I. :.. to exec 12C0: 75 74 65 20 74 68 65 20 47 4F 54 4F 20 61 6E 64 ute the GOTO and 12D0: 20 66 6F 72 63 65 20 74 68 65 20 6C 69 6E 65 20 force the line 12E0: 6E 75 6D 62 65 72 20 74 6F 20 62 65 20 61 20 6C number to be a l 12F0: 69 6E 65 20 70 6F 69 6E 74 65 72 00 ine pointer..... FC 12 -- 12FC, the offset of the next line. F2 03 -- 03F2 hexadecimal, 1010, the current line number. 89 -- GOTO 20 -- 0D 49 16 -- a line-pointer to line 9000 20 -- 3A 8F D9 -- ' tokenised as ":REM'" 20 74 ... 65 72 -- The remark, " to execute the GOTO and force the line number to be a line pointer" 00 -- end-of-line Program line: 1010 GOTO 9000 ' to execute the GOTO and force the line number to be a line pointer 12FC: 19 13 F7 03 ine pointer..... 1300: 86 20 42 59 54 45 24 5B 0F 10 5D 2C 48 42 59 54 . BYTE$[..],HBYT 1310: 45 53 24 5B 1C 00 01 5D 00 ES$[...].:...HEX 19 13 -- 1319, the offset of the next line. F7 03 -- 03F7 hexadecimal, 1015, the current line number. 86 -- DIM 20 -- 42 59 54 45 24 5B -- BYTE$[ 0F 10 -- the one-byte integer 16 decimal 5D 2C 48 42 59 54 45 53 24 5B -- ],HBYTES$[ 1C 00 01 -- the two-byte integer 256 (0100 hexadecimal) 5D -- ] 00 -- end-of-line Program line: 1015 DIM BYTE$[16],HBYTES$[256] 1319: 3A 13 FC 03 48 45 58 ES$[...].:...HEX 1320: 43 48 41 52 53 24 E7 22 30 31 32 33 34 35 36 37 CHARS$."01234567 1330: 38 39 41 42 43 44 45 46 22 00 89ABCDEF".K.... 3A 13 -- 133A, the offset of the next line. FC 03 -- 03FC hexadecimal, 1020, the current line number. 48 45 58 43 48 41 52 53 24 -- HEXCHARS$ E7 -- = 22 30 ... 46 22 -- "0123456789ABCDEF" 00 -- end-of-line Program line: 1020 HEXCHARS$="0123456789ABCDEF" 133A: 4B 13 01 04 82 20 89ABCDEF".K.... 1340: 49 20 E7 20 12 20 CC 20 0F 10 00 I . . . ..._... 4B 13 -- 134B, the offset of the next line. 01 04 -- 0401 hexadecimal, 1025, the current line number. 82 -- FOR 20 -- 49 -- I 20 -- E7 -- = 20 -- 12 -- the tokenised integer constant 1 20 -- CC -- TO 20 -- 0F 10 -- the one-byte integer 16 decimal 00 -- end-of-line Program line: 1025 FOR I = 1 TO 16 134B: 5F 13 06 04 20 I . . . ..._... 1350: 20 20 82 20 4A 20 E7 20 12 20 CC 20 0F 10 00 . J . . . .... 5F 13 -- 135F, the offset of the next line. 06 04 -- 0406 hexadecimal, 1030, the current line number. 20 20 20 -- three 82 -- FOR 20 -- 4A -- J 20 -- E7 -- = 20 -- 12 -- the tokenised integer constant 1 20 -- CC -- TO 20 -- 0F 10 -- the one-byte integer 16 decimal 00 -- end-of-line Program line: 1030 FOR J = 1 TO 16 135F: A7 . J . . . .... 1360: 13 0B 04 20 20 20 20 20 20 48 42 59 54 45 53 24 ... HBYTES$ 1370: 5B 0F 10 EB 28 49 EA 12 29 E9 4A EA 12 5D 20 E7 [...(I..).J..] . 1380: 20 FF 83 28 48 45 58 43 48 41 52 53 24 2C 49 2C ..(HEXCHARS$,I, 1390: 12 29 20 E9 20 FF 83 28 48 45 58 43 48 41 52 53 .) . ..(HEXCHARS 13A0: 24 2C 4A 2C 12 29 00 $,J,.)..... . A7 13 -- 13A7, the offset of the next line. 0B 04 -- 040B hexadecimal, 1035, the current line number. 20 20 20 20 20 20 -- six 48 42 59 54 45 53 24 5B -- HBYTES$[ 0F 10 -- the one-byte integer 16 decimal EB -- * 28 49 -- (I EA -- - 12 -- the tokenised integer constant 1 29 -- ) E9 -- + 4A -- J EA -- - 12 -- the tokenised integer constant 1 5D -- ] 20 -- E7 -- = 20 -- FF83 -- MID$ 28 48 45 58 43 48 41 52 53 24 2C 49 2C -- (HEXCHARS$,I, 12 -- the tokenised integer constant 1 29 -- ) 20 -- E9 -- + 20 -- FF 83 -- MID$ 28 48 45 58 43 48 41 52 53 24 2C 4A 2C -- (HEXCHARS$,J, 12 -- the tokenised integer constant 1 29 -- ) 00 -- end-of-line Program line: 1035 HBYTES$[16*(I-1)+J-1] = MID$(HEXCHARS$,I,1) + MID$(HEXCHARS$,J,1) 13A7: B2 13 10 04 20 20 20 83 20 $,J,.)..... . 13B0: 4A 00 J...... I...... B2 13 -- 13B2, the offset of the next line. 10 04 -- 0410 hexadecimal, 1040, the current line number. 20 20 20 -- three 83 -- NEXT 20 -- 4A -- J 00 -- end-of-line Program line: 1040 NEXT J 13B2: BA 13 15 04 83 20 49 00 J...... I...... BA 13 -- 13BA, the offset of the next line. 15 04 -- 0415 hexadecimal, 1045, the current line number. 83 -- NEXT 20 -- 49 -- I 00 -- end-of-line Program line: 1045 NEXT I 13BA: D6 13 1A 04 BA 20 J...... I...... 13C0: 22 4F 22 2C 23 12 2C 22 64 65 6D 6F 64 75 6D 70 "O",#.,"demodump 13D0: 2E 74 78 74 22 00 .txt"...... SEG. D6 13 -- 13D6, the offset of the next line. 1A 04 -- 041A hexadecimal, 1050, the current line number. BA -- OPEN 20 -- 22 4F 22 2C 23 -- "O",# 12 -- the tokenised integer constant 1 2C 22 64 65 6D 6F 64 75 6D 70 2E 74 78 74 22 -- ,"demodump.txt" 00 -- end-of-line Program line: 1050 OPEN "O",#1,"demodump.txt" 13D6: E0 13 1F 04 97 20 53 45 47 00 .txt"...... SEG. E0 13 -- 13E0, the offset of the next line. 1F 04 -- 041F hexadecimal, 1055, the current line number. 97 -- DEF 20 -- 53 45 47 -- SEG 00 -- end-of-line Program line: 1055 DEF SEG 13E0: F9 13 24 04 3A 8F D9 73 74 61 72 74 20 74 68 65 ..$.:..start the 13F0: 20 64 75 6D 70 69 6E 67 00 dumping.0.).. O F9 13 -- 13F9, the offset of the next line. 24 04 -- 0424 hexadecimal, 1060, the current line number. 3A 8F D9 -- ' tokenised as ":REM'" 73 74 ... 6E 67 -- start the dumping 00 -- end-of-line Program line: 1060 'start the dumping 13F9: 30 14 29 04 82 20 4F dumping.0.).. O 1400: 46 46 53 45 54 20 E7 20 11 20 CC 20 1D 00 F0 7F FFSET . . . .... 1410: 90 20 CF 20 0F 10 20 3A 8F D9 20 68 65 78 20 30 . . .. :.. hex 0 1420: 30 30 30 20 74 6F 20 68 65 78 20 46 46 46 30 00 000 to hex FFF0. 30 14 -- 1430, the offset of the next line. 29 04 -- 0429 hexadecimal, 1065, the current line number. 82 -- FOR 20 -- 4F 46 46 53 45 54 -- OFFSET 20 -- E7 -- = 20 -- 11 -- the tokenised integer constant 0 20 -- CC -- TO 20 -- 1D 00 F0 7F 90 -- the 4-byte floating-point constant 907FF000 -- (Exponent = 16, sign = +, Mantissa = .FFF000 (remember the implied leading 1 bit?) so the value is FFF0.000 hexadecimal, 65520 decimal, or 1111111111110000.000000000000 binary) 20 -- CF -- STEP 20 -- 0F 10 -- the one-byte integer 16 decimal 20 -- 3A 8F D9 -- ' tokenised as ":REM'" 20 -- 68 65 ... 46 30 -- hex 0000 to hex FFF0 00 -- end-of-line Program line: 1065 FOR OFFSET = 0 TO 65520 STEP 16 ' hex 0000 to hex FFF0 1430: 49 14 2E 04 20 20 20 41 53 43 49 49 53 54 52 49 I... ASCIISTRI 1440: 4E 47 24 20 E7 20 22 22 00 NG$ . "".].3. 49 14 -- 1449, the offset of the next line. 2E 04 -- 042E hexadecimal, 1070, the current line number. 20 20 20 -- three 41 53 43 49 49 53 54 52 49 4E 47 24 -- ASCIISTRING$ 20 -- E7 -- = 20 -- 22 22 -- "" 00 -- end-of-line Program line: 1070 ASCIISTRING$ = "" 1070 ASCIISTRING$ = "" 1449: 5D 14 33 04 20 20 20 NG$ . "".].3. 1450: 82 20 49 20 E7 20 11 20 CC 20 0F 0F 00 . I . . . ...~.8 5D 14 -- 145D, the offset of the next line. 33 04 -- 0433 hexadecimal, 1075, the current line number. 20 20 20 -- three 82 -- FOR 20 -- 49 -- I 20 -- E7 -- = 20 -- 11 -- the tokenised integer constant 0 20 -- CC -- TO 0F 0F -- the one-byte integer 15 decimal 00 -- end-of-line Program line: 1075 FOR I = 0 TO 15 145D: 7E 14 38 . I . . . ...~.8 1460: 04 20 20 20 20 20 20 42 59 54 45 25 20 E7 20 FF . BYTE% . . 1470: 97 28 4F 46 46 53 45 54 20 E9 20 49 29 00 .(OFFSET . I)... 7E 14 -- 147E, the offset of the next line. 38 04 -- 0438 hexadecimal, 1080, the current line number. 20 20 20 20 20 20 -- six 42 59 54 45 25 -- BYTE% 20 -- E7 -- = 20 -- FF 97 -- PEEK 28 4F 46 46 53 45 54 -- (OFFSET 20 -- E9 -- + 20 -- 49 29 -- I) 00 -- end-of-line Program line: 1080 BYTE% = PEEK(OFFSET + I) 147E: A2 14 .(OFFSET . I)... 1480: 3D 04 20 20 20 20 20 20 42 59 54 45 24 5B 49 5D =. BYTE$[I] 1490: 20 E7 20 48 42 59 54 45 53 24 5B 42 59 54 45 25 . HBYTES$[BYTE% 14A0: 5D 00 ]...B. . BY A2 14 -- 14A2, the offset of the next line. 3D 04 -- 043D hexadecimal, 1085, the current line number. 20 20 20 20 20 20 -- six 42 59 54 45 24 5B 49 5D -- BYTE$[I] 20 -- E7 -- = 20 -- 48 42 59 54 45 53 24 5B 42 59 54 45 25 5D -- HBYTES$[BYTE%] 00 -- end-of-line Program line: 1085 BYTE$[I] = HBYTES$[BYTE%] 14A2: 15 15 42 04 20 20 20 20 20 20 8B 20 42 59 ]...B. . BY 14B0: 54 45 25 20 E8 20 0F 20 20 EF 20 42 59 54 45 25 TE% . . . BYTE% 14C0: 20 E6 20 0F 7E 20 CD 20 41 53 43 49 49 53 54 52 . .~ . ASCIISTR 14D0: 49 4E 47 24 20 E7 20 41 53 43 49 49 53 54 52 49 ING$ . ASCIISTRI 14E0: 4E 47 24 20 E9 20 22 2E 22 20 3A A1 20 41 53 43 NG$ . "." :. ASC 14F0: 49 49 53 54 52 49 4E 47 24 20 E7 20 41 53 43 49 IISTRING$ . ASCI 1500: 49 53 54 52 49 4E 47 24 20 E9 20 FF 96 28 42 59 ISTRING$ . ..(BY 1510: 54 45 25 29 00 TE%). .G. . I. 15 15 -- 1515, the offset of the next line. 42 04 -- 0442 hexadecimal, 1090, the current line number. 20 20 20 20 20 20 -- six 8B -- IF 20 -- 42 59 54 45 25 -- BYTE% 20 -- E8 -- < 20 -- 0F 20 -- the one-byte integer 32 decimal 20 -- EF -- OR 20 -- 42 59 54 45 25 -- BYTE% 20 -- E6 -- > 20 -- 0F 7E -- the one-byte integer 126 decimal 20 -- CD -- THEN 20 -- 41 53 43 49 49 53 54 52 49 4E 47 24 -- ASCIISTRING$ 20 -- E7 -- = 20 -- 41 53 43 49 49 53 54 52 49 4E 47 24 -- ASCIISTRING$ 20 -- E9 -- + 20 -- 22 2E 22 -- "." 20 -- 3A A1 -- ELSE tokenised as ":ELSE" 20 -- 41 53 43 49 49 53 54 52 49 4E 47 24 -- ASCIISTRING$ 20 -- E7 -- = 20 -- 41 53 43 49 49 53 54 52 49 4E 47 24 -- ASCIISTRING$ 20 -- E9 -- + 20 -- FF 96 -- CHR$ 28 42 59 54 45 25 29 -- (BYTE%) 00 -- end-of-line Program line: 1090 IF BYTE% < 32 OR BYTE% > 126 THEN ASCIISTRING$ = ASCIISTRING$ + "." ELSE ASCIISTRING$ = ASCIISTRING$ + CHR$(BYTE%) 1515: 20 15 47 04 20 20 20 83 20 49 00 TE%). .G. . I. 20 15 -- 1520, the offset of the next line. 47 04 -- 0447 hexadecimal, 1095, the current line number. 20 20 20 -- three 83 -- NEXT 20 -- 49 -- I 00 -- end-of-line Program line: 1095 NEXT I 1520: 51 15 4C 04 20 20 20 4F 46 46 53 45 54 24 20 E7 Q.L. OFFSET$ . 1530: 20 FF 82 28 22 30 30 30 22 20 E9 20 FF 9A 28 4F ..("000" . ..(O 1540: 46 46 53 45 54 29 2C 15 29 20 E9 20 22 3A 20 22 FFSET),.) . ": " 1550: 00 .g.Q. .# ., OF 51 15 -- 1551, the offset of the next line. 4C 04 -- 044C hexadecimal, 1100, the current line number. 20 20 20 -- three 4F 46 46 53 45 54 24 -- OFFSET$ 20 -- E7 -- = 20 -- FF 82 -- RIGHT$ 28 22 30 30 30 22 -- ("000" 20 -- E9 -- + 20 -- FF 9A -- HEX$ 28 4F 46 46 53 45 54 29 2C -- (OFFSET), 15 -- the tokenised integer constant 4 29 -- ) 20 -- E9 -- + 20 -- 22 3A 20 22 -- ": " 00 -- end-of-line Program line: 1100 OFFSET$ = RIGHT$("000" + HEX$(OFFSET),4) + ": " 1551: 67 15 51 04 20 20 20 91 23 20 12 2C 20 4F 46 .g.Q. .# ., OF 1560: 46 53 45 54 24 3B 00 FSET$;.y.R. . 67 15 -- 1567, the offset of the next line. 51 04 -- 0451 hexadecimal, 1105, the current line number. 20 20 20 -- three 91 -- PRINT 23 -- # 20 -- 12 -- the tokenised integer constant 1 2C -- , 20 -- 4F 46 46 53 45 54 24 3B -- OFFSET$ 00 -- end-of-line Program line: 1105 PRINT# 1, OFFSET$ 1567: 79 15 52 04 20 20 20 91 20 FSET$;.y.R. . 1570: 4F 46 46 53 45 54 24 3B 00 OFFSET$;...V. 79 15 -- 1579, the offset of the next line. 52 04 -- 0452 hexadecimal, 1106, the current line number. 20 20 20 -- three 91 -- PRINT 20 -- 4F 46 46 53 45 54 24 3B -- OFFSET$ 00 -- end-of-line Program line: 1106 PRINT OFFSET$ 1106 PRINT OFFSET$ 1579: 8D 15 56 04 20 20 20 OFFSET$;...V. 1580: 82 20 49 20 E7 20 11 20 CC 20 0F 0F 00 . I . . . .....[ 8D 15 -- 158D, the offset of the next line. 56 04 -- 0456 hexadecimal, 1110, the current line number. 20 20 20 -- three 82 -- FOR 20 -- 49 -- I 20 -- E7 -- = 20 -- 11 -- the tokenised integer constant 0 20 -- CC -- TO 0F 0F -- the one-byte integer 15 decimal 00 -- end-of-line Program line: 1110 FOR I = 0 TO 15 158D: AB 15 5B . I . . . .....[ 1590: 04 20 20 20 20 20 20 91 23 20 12 2C 20 42 59 54 . .# ., BYT 15A0: 45 24 5B 49 5D 3B 22 20 22 3B 00 E$[I];" ";...\. AB 15 -- 15AB, the offset of the next line. 5B 04 -- 045B hexadecimal, 1115, the current line number. 20 20 20 20 20 20 -- six 91 -- PRINT 23 -- # 20 -- 12 -- the tokenised integer constant 1 2C -- , 20 -- 42 59 54 45 24 5B 49 5D 3B 22 20 22 3B -- BYTE$[I];" "; 00 -- end-of-line Program line: 1115 PRINT# 1, BYTE$[I];" "; 15AB: C5 15 5C 04 20 E$[I];" ";...\. 15B0: 20 20 20 20 20 91 20 42 59 54 45 24 5B 49 5D 3B . BYTE$[I]; 15C0: 22 20 22 3B 00 " ";...`. . I. C5 15 -- 15C5, the offset of the next line. 5C 04 -- 045C hexadecimal, 1116, the current line number. 20 20 20 20 20 20 -- six 91 -- PRINT 20 -- 42 59 54 45 24 5B 49 5D 3B 22 20 22 3B -- BYTE$[I];" "; 00 -- end-of-line Program line: 1115 PRINT BYTE$[I];" "; 15C5: D0 15 60 04 20 20 20 83 20 49 00 " ";...`. . I. D0 15 -- 15D0, the offset of the next line. 60 04 -- 0460 hexadecimal, 1120, the current line number. 20 20 20 -- three 83 -- NEXT 20 -- 49 -- I 00 -- end-of-line Program line: 1120 NEXT I 15D0: EE 15 65 04 20 20 20 91 23 20 12 2C 20 22 20 22 ..e. .# ., " " 15E0: 3B 41 53 43 49 49 53 54 52 49 4E 47 24 00 ;ASCIISTRING$... EE 15 -- 15EE, the offset of the next line. 65 04 -- 0465 hexadecimal, 1125, the current line number. 20 20 20 -- three 91 -- PRINT 23 -- # 20 -- 12 -- the tokenised integer constant 1 2C -- , 20 -- 22 20 22 3B 41 53 43 49 49 53 54 52 49 4E 47 24 -- " ";ASCIISTRING$ 00 -- end-of-line Program line: 1125 PRINT# 1, " ";ASCIISTRING$ 15EE: 08 16 ;ASCIISTRING$... 15F0: 66 04 20 20 20 91 20 22 20 22 3B 41 53 43 49 49 f. . " ";ASCII 1600: 53 54 52 49 4E 47 24 00 STRING$...j.. OF 08 16 -- 1608, the offset of the next line. 66 04 -- 0466 hexadecimal, 1126, the current line number. 20 20 20 -- three 91 -- PRINT 20 -- 22 20 22 3B 41 53 43 49 49 53 54 52 49 4E 47 24 -- " ";ASCIISTRING$ 00 -- end-of-line Program line: 1126 PRINT " ";ASCIISTRING$ 1608: 15 16 6A 04 83 20 4F 46 STRING$...j.. OF 1610: 46 53 45 54 00 FSET...o.. ..#.t 15 16 -- 1615, the offset of the next line. 6A 04 -- 046A hexadecimal, 1130, the current line number. 83 -- NEXT 20 -- 4F 46 46 53 45 54 -- OFFSET 00 -- end-of-line Program line: 1130 NEXT OFFSET 1615: 1D 16 6F 04 BB 20 12 00 FSET...o.. ..#.t 1D 16 -- 161D, the offset of the next line. 6F 04 -- 046F hexadecimal, 1135, the current line number. BB -- CLOSE 20 -- 12 -- the tokenised integer constant 1 00 -- end-of-line Program line: 1135 CLOSE 1 161D: 23 16 74 FSET...o.. ..#.t 1620: 04 90 00 ...).y...J.~.:.. 23 16 -- 1623, the offset of the next line. 74 04 -- 0474 hexadecimal, 1140, the current line number. 90 -- STOP 00 -- end-of-line Program line: 1140 STOP 1623: 29 16 79 04 81 00 ...).y...J.~.:.. 29 16 -- 1629, the offset of the next line. 79 04 -- 0479 hexadecimal, 1145, the current line number. 81 -- END 00 -- end-of-line Program line: 1145 END 1629: 4A 16 7E 04 3A 8F D9 ...).y...J.~.:.. 1630: 20 74 68 61 74 27 73 20 61 6C 6C 20 65 78 63 65 that's all exce 1640: 70 74 20 66 6F 72 2E 2E 2E 00 pt for....o.(#. 4A 16 -- 164A, the offset of the next line. 7E 04 -- 047E hexadecimal, 1150, the current line number. 3A 8F D9 -- ' tokenised as ":REM'" 20 -- 74 68 ... 2E 2E -- that's all except for... 00 -- end-of-line Program line: 1150 ' that's all except for... 164A: 6F 16 28 23 89 20 pt for....o.(#. 1650: 0D FB 12 20 3A 8F D9 20 74 6F 20 6D 61 6B 65 20 ... :.. to make 1660: 61 20 6C 69 6E 65 20 70 6F 69 6E 74 65 72 00 a line pointer.. 6F 16 -- 166F, the offset of the next line. 28 23 -- 2328 hexadecimal, 9000, the current line number. 89 -- GOTO 20 -- 0D FB 12 -- a line-pointer to line 1015 20 -- 3A 8F D9 -- ' tokenised as ":REM'" 20 -- 74 6F ... 65 72 -- to make a line pointer 00 -- end-of-line Program line: 9000 GOTO 1015 ' to make a line pointer 166F: 99 a line pointer.. 1670: 16 2D 23 89 20 0E 74 04 20 3A 8F D9 20 73 68 6F .-#. .t. :.. sho 1680: 75 6C 64 20 72 65 6D 61 69 6E 20 61 20 6C 69 6E uld remain a lin 1690: 65 20 6E 75 6D 62 65 72 00 e number....':.. 99 16 -- 1699, the offset of the next line. 2D 23 -- 232D hexadecimal, 9005, the current line number. 89 -- GOTO 20 -- 0E 74 04 -- line number 1140 (0474 hexadecimal) 20 -- 3A 8F D9 -- ' tokenised as ":REM'" 20 -- 73 68 ... 65 72 -- should remain a line number 00 -- end-of-line Program line: 9005 GOTO 1140 ' should remain a line number 1699: B6 16 06 27 3A 8F D9 e number....':.. 16A0: 20 45 4E 44 20 4F 46 3A 20 64 65 6D 6F 74 65 73 END OF: demotes 16B0: 74 2E 6E 62 73 00 t.nbs... B6 16 -- 16B6, the offset of the next line. 06 27 -- 2706 hexadecimal, 9990, the current line number. 3A 8F D9 -- ' tokenised as ":REM'" 20 -- 45 4E ... 62 73 -- END OF: demotest.nbs 00 -- end-of-line Program line: 9990 ' END OF: demotest.nbs 16B6: 00 00 t.nbs... 00 00 -- The end of the program. The complete program: 1000 ' START OF: demotest.nbs 1005 ' while it is running. 1010 GOTO 9000 ' to execute the GOTO and force the line number to be a line pointer 1015 DIM BYTE$[16],HBYTES$[256] 1020 HEXCHARS$="0123456789ABCDEF" 1025 FOR I = 1 TO 16 1030 FOR J = 1 TO 16 1035 HBYTES$[16*(I-1)+J-1] = MID$(HEXCHARS$,I,1) + MID$(HEXCHARS$,J,1) 1040 NEXT J 1045 NEXT I 1050 OPEN "O",#1,"demodump.txt" 1055 DEF SEG 1060 'start the dumping 1065 FOR OFFSET = 0 TO 65520 STEP 16 ' hex 0000 to hex FFF0 1070 ASCIISTRING$ = "" 1075 FOR I = 0 TO 15 1080 BYTE% = PEEK(OFFSET + I) 1085 BYTE$[I] = HBYTES$[BYTE%] 1090 IF BYTE% < 32 OR BYTE% > 126 THEN ASCIISTRING$ = ASCIISTRING$ + "." ELSE ASCIISTRING$ = ASCIISTRING$ + CHR$(BYTE%) 1095 NEXT I 1100 OFFSET$ = RIGHT$("000" + HEX$(OFFSET),4) + ": " 1105 PRINT# 1, OFFSET$ 1106 PRINT OFFSET$ 1110 FOR I = 0 TO 15 1115 PRINT# 1, BYTE$[I];" "; 1115 PRINT BYTE$[I];" "; 1120 NEXT I 1125 PRINT# 1, " ";ASCIISTRING$ 1126 PRINT " ";ASCIISTRING$ 1130 NEXT OFFSET 1135 CLOSE 1 1140 STOP 1145 END 1150 ' that's all except for... 9000 GOTO 1015 ' to make a line pointer 9005 GOTO 1140 ' should remain a line number 9990 ' END OF: demotest.nbs