home *** CD-ROM | disk | FTP | other *** search
/ Outlet 55 / outlet-55.mgt / za04 < prev    next >
Text File  |  2021-04-18  |  4KB  |  1 lines

  1.      5. A program to print out 640d hex addresses with their     bytes on a single 66-line page, in ten columns of 64d entries  each. It is useful for studying machine code programs, whether  in the ROM, one's own, or obtained from elsewhere. It requires  an eighty-column printer.                                                                                                              5 REM "hexpt                                                                                                                   10 REM "Machine code display.                                                                                                   20 REM "Functions:                                                     h$() converts decimal to hex,                                   a$() and b$() form the hi and lo hex digits of a   byte given in decimals,                                                      z$() forms a 2-byte number given in decimals into  four hex digits.                                                      30 DEF FN h$(x) = CHR$ (48*(x<10) +                                                     55*(x>9) + x)                           40 DEF FN a$(x) = FN h$(x - 16*INT (x/16))                      50 DEF FN b$(x) = FN h$(INT (x/16))                             60 DEF FN z$(x) = FN a$(INT (x/256)) +                                            FN b$(INT (x/256)) +                                            FN a$(x - 256*INT (x/256)) +                                    FN b$(x - 256*INT (x/256))                                                                                  1000 REM "Initial prompt:                                       1100 CLS: PRINT AT 7,3; "Prints out machine code in";                           AT 8,6; "hexadecimal numbers.";                                 AT 10,6; "640 bytes per page.":                      INPUT "Input start no (decimal): ";g:                           INPUT "How many pages? ";p:                                     LET z = g + 640*p - 1                                                                                                      1199 REM "Page printing loop: subr 2100 prints entry a.         1200 FOR f=g TO g+63:                                                     FOR c=0 TO 9:                                              REM "Prints entry in line f, column c+1: ta, tb are tabsettings.                                                           1300                   LET a= f + 64*c:                                                LET ta= 8*c:                                                    LET tb= 8*c + 5:                                                GO SUB 2100:                                       NEXT c:                                                    NEXT f:                                                         LPRINT ''':                                                     LET g= g + 640:                                                 IF g < z THEN GO TO 1200                                                                                                   1400 STOP                                                                                                                       2000 REM "Subr to print address and contents of entry a.        2100 LPRINT TAB ta; FN z$(a);                                               TAB tb; FN z$(PEEK a)(3 TO);:                            RETURN                                                                                                                     9999 SAVE d1 "hexpt" LINE 1000                                                                                                      There are several commercially available "disassembler" programs, which read machine code and print out assembly        language; such programs are usually mostly in m/c and quite     complex.