daily pastebin goal
64%
SHARE
TWEET

HEXREAD.BAS (Hex Reader for Telehack)

tchnmncr Mar 21st, 2017 (edited) 27 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 10 REM HEXREAD.BAS BY TECHMAGE@TELEHACK.COM
  2. 20 PRINT "STARTING ADDRESS (DEC)";
  3. 21 INPUT A: REM STARTING ADDRESS (DECIMAL)
  4. 25 PRINT "DATA PER LINE";
  5. 26 INPUT L: REM LINE LENGTH
  6. 30 PRINT "LINES PER PAGE";
  7. 31 INPUT P: REM PAGE LENGTH
  8. 35 DIM D(L): REM DATA ARRAY
  9. 40 AC=A: REM CURRENT ADDRESS (INCREMENTS)
  10. 50 REM *** BEGIN PAGE LOOP ***
  11. 55 FOR IA=1 TO P
  12. 60 GOSUB 100
  13. 65 GOSUB 200
  14. 70 GOSUB 300
  15. 75 GOSUB 400
  16. 80 AC=AC+L
  17. 83 PRINT: REM NEW LINE
  18. 85 NEXT
  19. 90 GOSUB 500
  20. 95 GOTO 600
  21. 100 REM *** GET DATA ARRAY ***
  22. 105 FOR IB=1 TO L
  23. 110 D(IB)=PEEK(AC+(IB-1))
  24. 115 NEXT
  25. 120 RETURN
  26. 125 D=PEEK(AC)
  27. 130 PRINT HEX$(D);" ";
  28. 200 REM *** PRINT ADDRESS ***
  29. 205 FOR J=1 TO 8-LEN(HEX$(AC))
  30. 210 PRINT "0";
  31. 215 NEXT
  32. 220 PRINT HEX$(AC);" ";
  33. 225 RETURN
  34. 300 REM *** PRINT HEX DATA ***
  35. 305 FOR IC=1 TO L
  36. 310 H$=HEX$(D(IC))
  37. 315 IF LEN(H$)=1 THEN PRINT "0"+H$+" ";
  38. 320 IF LEN(H$)>1 THEN PRINT H$+" ";
  39. 325 NEXT
  40. 330 RETURN
  41. 400 REM *** PRINT ASCII DATA ***
  42. 405 FOR ID=1 TO L
  43. 410 IF D(ID)>=32 AND D(ID)<=126 THEN PRINT CHR$(D(ID));
  44. 415 IF D(ID)<32 OR D(ID)>126 THEN PRINT ".";
  45. 420 NEXT
  46. 425 RETURN
  47. 500 REM *** PRINT PAGE FOOTER ***
  48. 505 PRINT "---0x";HEX$(AC-(L*P));"/0x";HEX$(AC-1);"---------"
  49. 600 PRINT "CONTINUE";
  50. 605 INPUT C$: REM CONTINUE? RESPONSE
  51. 610 IF C$="Y" OR C$="y" THEN GOTO 55
  52. 615 END
RAW Paste Data
Top