RCA CDP18S711 manual Applying CHIP-8

Page 15

16

RCA COSMAC VIP Instruction Manual

touched any part of a previously displayed pattern. This feature permits programming video games which require knowing if one moving pattern touches or hits another pattern.

Because trying to display two I spots at the same position on the screen results in a 0 spot, you can use the DXYN instruction to erase a previously displayed pattern by displaying it a second time in the same position. (The entire screen can be erased with a single 00E0 instruction.) The following program shows the "8" pattern, shows it again to erase it, and then changes VX and VY coordinates to create a moving pattern:

0200 A210 I=0210

0202 6100 V1=00

0204 6200 V2=00

0206 D125 SHOW 5MI@VlV2

0208 D125 SHOW 5MI@VlV2

020A 7101 V1+01

020C 7201 V2+01

020E 1206 GO 0206

0210 F090

0212 F090

0214 F000

The "8" pattern byte list was moved to 0210 to make room for the other instructions. Try changing the values that VI and V2 are incremented by for different movement speeds and angles. A delay could be inserted between the two DXYN instructions for slower motion.

The FX29 instruction sets I to the RAM address of a five-byte pattern representing the least significant hex digit of VX. If VX =07, then I would be set to the address of a "7" pattern which could then be shown on the screen with a DXYN instruction. N should always be 5 for these built-in hex-digit patterns. Appendix C shows the format for these standard hex patterns. The following program illustrates the use of the FX29 and FX33 instructions:

0200

6300

V3=00

 

0202 A300 I=0300

 

0204

F333

MI=V3

(3DD)

0206

F265

VO:V2=MI

0208

6400

V4=00

 

020A

6500

V5=00

(LSDP)

020C

F029

I =VO

020E

D455

SHOW 5MI@V4V5

0210

7405

V4+05

 

0212

F129

I=Vl(LSDP)

0214

D455

SHOW 5MI@V4V5

0216

7405

V4+05

 

0218 F229 I =V2 (LSDP)

021A D455 SHOW 5MI@V4V5

021C 6603 V6=03

021E F618 TONE=V6

0220 6620 V6=20

0222 F615 TIME=V6

0224 F607 V6=TIME

0226 3600 SKIP;V6 EQ 00

0228 1224 GO 0224

022A 7301 V3+01

022C 00E0 ERASE

022E 1202 GO 0202

This program continuously increments V3, converts it to decimal form, and displays it on the screen.

The FX0A instruction waits for a hex key to he pressed, VX is then set to the value of the pressed key, and program execution continues when the key is released. (If key 3 is pressed, VX=03). A tone is heard while the key is pressed. This instruction is used to wait for keyboard input.

Applying CHIP-8

You should now be able to write some simple CHIP-8 programs of your own. Here are some things to try:

1.Wait for a key to be pressed and show it on the display in decimal form.

2.Show an 8-bit by 8-bit square on the screen and make it move left or right when keys 4 or 6 are held down.

Show an 8-bit square on the screen. Make it move randomly around the screen.

4.Show a single bit and make it move randomly around the screen leaving a trail.

Program a simple number game. Show 100 (decimal) on the screen. Take turns with another player. On each turn you can subtract 1-9 from the number by pressing key 1-9. The first player to reach 000 wins. The game is more interesting if you are only allowed to press a key which is horizontally or vertically adjacent to the last key pressed.

If you are unsure of the operation of any CHIP-8 instruction, just write a short program using it. This step should clear up any questions regarding its operation. In your CHIP-8 programs be careful not to write into memory locations 0000-01FF or you will

Image 15
Contents Page VIP-311 RCA COSMAC VIP CDP18S711 Instruction ManualACKNOWLEDGMENT Contents Contents Continued What This Manual Covers 1. Getting StartedThe Power Supply What You See Turning It On1. Getting Started Using the Operating System 11.COSMAC VIP OperationMemory Write Memory Read Tape WriteTape Read 11.COSMAC VIP Operation Testing Your Cassette SystemHow to Change and Use the Variables III.CHIP-8Language ProgrammingBranch Instructions Using the Display Instructions 020C F090 020E F000 III. CHIP-8 Language Programming0200 A20A I=020A 0202 6100 V1=00 0204 6200 V2=00 0206 D125 SHOW 5MI@VlV2 0208 1208 GO 020A F090Applying CHIP-8 111. CHIP-8Language Programming Some Program Ideas25.PROGRAMMED SPOT - Introduce children to programming concepts by letting them preprogram the movements of a spot or object on the screen VIP Machine Coding IV. Machine Language ProgrammingMachine Language Programming Summed Up V. Logic Description How Memory Is AddressedHow the Input/Output Works pressed. A 62 machine instruction causes the least significant 4 bits of memory byte to be latched into U13. These 4 bits are decoded to bring one of the 16 U13 output lines low. If the key that corresponds to this output line is pressed, the CDPI802 EF3 input will go low. The 4-bitcodes latched into U13 correspond to the equivalent key positions. After the program send8 a 4-bitcode to U13, it subsequently examines the EF3 line to see if the key corresponding to this code is pressed or not. In this manner, a program can determine when any specific key is pressed or can sequentially scan all keys while waiting for any one to be pressed. Key debounce delays must be provided in the program when required. A program can also cause a speaker tone to occur when a key is pressed. Only one key at a time should be pressed with this method of interfacing the keyboard V1. Expansion Considerations and Connections Using the Byte Input/OutputUsing the Expansion Interface Some Expansion IdeasI RCA COSMAC VIP Instruction Manual Pin Signal V1. Expansion Considerations and ConnectionsTable III - External Option Terminal Connections 2.Composing poetry or pictures with printer output No Sound VIL Troubleshooting HintsOther Problems Signal TracingLast Resorts Appendix A - Test and Operating Data Byte Pattern for Displaying COSMACBeeper Program Cassette Attachment Diagram Cassette Phase Test SignalsTest Program Cassette Data Test Memory Test Program Cassette Recording GuidelinesOperating System Listing Appendix B - Operating SystemOperating System Register Table Operating System SummaryR3 = Machine Language Subroutine Program Counter CHIP-8Interpreter Listing Appendix C - CHIP-8InterpreterCHIP-8Memory Map CDP1802 Register Use for CHIP-8Interpreter Appendix C - CHIP-8Interpreter RCA COSMAC VIP Instruction Manual CHIP-8User NotesPage 1. VIP Kaleidoscope 2. VIP Video Display Drawing Game Circuits Appendix E - Logic DiagramsFig. E-5Power Supply Circuit and Byte Fig. E-1Microprocessor and Display InterfacePage Appendix E - Logic Diagrams Fig. E-2- ROM Circuits and Expansion InterfacePage Appendix E - Logic Diagrams Fig. E-4- RAM CircuitsRCA COSMAC VIP Instruction Manuel RCA COSMAC VIP Instruction Manual 1.Printed Circuit Board Layout Board Layout, Parts List, and Expansion NotesAppendix F 2.Parts List for RCA COSMAC VIP CDP18S711RCA COSMAC VIP Instruction Manual Page 2. Parts List for RCA COSMAC VIP CDP18S711 Page Resistors - Supplied 1 /4 W except as noted RCA COSMAC VIP Instruction ManualPage 3. COSMAC VIP Expansion Notes