Pincoder Diagnostics Inc. Version 2020.06.23.0506

ROM NAME
==============================================================================================

edit_cmos (Williams sys7)



PURPOSE
==============================================================================================

I wrote this ROM to allow direct editing of any value stored in the 5101 chip (Also known as
the CMOS chip).  All values shown on the display are in decimal. Running this ROM is optional
and is included for education purposes. You will not need to run it in order to troubleshoot
anything.

You WILL NEED GOOD BATTERIES INSTALLED when running this test. Also, the coin door must be
open for this to work.




PROCEDURE
==============================================================================================

This ROM makes it easy to map out the data stored in the 5101 chip. You can quickly build a
list of all non-zero values by booting this ROM with the coin door open and writing down the
INDEX NUMBER (shown in the Player 3 display) and the associated VALUE (shown in the Player 4
display). Set the AUTO_UPDN switch to UP and press the HIGH SCORE RESET button to advance to
the next address with a non-zero value.


    NOTE: This ROMs starting address is always the first non-zero VALUE from the beginning of
    the chip.


Try this for starters:

    1) Run the clear_cmos ROM, so that when the stock ROM boots, it knows to initialize the
    5101 with default values.

    2) Run the Stock ROM, so the 5101 chip is initialized with the default values.

    3) Run this ROM, so you can look at what the initial values are and/or change them if you
    like.

You can also change a few settings via the Stock ROM, play a game or two, and then run this
ROM again, writing down the updated values. You may see patterns appear, or be able to
identify which addresses affect game play etc.

Here's a summary of the controls for using this ROM:

    * Use the ADVANCE button on the coin door to increment or decrement (by one) the ADDRESS
    based on the position of the AUTO_UPDN switch.

    * Use the CREDIT button to increment or decrement the VALUE of the data stored at that
    address based on the position of the AUTO_UPDN switch.

    * Use the HIGH SCORE RESET button to jump up or down (based on position of the AUTO_UPDN
    switch) to the next address that contains a non-zero value.



ABOUT THE 5101 CHIP
==============================================================================================

The 5101 chip is located at address 256 and is 256 bytes long.  This means all of the 5101
data is sequentially stored in addresses 256 through 511, inclusively.

The 5101 is a 4 bit chip, and so the range of possible values for the data stored at any of
its addresses is decimal 0 to 15.  Two addresses are needed (x and x+1) to store a single 8
bit value.

Some VALUEs in the 5101 are encoded as Binary Coded Decimal (BCD). BCD ranges from 0x00 -
0x99. To store this in the 4-bit 5101 you set address X to the numerical value of the LEFT
digit, and address X+1 to the numerical value of the RIGHT digit.




WHAT THE DISPLAYS ARE SHOWING
==============================================================================================


    * P1 Display: Shows the ADDRESS that you are currently viewing/editing.

    * P2 Display: Shows the HIGH BYTE of the ADDRESS.  This is also called the PAGE
    NUMBER. The 5101 fits perfectly into PAGE 1, so this value is always 1.

    * P3 Display: Shows the LOW BYTE of the ADDRESS.  This is an INDEX NUMBER into the current
    PAGE. Since the 5101 starts exactly on a PAGE boundary, this number indicates how far you
    are into the 5101 address space.  You may notice that P1 = (P2 x 256) + P3.  Sometimes
    it's helpful to have an address shown in two different ways.

    * P4 Display: Shows the VALUE of the data stored in the current ADDRESS.



WHAT YOU CAN DO WITH THIS ROM
==============================================================================================

So what can you do with it?  Well, your game uses the data in some of those addresses to
remember things, and/or alter game play. If you know what certain addresses are used for, and
the possible VALUEs for the data in those locations, you can manipulate your game.

For example, ADDRESS 395 and 396 (on system 6 in the least) hold the MAXIMIM_CREDITS
value. The Default BCD value of 20 means that address 395 is set to 0x02, and address 396 is
set to 0x00, like this:

  | 395 = 0x02
  | 396 = 0x00

So if you want to put the game into FREE PLAY mode (MAXIMUM_CREDITS=00) just set 395 to 0x00,
and leave 396 at 0x00.  Then replace this ROM with the stock GREEN2 ROM and turn on the
machine.

    NOTE: With the COIN DOOR CLOSED you will only be able to modify the first half of the 5101
    (addresses 256-383). Open the coin door to modify the second half (384-511)




