daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest Aug 12th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2.  
  3.  
  4. ROM Reader (eventually will include a write routine)
  5. Ver 0.0.4
  6. 06/11/2010
  7. Forest Kunecke AKA Vaati
  8. version 0.0.4 - swtitched to using the FDS object instead of serial_terminal.spin
  9. version 0.0.3 - swtitched to having it actually communicate with the pc instead of displaying on a tv.  Takes 26 seconds to read a 65535 byte rom
  10. version 0.0.2 - fixed a major error which caused it to read the rom as empty all the time.
  11.  
  12. }
  13. con
  14.  
  15.   _clkmode = xtal1 + pll16x
  16.   _xinfreq = 5_000_000
  17.  
  18.   OE = 25
  19.   CS = 24
  20.  
  21. var
  22.  
  23.   long  addr
  24.   byte  data
  25.  
  26. obj
  27.  
  28.   'tv: "Debug_1pinTV"
  29.   ptx: "jm_txserial"
  30.   'uart: "FullDuplexSerial"
  31.  
  32. pub start | i
  33.  
  34.   'OE = output enable on ROM
  35.   'CS = chip select on ROM
  36.  
  37.   addr:=%0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0                'set address as first address in memory
  38.  
  39.   dira[OE]~~                                            'make OE an output
  40.   dira[CS]~~                                            'make CS an output
  41.  
  42.   dira[0..15]~~                                         'make P0 thru P15 outputs
  43.   dira[16..23]~                                         'make P16 thru P23 inputs
  44.   'uart.start(31,30,0,115200)
  45.   ptx.init(30,115200)
  46.  
  47.   repeat i from 0 to 65535                               'change the end value to however many memory addresses your rom has
  48.     outa[OE]~                                           'make OE low
  49.     outa[CS]~                                           'make CS low
  50.     outa[0..15] := addr                                 'write address
  51.     'Pause(5)
  52.     waitcnt((clkfreq/1000000)*5 + cnt)
  53.     data := ina[16..23]                                 'read data from rom
  54.     outa[OE]~~                                          'make OE high
  55.     outa[CS]~~                                          'make CS high
  56.     'uart.hex(data,2)
  57.     ptx.hex(data,2)
  58.     addr++                                              'increment address
  59.     'Pause(5)
  60.     waitcnt((clkfreq/1000000)*5 + cnt)
  61.  
  62. {PRI Pause(us)
  63.  
  64.  
  65. ''Calculates the pause rate in microseconds
  66. waitcnt((clkfreq/1000000)*us + cnt)
  67. }
RAW Paste Data
Top