home *** CD-ROM | disk | FTP | other *** search
/ ftp.elysium.pl / ftp.elysium.pl.tar / ftp.elysium.pl / other / vic20 / cartgrab.txt < prev    next >
Text File  |  2008-03-07  |  31KB  |  555 lines

  1.  
  2.                         ======================
  3.                        =                      =
  4.                       =   Inside your Vic 20   =
  5.                       =     By Ward Shrake     =
  6.                        =                      =
  7.                         ======================
  8.  
  9.  
  10. This document is a collection of pinout diagrams and technical notes, meant
  11. to assist anyone who wishes to experiment electronically with the "obsolete" 
  12. Commodore Vic20 computer. Specifically, this document addresses the cartridge
  13. or Memory Expansion port and related items, such as ROM & EPROM memory chips. 
  14.  
  15. This is a very preliminary version of a document which could be expanded, if
  16. I decide to go even more ballistic, later on. All this text was written out in
  17. one day, with no prior planning, so if its a little jumpy, that's why. Later
  18. versions should be better. Right now, probably anything helps, so here it is.
  19. (Additions, corrections or whatever can be sent via email to the author.)
  20.  
  21. Ward Shrake, July 1995
  22. email: wardshrake@aol.com
  23.  
  24.  
  25. ----------------------------------------------------------------------------
  26.   Pinout diagram #1: Memory Expansion port connector of the Vic20 computer
  27. ----------------------------------------------------------------------------
  28.  
  29. Below is the pinout diagram of the Vic20 cartridge port, or Memory Expansion
  30. Connector. Please note that this is NOT the pinout for a cartridge that might
  31. fit into any port, nor is it a pinout of the User Port, which is something 
  32. completely different. This diagram shows the cartridge port's pinout, as you 
  33. face the rear of the Vic 20 computer. (The port is on the Vic20's left side.)
  34.        
  35. Bottom side of expansion port.       Top side of expansion port.
  36. (This half is on bottom.)            (This half is towards the keyboard.)
  37.  
  38.           (This edge of the connector faces left,
  39.           where the power switch and the LED are.)
  40.  
  41.                         _________    
  42.                         |  ___  |
  43.          GND         A  |  | |  |   1       GND                   
  44.          CA0         B  |  | |  |   2       CD0
  45.          CA1         C  |  | |  |   3       CD1
  46.          CA2         D  |  | |  |   4       CD2
  47.          CA3         E  |  | |  |   5       CD3
  48.          CA4         F  |  | |  |   6       CD4
  49.          CA5         H  |  | |  |   7       CD5          
  50.          CA6         J  |  | |  |   8       CD6 
  51.          CA7         K  |  | |  |   9       CD7       (Memory Location:)
  52.          CA8         L  |  | |  |   10      BLK 1       ($2000 - $3fff) 
  53.          CA9         M  |  | |  |   11      BLK 2       ($4000 - $5fff)
  54.          CA10        N  |  | |  |   12      BLK 3       ($6000 - $7fff)
  55.          CA11        P  |  | |  |   13      BLK 5       ($a000 - $bfff)
  56.          CA12        R  |  | |  |   14      RAM 1       ($0400 - $07ff)
  57.          CA13        S  |  | |  |   15      RAM 2       ($0800 - $0bff)
  58.          I/O 2       T  |  | |  |   16      RAM 3       ($0c00 - $0fff)
  59.          I/O 3       U  |  | |  |   17      V R/W 
  60.          S02         V  |  | |  |   18      C R/W 
  61.          NMI         W  |  | |  |   19      IRQ 
  62.          RESET       X  |  | |  |   20      NC 
  63.          NC          Y  |  | |  |   21      +5 Volts 
  64.          GND         Z  |  | |  |   22      GND 
  65.                         |  ---  |
  66.                         ---------     
  67.  
  68.           (This edge of the connector is on the
  69.           right, where all the other ports are.)
  70.  
  71.  
  72. Pinout Notes:
  73. -------------
  74. BLKxx =  8K decoded RAM/ROM block xx, active low. See chart above for area.
  75. CAxx  =  Address bus line xx
  76. CDxx  =  Data bus line xx
  77. C R/W =  Read/Write line from CPU. (Read = high, Write = low)
  78. GND   =  System ground
  79. I/O 2 =  Decoded I/O block 2, starting at $9130
  80. I/O 3 =  Decoded I/O block 3, starting at $9140
  81. IRQ   =  6502 Interrupt Request line (active low)
  82. NC    =  No connection
  83. NMI   =  6502 Non-Maskable Interrupt line (active low)
  84. RAMxx =  1K decoded RAM blockxx, active low. See chart above for memory area.
  85. RESET =  6502 reset line (active low) 
  86. S02   =  Phase 2 system clock
  87. V R/W =  Read/Write line from Vic chip. (Read = high, Write = low)
  88.  
  89.  
  90.  
  91. -----------------------------------------------------------------------
  92.   Pinout diagram #2: A standard Vic20 cartridge's card edge connector
  93. -----------------------------------------------------------------------
  94.  
  95. Below is a pinout diagram of a standard Vic20 cartridge, seen facing its card
  96. edge connector. Please note that this is NOT the pinout of the port it plugs 
  97. into, which is shown above. The two pinouts are exact opposites, because you 
  98. are facing the port head-on as is, but you have to flip a cartridge around
  99. 180 degrees to be able to look at it head-on, facing its card edge connector.
  100.  
  101.  
  102.  Bottom side of cartridge      Top (label or component) side of cartridge
  103.  
  104.                          _-_    
  105.          GND         Z   | |   22    GND    
  106.          NC          Y   | |   21    +5 Volts
  107.          RESET       X   | |   20    NC
  108.          NMI         W   | |   19    IRQ
  109.          S02         V   | |   18    C R/W
  110.          I/O 3       U   | |   17    V R/W     (Memory location:)
  111.          I/O 2       T   | |   16    RAM 3       ($0c00 - $0fff)
  112.          CA13        S   | |   15    RAM 2       ($0800 - $0bff)
  113.          CA12        R   | |   14    RAM 1       ($0400 - $07ff)
  114.          CA11        P   | |   13    BLK 5       ($a000 - $bfff)
  115.          CA10        N   | |   12    BLK 3       ($6000 - $7fff)
  116.          CA9         M   | |   11    BLK 2       ($4000 - $5fff)
  117.          CA8         L   | |   10    BLK 1       ($2000 - $3fff)
  118.          CA7         K   | |   9     CD7
  119.          CA6         J   | |   8     CD6
  120.          CA5         H   | |   7     CD5
  121.          CA4         F   | |   6     CD4
  122.          CA3         E   | |   5     CD3
  123.          CA2         D   | |   4     CD2
  124.          CA1         C   | |   3     CD1
  125.          CA0         B   | |   2     CD0
  126.          GND         A   | |   1     GND
  127.                          -_-
  128.  
  129.  
  130. --------------------------------------------------
  131.    Pinout diagram #3: EPROM # 2764A 
  132.    (This is a standard, 8K x 8 bit memory chip)
  133. --------------------------------------------------
  134.  
  135.             ____    ____
  136.             |   !__!   |
  137.         Vpp | 1     28 | Vcc  (+5 Volts)
  138.         A12 | 2     27 | PGM  (Active low) 
  139.         A7  | 3     26 | N.C. (No connection)
  140.         A6  | 4     25 | A8
  141.         A5  | 5     24 | A9
  142.         A4  | 6     23 | A11
  143.         A3  | 7     22 | OE  (Output Enable; Active low)
  144.         A2  | 8     21 | A10
  145.         A1  | 9     20 | CE  (Chip Enable; Active low)
  146.         A0  | 10    19 | D7
  147.         D0  | 11    18 | D6
  148.         D1  | 12    17 | D5
  149.         D2  | 13    16 | D4
  150.         GND | 14    15 | D3
  151.             |__________|
  152.  
  153.  See Note 6 below, for some tips on using this as a replacement memory 
  154.  chip, on a modified cartridge body, for experimentation purposes. Note
  155.  that there are differences between it and the standard Vic20 chip below, 
  156.  that will have to be accounted for before it can be wired to the boards.
  157.  
  158.  
  159. --------------------------------------------------------
  160.     Pinout diagram #4: "MPS 2364" ROM chip
  161.     (Commodore-standard, 24-pin ROM chip, 8K x 8 bit.) 
  162. --------------------------------------------------------
  163.  
  164.             ____    ____
  165.             |   !__!   |
  166.        CA7  | 1     24 | +5 Volts 
  167.        CA6  | 2     23 | CA8
  168.        CA5  | 3     22 | CA9
  169.        CA4  | 4     21 | CA12
  170.        CA3  | 5     20 | CS (Chip select, active low)
  171.        CA2  | 6     19 | CA10
  172.        CA1  | 7     18 | CA11
  173.        CA0  | 8     17 | CD7
  174.        CD0  | 9     16 | CD6
  175.        CD1  | 10    15 | CD5
  176.        CD2  | 11    14 | CD4
  177.        GND  | 12    13 | CD3
  178.             |__________|
  179.  
  180.  
  181. This pinout was derived from a Vic20 schematic, found in the book the 
  182. "Vic20 Programmer's Reference Guide". (Great book!) Please note that while
  183. this is an 8k-by-8-bit Commodore memory chip (its actually the Kernal chip, 
  184. located at $E000-$FFFF), and that while it could normally be assumed safely 
  185. that a company would standardize and use the same chips in their cartridges 
  186. that they used in their computer's motherboards, this is Commodore we're 
  187. talking about. A bit of paranoia might be in order. Having said that, I'll 
  188. note that as of this writing, the author has not compared this diagram and 
  189. an actual memory chip from a Commodore-produced Vic20 cartridge. 'Nuff said!
  190.  
  191.  
  192. ---------------------------------------------------------------------------
  193.   Assorted notes on the diagrams above, and related subjects. (No order.)
  194. ---------------------------------------------------------------------------
  195.  
  196.  
  197. Note 1: Information for the diagrams above was taken from the Vic20 reference
  198.         book "The Vic Revealed" by Nick Hampshire, 1982, Hayden Book Co, Inc.
  199.         That info was verified by checking it against information found in 
  200.         the "Vic20 Programmer's Reference Guide," 1982, by Commodore Business
  201.         Machines, Inc. and Howard W. Sams & Company, Inc.
  202.  
  203. Note 2: You are looking at the cart pinout as if you were holding an unopened 
  204.         cartridge, label-side up (or right, in these diagrams) with the gold 
  205.         fingers pointing at you. If you are looking at a bare circuit board 
  206.         once it has been taken out of its outer plastic case, the chip is on 
  207.         top (or right, as shown here) again with the gold fingers facing you. 
  208.         (The diagrams were drawn sideways, as the ASCII drawings are somewhat
  209.         clearer this way, believe it or not. There is less confusion this way
  210.         over which pin is which. Horizontally, each name takes up more space.)
  211.  
  212. Note 3: Radio Shack currently (as of July 1995) carries a part that works as
  213.         a Memory Expansion Port connector for the Vic20. However, they are
  214.         discontinuing it, and are selling off all remaining stock. Their part
  215.         number is 276-1551 for their "44-position card-edge connector." Once 
  216.         these are gone, you'll have to find another source for them. ($1.27) 
  217.         This part is useful for experimenting with this port on the Vic20, as 
  218.         it is a perfect fit, as is, to accept standard plug-in Vic cartridges.
  219.  
  220. Note 4: A perhaps useful experimenter's tip: If you plan to take the circuit 
  221.         board out of the cartridge case, then remove the ROM chip(s) from the
  222.         circuit board, mark the two sides of the board first, or you may no
  223.         longer be able to tell which is the top, and which is the bottom! 
  224.         This is especially true if one is removing chips to install sockets.
  225.         (Any magic marker will do; just write "Bottom" on the "green stuff".
  226.         Do not write on top of any exposed metal surfaces or the gold pins!)
  227.  
  228. Note 5: For experimenting purposes, it might be handy to find a cartridge you
  229.         no longer care about, desolder the existing ROM chip from the circuit
  230.         board inside the cartridge and install an IC socket to make it easier
  231.         to change chips, later. However, note two things about this. One, the
  232.         socket makes the whole thing taller, and it may no longer fit into a
  233.         standard case. You can either (carefully!) use the new circuit board
  234.         without using its outer case, at least for in-house testing, or you
  235.         may be able to cut a "window" in the top of the case to clear it all.
  236.         Second, some cartridges don't use standard IC ROM's, so try another 
  237.         cartridge, until you find one that does use a standard DIP package.
  238.  
  239. Note 6: On all the Vic20 carts the author has opened and seen so far, the ROM
  240.         chip inside has 24-pins. Standard replacement EPROM's have 28-pins. 
  241.         This creates problems, but not insurmountable ones. It is a bit of a 
  242.         nuisance, but the dedicated experimenter can modify a 24-pin circuit
  243.         board, to accept any 28-pin standard EPROM, such as the 2764 package.
  244.         If one did not want the hassle of doing this, one other method exists
  245.         to be able to put your own 8K eprom chips inside; however, it is not 
  246.         cheap. Motorola makes an 8K EPROM that is completely compatible with 
  247.         Commodore's "standard" 24-pin ROM chips. It even works as a direct 
  248.         pin-for-pin replacement for the 8K Kernal and Basic ROM's inside your
  249.         Vic20 or your C64; the author has replaced both types in the past.
  250.         The part number for this EPROM is MCM 68764. It is about $18.00 each.
  251.         (Yes, it is programmable via the C64's "Promenade" eprom burner too!)
  252.         I think I got my 68764 years ago, from Jameco Electronics; try them.
  253.         (A 2764 adapter circuit board can be made to adapt the differences in 
  254.         24-to-28 pin sockets, but it will likely be too tall to fit inside.)
  255.  
  256. Note 7: A reset button can be wired into the Vic20 fairly simply. This might
  257.         be a good idea, if one plans to experiment much. The Vic20, or any
  258.         computer, might lock up when you've told it to do something odd while
  259.         experimenting. Simply use a momentary-contact, normally-open switch, 
  260.         wired between the RESET line and any port GND line. When you press 
  261.         the new button for a second and let go, the computer will reset. This 
  262.         is because the RESET line is active low, and your switch grounds that 
  263.         line. If you decide to do this *inside* your Vic20, remember you are 
  264.         now looking at the *back* of the port, NOT the front. Therefore, use 
  265.         the pinout diagram for a cartridge, not the port, to find the lines.
  266.         Radio Shack switch part number 275-1547 or equivalent will work fine.  
  267.  
  268. Note 8: The memory area located at $A000-BFFF ("Block 5") is normally 
  269.         considered to be a ROM-only block of memory. RAM can be mapped into
  270.         that space if you modify the cartridge's internal wires or jumpers, 
  271.         to redirect a standard RAM cartridge to load higher up in memory. 
  272.         However, BASIC cannot normally access that area, as it is meant to
  273.         be for ROM's only. This is important, if one wishes to archive an
  274.         8K autostart ROM cartridge (normally located in block 5), and run the
  275.         resulting ROM image from within RAM. It can be done, but you have to
  276.         modify a standard 8K RAM cartridge to do it. (Ground BLK 5, and cut
  277.         any trace or jumper that tells the cart to load in a different area.)
  278.         
  279.         Note also that some carts may be copy-protected, and will not run in
  280.         RAM without modification or "training," to alter the copy protection.
  281.  
  282.         It may be possible to get around this copy-protection (but the author
  283.         hasn't tried it yet) by modifying the read/write lines, so that after
  284.         loading the program's ROM image into RAM memory, you flip a switch 
  285.         first, then type in the SYS command to start the program up. If this
  286.         idea works, it would emulate ROM by not being able to be written to, 
  287.         when the copy protection tries to determine if the copy is in RAM or 
  288.         ROM. Of course, when reprogrammed into an EPROM, it will act as if it
  289.         were ROM anyway, so this may no longer matter in that case.
  290.  
  291. Note 9: Trying to relocate a machine language program from the memory area
  292.         where it was written in and intended to be, and to have it actually
  293.         work afterwards, is not advised. It won't work, without doing so
  294.         many modifications to the machine language object code that you may
  295.         as well just start over and reprogram it all. Don't bother trying. 
  296.         It seems the idea is to get the real, actual code as written, anyway.
  297.  
  298.         Similar problems confront the user who wishes to archive a tape or a
  299.         diskette-based original. Trying to make a cartridge out of it, isn't
  300.         worth the huge headaches. You are better off, in this case, trying to
  301.         archive tape-based programs to floppy disk (which will still require 
  302.         a little modification, but not as much), and floppies to floppies.
  303.         
  304. Note 10: Some FTP archives exist on the Internet for the Vic20 enthusiast. 
  305.         ("ftp.funet.fi" in Finland, and "ftp.hrz.uni-kassel.de" in Denmark.)
  306.  
  307.         When downloading archived ROM images from these places, one should
  308.         be aware that they are missing two bytes that the Commodore Vic20 and
  309.         the Commodore 64 computers consider absolutely critical to load and
  310.         use files with. These are the first two bytes of any Commodore file,
  311.         which tells the computer a program's "Starting address," or where to 
  312.         load it into memory. If its not in the right place, it will not work. 
  313.         Period. Even one byte off, and it will not work. These raw image 
  314.         files include only the ROM's internal codes, and no starting address.
  315.  
  316.         The FTP site in Denmark has some instructions on how to add these two
  317.         bytes to a file, using a Commodore Vic20 compatible disk drive. The
  318.         author made an executable program that does this on the IBM, but it
  319.         isn't very user-friendly at this point. It does work, however, and as
  320.         soon as it will pass muster publicly, I plan to upload it to both FTP
  321.         sites. This program, when available to the public, is meant to be used
  322.         after a ROM image file has been downloaded onto an IBM computer, but 
  323.         before the user transfers it to a Commodore-compatible diskette, using
  324.         whatever process the user likes most. (The "X-1541" user-built cable 
  325.         which connects the IBM printer port to the CBM serial port, is the 
  326.         author's favorite way of transferring files from IBM to CBM and back.)
  327.  
  328. Note 11: On all the NTSC Vic20 motherboards I looked at (4 or 5), the BASIC
  329.         memory chip is labeled "UE11", while the Kernal chip is labeled as
  330.         "UE12". My PAL schematic lists these two as UD5 and UD6, respectively.
  331.         The Basic memory map area is at $C000-DFFF. Kernal is at $E000-FFFF.
  332.         The only other 24-pin chip is the Character Generator; its 4K, not 8K.
  333.  
  334. Ward Shrake
  335. email: wardshrake@aol.com
  336. July 1995
  337.  
  338.  
  339. -------------------------------------------------------------------------
  340.     Short technical tutorial on Vic20 ROM cartridges, including notes 
  341.     on cartridge archiving methods, and the Vic autostart process.
  342. -------------------------------------------------------------------------
  343.  
  344. A Vic20 cartridge is approximately 5.5 inches wide, 3 and 3/8ths inches deep,
  345. and 5/8ths inches tall, when viewed as if ready to be installed. Standard
  346. configurations are 8K and 16K of 8-bit ROM memory, using one or two chips of 
  347. ROM memory onboard. If other standard cartridge memory configurations exist, 
  348. the author is currently unaware of them. (But would like to hear of any, if 
  349. they do/did exist, and especially if they were once made commercially.)
  350.  
  351. Inside a typical Vic20 cartridge is one double-sided, etched circuit board, 
  352. with some form of memory chip installed. This may be a "standard" IC chip as 
  353. we are used to seeing (24 or 28 pin ROM, in a DIP package), or it could be 
  354. a blank circuit board, with a tiny blob of black epoxy material on it, under 
  355. which are presumably the internal components of a typical, normal ROM chip. 
  356.  
  357. The standard circuit board size is approximately 3 and 9/16ths inches wide, 
  358. and 1 and 3/4 inches deep. A cart fits into a 44-position, double-sided card 
  359. edge connector, which is a permanent part of the Vic20 itself, in the back.
  360.  
  361. On the cart circuit board itself may (or may not) be several wire traces or 
  362. jumpers, which if there, are meant to configure the cartridge to a certain
  363. memory arrangement. These jumpers are meant to connect the BLK or RAM lines
  364. to the system ground. These lines, when connected, tell the Vic20 where to 
  365. place the cartridge within the Vic20's internal memory map scheme. 
  366.  
  367. While all "normal," autostart game cartridge are located in one fixed area
  368. of memory, this is not true with all cartridges, game or not. Some of the 
  369. earliest cartridges did not use the autostart procedure for whatever reason,
  370. (presumably because they did not know it existed, at that early stage?) and 
  371. those are located in "non-standard" memory locations. The Vic20 was built
  372. and designed when memory was expensive, and computers were designed to be 
  373. bare-bones memory-wise, but with the capability to expand on later. This may
  374. take some getting used to at first, but understanding it gets easier in time.
  375.  
  376. 16K cartridges, for example, generally have one 8K ROM block located from 
  377. $A000-$BFFF, and another 8K ROM block located at $6000-7FFF. If a cartridge 
  378. was factory-made not to autostart; in other words, if it needs you to type in 
  379. a "SYS" number to start it, its memory could be located in any block. 
  380.  
  381. The "normal" spot for an 8K cartridge to be located in memory is in "Block 5" 
  382. (which is located at $A000 to $BFFF). Again, this is not the only possible 
  383. spot in memory for a cartridge to be located, but it is the only spot where 
  384. the Vic20 will look for a cartridge that automatically starts on power-up.
  385.         
  386. This is because (at power up) the Vic20 looks for a precise code in a precise 
  387. spot, to see if it should autostart a cartridge or not. If the Vic20 finds 
  388. this *exact* five-byte code, *exactly* where it is supposed to be located in 
  389. memory, the Vic20 turns control over to the cartridge. If not, it gives over
  390. control to the user, via the normal, power-up Basic READY prompt screen. 
  391.        
  392.  
  393.         This 8K autostart sequence code is shown below:
  394.  
  395.         Address______Hex value_____Decimal value____ASCII values
  396.         $A004        $41           65               Capitol "A"    
  397.         $A005        $30           48               Digit "zero"
  398.         $A006        $C3           195              Reverse "C" character
  399.         $A007        $C2           194              Reverse "B" character
  400.         $A008        $CD           205              Reverse "M" character
  401.         
  402. If the computer finds this five-byte sequence exactly as shown, it          
  403. turns control over to the machine language program in the cartridge.
  404. To do so, it needs to know where the program begins. There are four
  405. bytes which determine this, as shown below: (Also within the cart.)
  406.  
  407.         Address______What this byte of information contains__________
  408.         $A000        Low-byte of a 16-bit "hard start" address (to begin at)
  409.         $A001        High-byte of the 16-bit "hard start" address
  410.         
  411.         $A002        Low-byte of 16-bit "warm start" address (restore key)
  412.         $A003        High-byte of 16-bit "warm start" address
  413.  
  414. This is all very important when trying to archive an image of the information
  415. contained on a ROM cartridge. Altering either of the two required parts of 
  416. this sequence, causes the cartridge to not autostart, but to be mapped into 
  417. memory properly, anyway. Assuming a certain level of technical expertise, a 
  418. user can do one of two (or more?) things to achieve this. 
  419.         
  420. One is to move the cartridge's starting location temporarily, so that the 
  421. code is present, but not in the right place. This can be done by altering the 
  422. physical traces on each cartridge's circuit board. This is undesirable, 
  423. except perhaps for self-training purposes, as every single cartridge would 
  424. have to be individually modified, archived, then reassembled for normal use. 
  425. Permanently modifying the Vic20's internal wiring is also possible, but 
  426. hardly desirable, as permanent damage to the Vic20 might also result.
  427.         
  428. The best way I could recommend for this would be to have a qualified tech 
  429. build or wire a cartridge-port pass-through device, where nearly all the 
  430. traces re-connected where they are supposed to, except for a critical few. 
  431. Using a 44-position card edge connector, some wire and a junk cartridge (or
  432. etched circuit board like a cartridge's pins), this could be done. Most wires
  433. would start at the card edge, where you'd plug the device into the Vic20, and 
  434. pass-through harmlessly to the card edge connector, where carts would plug in.
  435.  
  436. This device reroutes the "BLK 5" trace, preferably by use a "normal/modified" 
  437. switch, so that even though the cartridge intends to load at $A000, it loads 
  438. to another 8K block of memory instead. Whichever one you wire it to; perhaps 
  439. Block 1 or 3. Make the switch(es) act as a simple pass-through, normally, but
  440. disconnect the "Block 5 to ground line" while at the same time connecting the 
  441. "Block X line to ground", to remap where the cartridge will temporarily go.
  442.  
  443. This device would ideally be plug-in-able and removable, like a cartridge, so 
  444. as to require no modifications to either the Vic20 or cartridges. A reset 
  445. button could also be installed in the device, as well, while you're at it. If
  446. you use an old cartridge as your plug-in on the Vic20 end, cut all traces that
  447. still go to the existing chip(s). Solder wire ends onto the portions that exit
  448. the Vic20, and route them to your external plug-in connector box. If you use
  449. ribbon cable as your wiring, you can probably even sneak the wire out the back
  450. of the existing cartridge's case, as there is a wide slot in most Vic cases!
  451.  
  452. This method will allow you to temporarily re-map where the cartridge image
  453. will appear in memory, to defeat the autostart feature. Once this is defeated
  454. the technically-inclined user who is familiar enough with Commodore computers
  455. can copy the information to tape or diskette for storage. This takes some 
  456. knowledge and expertise, but can be learned. Some help is offered; see below.
  457.  
  458. The user should understand that if this method (memory relocation) is used to
  459. defeat the autostart feature, and to thereby attempt to archive a cart's ROM,
  460. the work is not over. Once archived to disk, the hard part is done, true, but
  461. when you saved it to diskette, it was saved with a now-incorrect starting 
  462. address. Before the image can be used further, this has to be corrected.
  463.  
  464. This can be changed, fairly easily, by someone who knows how, but it requires 
  465. knowledge of using a software tool called a "disk sector editor" to change 
  466. the now-incorrect high-byte of the relocated starting address, to the correct
  467. unrelocated high byte: where it would have been, before you moved it. To do 
  468. so, you find the first disk sector of the ROM image file, and change the 
  469. fourth byte in (not byte $04!) to be $A0, resave the sector, and you're done.
  470. After this modification, your ROM image files will now load where they should,
  471. (into $A000 RAM, if you have it), and are ready for further processing. 
  472.  
  473. Even the common C64 "Fastload" utility cart has a very servicable sector 
  474. editor in it, so it isn't as bad as it may have sounded. Still, you need to 
  475. know how to use it, and what to change, so it is best left to a professional.
  476.  
  477. To actually save the block of memory to tape/disk, you either use the memory
  478. save feature of a machine language monitor program (not built in) to save the
  479. 8K block of ROM memory temporarily, or you can change certain POKE's in the 
  480. Vic20's memory, to tell it your cartridge is located in the Basic program 
  481. memory area, so that the normal SAVE command works. The beauty of the latter
  482. is that no additional programs are needed to make this work; just type in four
  483. POKE commands, then tell it to SAVE as it would normally save a Basic program.
  484.  
  485. For those of you already familiar enough with Commodore's style and memory
  486. arrangement schemes to make sense of this, bytes 43 and 44 (decimal, not hex) 
  487. are the pointers to the Start of Basic memory area, and bytes 45 and 46 are 
  488. the pointers to the Start of Variables, or in other words, the End of Basic.
  489. Follow this chart, to save a block of memory from these areas via pokes:
  490.  
  491.  
  492.    Block #___Hex Address____Poke 43,x___Poke 44, x___Poke 45, x__Poke 46, x
  493.      1       $2000-3fff      x = 0       x = 32       x = 255     x = 63   
  494.      2       $4000-5fff      x = 0       x = 64       x = 255     x = 95
  495.      3       $6000-7fff      x = 0       x = 96       x = 255     x = 127
  496.      5       $a000-bfff      x = 0       x = 160      x = 255     x = 191
  497.                                                                     
  498.  
  499. The above is only one possible way to archive an 8K block of Vic20 memory.
  500. However, a second method exists, requiring some Vic20 modifications. A truly
  501. hard-core Vic user could alter the copy of the startup code that is stored in 
  502. the Kernal ROM chip, so that no normally-correct autostart sequence code ever 
  503. matches it as long as your new Kernal is in place.
  504.         
  505. Remember, there must always be *two* copies of the start-up code; one in the 
  506. cartridge itself and one stored in the computer for comparison. If either of 
  507. these two seperate codes are altered, even slightly, it will not autostart! 
  508.  
  509. The cartridge gets mapped into memory at its correct location, but the Basic 
  510. "READY" screen comes up instead, giving the user full control. Once you've
  511. achieved this, you simply do four pokes (to change the start and end of BASIC
  512. memory to match where the cart code is), or save the info with an ML monitor.
  513.  
  514. With some work and an "MCM 68764" 8K EPROM, this can be done. It is not just
  515. a vague theory; the author has done it. It works, as does a similar technique 
  516. for doing the same general thing with the Commodore 64 computer. (With the 
  517. appropriate changes, of course, to reflect the C64's different architecture 
  518. and memory map; the C64 codes are "CBM80" instead of "A0CBM", and the Kernal 
  519. expects that code to be in a cartridge at locations $8004-$8008 instead of 
  520. $A004-$A008. Starting address is in the same exact format as the Vic's.) 
  521.         
  522. This a much more involved modification, and not for the squeemish or 
  523. those who only own one Vic20 (or C64) without any spares to fall back on! 
  524.  
  525. To do it, you need a heck of a lot of computer knowledge specific to the 
  526. computer you're working on, an eprom burner, an eprom eraser, and patience.
  527. You have to search in the Kernal's memory image, for the start-up code, and
  528. modify those bytes to be something different than they are, while leaving all
  529. the other bytes just as they are. This alone takes some serious skills, no?
  530. You also need skills and tools in desoldering and removing IC chips, as well
  531. as soldering in IC sockets, and not destroying anything in the process.
  532.  
  533. I won't go into this much, because I don't imagine many people will bother to
  534. actually attempt this method, since the other has some serious pro's to it, 
  535. and since this should be about enough info to go on; if you can't figure out
  536. how to do this modification with this info, you probably should not try it, 
  537. until you've progressed enough at a later time. Or, have someone else do it
  538. for you, with these instructions, if you really want it done badly enough.
  539.  
  540. This way may appeal to some people, but I recommend the other for most folks. 
  541. The overly-technical types might be tempted to go ballistic however, and more 
  542. power to you! A thought, in parting; one could put 2 copies of the Kernal ROM 
  543. chip, one stock and one modified, into one 16K eprom, with an external switch 
  544. to flip between the two versions. (Or just go lower tech, and just manually 
  545. swap out Kernal chips as needed; most Vic20's seem to have sockets anyway.)
  546.  
  547. Whatever you do, I hope you've enjoyed this article! Later, all!
  548.  
  549. Ward Shrake
  550. wardshrake@aol.com
  551. July 1995
  552.  
  553.  
  554.  
  555.