EXPECTED RESULTS
==============================================================================================

You should be able to scroll through and view/modify VALUES stored in various ADDRESSES of
the 5101 chip. This will affect game play. Since the meaning behind the values is largely
undocumented it is only possible to know what the effects are by changing the values here and
booting into game mode to see if you notice any differences.

If you have the patience and the desire to use this ROM to map out locations, their possible
values, and the effects they have on game play and you want those game values known to the
rest of the universe then send me the information and I'll include it in the instructions for
this ROM. Thanks! :)




EXAMPLE
==============================================================================================

Let's use the information from the init_cmos ROM as an example. To create it, I had to map out
the values of the 5101 chip using this ROM. I then created a file with the following contents:

ROM_CMOS_TABLE_START:      ; New   ; Default values for Black Knight
IDX_103: .db 02,00 ; <unknown>
IDX_105: .db 00,00 ; <unknown>
IDX_107: .db 00,00 ; <unknown>
IDX_109: .db 00,00 ; <unknown>
IDX_111: .db 00,00 ; <unknown>
IDX_113: .db 00,00 ; <unknown>
IDX_115: .db 00,00 ; <unknown>
IDX_117: .db 00,00 ; <unknown>
IDX_119: .db 00,00 ; <unknown>
IDX_121: .db 00,00 ; <unknown>
IDX_123: .db 00,00 ; <unknown>
IDX_125: .db 11,02 ; <unknown>
IDX_127: .db 10,05 ; <unknown>
IDX_129_BACKUP_HS_TO_DATE: .db 00,05 ; 02,05 - New:   500,000, default: 2,500,000
IDX_131_14_REPLAY_SCORE_1: .db 01,01 ; 01,00 - New: 1,100,000, default: 1,000,000
IDX_133_15_REPLAY_SCORE_2: .db 02,02 ; 02,00 - New: 2,200,000, default: 2,000,000
IDX_135_16_REPLAY_SCORE_3: .db 03,03 ; 00,00 - New: 3,300,000, default: no replay award
IDX_137_17_REPLAY_SCORE_4: .db 04,04 ; 00,00 - New: 4,400,000, default: no replay award
IDX_139: .db 00,00 ; <unknown>
IDX_141: .db 00,00 ; <unknown>
IDX_143: .db 00,00 ; <unknown>
IDX_145: .db 00,03 ; <unknown>
IDX_147: .db 00,05 ; <unknown>
IDX_149: .db 00,05 ; <unknown>
IDX_151: .db 00,00 ; <unknown>
IDX_153: .db 00,03 ; <unknown>
IDX_155: .db 03,00 ; <unknown>
IDX_157: .db 00,01 ; <unknown>
IDX_159: .db 00,00 ; <unknown>
IDX_161: .db 00,00 ; <unknown>
IDX_163: .db 00,01 ; <unknown>
IDX_165: .db 00,01 ; <unknown>
IDX_167: .db 00,03 ; <unknown>
IDX_169: .db 00,04 ; <unknown>
IDX_171_18_MAX_CREDITS:    .db 00,00 ; 03,00 - 00 = Free Play
IDX_173: .db 00,01 ; <unknown>
IDX_175: .db 00,01 ; <unknown>
IDX_177: .db 00,04 ; <unknown>
IDX_179: .db 00,01 ; <unknown>
IDX_181: .db 00,02 ; <unknown>
IDX_183: .db 00,04 ; <unknown>
ROM_CMOS_TABLE_END:

When I compile the init_cmos ROM it takes the information from this file and uses it to
initialize the 5101 chip.

Each line basically contains the following elments:

    1) INDEX NUMBERS (IDX_NNN_SETTINGNAME:)

    2) The "New" values (.db x,x)

    3) The "stock" default values (; y,y)

    4) Comments about what the value means.

You might notice that the IDX_NNN numbers increment in twos. This is because the ".db x,x"
contains two bytes.

You might also notice that there are no "gaps" in the table. Even if the New values are zero
they must be included because they are located between the table start and end.


Pincoder Diagnostics Inc. Version 2020.06.23.0506
