tdata Volume 1 Issue #11 © DOWN MEMORY LANE OUR computer will say, "thanks for the good memories" after running this program. YThe program, as written, will quickly test all 4K of a Super Elf and report any failed locations. The comprehensive memory test fits snugly into the 256 bytes of RAM of the onginal Elf (which moves up to locations 9800- 98FF when the original Elf is plugged into the Super Expansion System. After loading the program at locations 9800- 9872, you can enter a long jump at location 0000 (CO 98 00) or you can use a monitor jump to location 9800. If your computer fails the test, what do you do? By depressing the INPUT key twice (once for hi addr. and once for low addr.) you fmd the location or block of memory which has bad memory. The Quest Super Elf Expansion Board uses 2102 static RAM's. The memory of a single 2102 contains 1024locations (computer people call it lK although it is obviously not an even thousand). The 2102 memory chip contains one bit of DATA in each of the lKlocations. You now know which lK block in which the memory failure occurred. If the location after INPUT is pressed twice is revealed to be 013F, you have a memory problem in the first 0000-03FF block (IK). The memory array on the Super Expansion is orga- This block is located in the back or farthest away nized as follows: position as you look at the board with the parallel TOP ROW is OOOo-03FF ports nearest you and the board number and Quest 2nd ROW is 0400-07FF logo so you can read it. If you wanted you could 3rd ROW is OSOo-OBFF replace the 8-2102's with new memory chips, and 4th ROW is OCOO-OFFF the problem would be solved. With memory of the Bit 0 is on the LEFT with Bit 7 on the RIGHT. 2102 type being about $1.00 and everyone wanting You deserve some explanation of the Assembler to save money, we proceed to finding the exact culprit. notations used in the program. One of the products To discover which 2102 has devilishly foiled our on the drawing board at Quest is an Assembler, so otherwise perfect memory we decode the failed bits. that this program will be a good "how to" reference Depressing the INPUT key reveals that the information inside (DATA- DO thru D7) should have been 02 but for you in the future. Since Assemblers yield insight the actual information stored was 00. In other words, into machine language programming, the time to start 0000 0000 should have been 0000 0010. "Ha, ha- thinking about them is at hand. got you!" you exclaim. You then proceed to replace ASSEMBLER EXPLAINED the memory chip U17 (the second from the left in So far we have been "assembling programs by 1K memory bank). You restart the memory program hand," this pr_ocess, given the regularity of the and all the memory checks out OK. Its actually kind COSMAC code and the small size of our programs, is of fun detective work to track down the murdered is not too bad. Probably, however, you have found chip and discover who-done-it. Page 2

yourself wishing thut you hud something the equiva- the program at location 9800 hex. ORG's can be used lent of relutive addressing. The Assembler gives you anytime. One of the really nice things about an the ability to jump to LABELS instead of ubsolute Assembler is that it gives you this freedom of choice. value hex locations. After you construct a program You can represent things in a manner which is con- using the mnemonics. symbols and labels. you make venient, meaningful and easy to use (once you have an Assembler run and out comes hex code and mem- learned its tricks). ory locations. Historically. Assemblers were one of Line number 190 contains the label SUBRET:. The the first higher level languages. They make it easier COLON : is used to the right of the symbol SUBRET for to write, document and maintain to identify that this is a "statement label'" The software. computer notes the location of all labels in its The first thing you notice about the Assembler "symbol table" and notes both the label and the lac. listing is that there are both line numbers and loca- to which it refers. Now when the wants tions. The line numbers are used to reference specific to jumb to the SUBRET location (location 9814). all lines of code, so that a programmer knows exactly that is needed is BR SUBRET. This is exactly what what is happening. An error in line 18 would tell happens in line 201, where the programmer uses this the programmer that perhaps there is something jump to the SUBRET label. Since the computer wrong with the symbol he is using. It is the · same knows the exact hex location ofSUBRET it is possible reuson that books have page numbers - - "please to refer to location 9816 as SUBRET+2. The equate turn to page 53, for today's grammer lesson ," says at line 21 (ADDBUF=#981E) is used by the the English teacher. Assembler's computation ability later on in the "Rule number one is that all comments and program. The computer knows (computers aren't so remarks have two PERIODS .. in front of them," dumb) that ADDBUF= #981 E from line 21. So when says the mystic rites of Assemblers teacher. The two it comes to line 228 and sees ADDBUF+ 1, it goes to periods in front of the remarks is the RCA conven- its table and finds ADDBUF and adds one, thus tion and it makes it easy to draw neat little boxes, so arriving at IF for the lower byte of this address it is an OK rule . The rest of the line after the two (IE+ I= IF). periods is ignored by the Assem bler but the diligent The ASTERISK * in the RCA Assembler is a handy programmer should not ignore putting them in. The device to refer to the location the computer is now rule of thumb is that it is far better to have too many at. For example, when we have wanted to wait for an comments and remarks (they can always be ignored) INPUT button to be pressed we have used 3F 18 (18 than too few. Programmers who ignore this are savegly being the address of the 3F), now we do not even sacrificed upon the alter of GIGO (Garbage In, have to glance at where we are on the location part Garbage Out). Judging from the level of documenta- of the coding sheet. BN4 * will branch back to the tion submitted with your programs to QUESTDATA, start of the two byte BN4 instruction. An ORG*+ you need not fear being sacrificed to the god GIGO. 6 will skip six locations from the point it is found in let's look at line 18. START=#OOOO is called a the program. directive by RCA (probably to avoid calling it a Anything inside a PARENTHESIS ( ) is considered pseudo-op - a word IBM has copyrighted). Anyhow, to be an address by the Assembler. This represents the EQUATE (= sign) directs the Assembler to iden- another kind of constant, an "address constant." An tify the symbol START with 0000. These two become example of this is line 170 in our MEMTST program. twins or two peas in a pod -when the Assembler sees LDI A.1 (ADDBUF) will cause the Assembler to the word START it thinks to itself, "Ah, me put'em frantically scramble for its symbol table (ADDBUF= in 0000, now." The number 0000 prefixed by the"#" #981E), and put the high part of its findings (the A.l sign is a constant and is one of several constants used or 98) into the second half of the F8 load into the D in the program. Here it is a hex constant as indicated part of the load immediate. In the case of, A(ST ART) by the "#"symbol. Register constants have two hex it takes the whole address. Line number 205 loads digits in this program. The stack register is hex 02 0000 into the two bytes starting with 981 E. The (referencing one of the 16 scratchpad registers). comma in front of the ,A(ST ART) is another Assem- All the assignments have been made and the program bler construction. It tells the Assembler to obtain the is ready to begin at line 162. ORG is the RCA directive address, or address part, and insert it directly into the to start assigning locations from that location on with program at that point. the information given on the ORG statement. ORG The MEMTST program, like all programs, uses the MEMTST has been assigned the location value 9800 ENU directive to halt the Assembly process. on line 20. So putting it all together the Assembler Assemblers offer many different ways to declare shorthand is saying, "start assigning locations at loca- data, specify addresses and make the programmer's tion 9800." Without an ORG statement the Assembler life easier. While Assemblers are not difficult, they would assume that you were starting the program at do take some study to understand. Assemblers are 0000 (which is OK if you are starting at 0000). ORG really helpful in putting together MACHINE LAN- #9800 would have been another choice f01: starting. GUAGE with half the effort.

QUESTDAT A COSMAC CLUB P.O. Box 4430, Santa Clara, CA 95054 ( ( (

eeea 1 .• aaa8 THERE UITH THE DESIRED HI ADDRESS OF THE .0 55 .. eeea 2 .. t'EI'I1RY TEST PROGRAM aeaa 56 •• NEI.I QUARTER-K. I'TI eeaa 3 .• Vl eaae 57 -1 eeaa 4 •• 1.8 aaaa 58 .• 2. PROGRAM OPERATION: 0 eaaa 5 .• eaaa 59 )> eaae -1 6 .. TO LOAD AND RUN PROGRAM: eaaa 68 •• ONCE THE PROGRAM IS ENTERED. IT STARTS )> eaaa 7 .• eeee 61 .• LOADING TEST PATTERNS IN BLOCKS AND COMP- ('") eaea 8 .• LOAD PROGRAM AT LOCATION DESIGNATED BY THE eeea 62 •.• ARES MEt1JRY II1'£D I ATEL Y AFTER EACH BLOCK IS 0 eeee SYMBOL "t£HTST". USE SUPER t1JN ITOR OR OTHER Vl 9 .. eeee 63 •• LOADED. ALL VALUES OF 68 THROUGH FF ARE PUT s: eeea tEl .. MEANS TO BRANCH INTO THE PROGRAM AT LOCA- eeea 64 •• INTO EACH CELL OF MEMORY IN THE REGION DE- )> eeea 11 .. TION 0El. **** CAUTION **** DO HOT USE REGS ('") eeee 65 •• SIGNAlED. THE TECHNIQUE USED IS TO START AT oeea 12 •. 2.4.5. OR 6 AS PROGRAM COUNTER WHEH ENTER- Eli'Hla THE TAIL-END OF MEMORY FIRST WITH 09 AHD ('") 66 •• r- eeae 13 .. THIS PROGRAM. 013136 67 •• USE THE HEXT HIGHER COUNT OF THE PATTERN IH c eaa6 14 •. em a a 68 •• THE PRIOR ADDRESS ETC. UNTIL THE DESIGNATED OJ eaaa 15 •• OPERATION OF PROGRAM: eaaa 69 •• BLOCK OF MEtDRY HAS BEEN FILLED. THE RE- eeea 16 .• aeae 76 •• SULTING SET OF PATTERNS IS THEH CHECKED TO ooa6 17 •• 1. PROGRAM PARAMETERS: 66Ela 71 •• DETERMINE IF AHY ERRORS OCCURED IH THE 8f:lEHl 18 START•#El0ElEl eaea 72 •• STORAGE OPERATION. ERRORS FOUND ARE REPORT- ElElElEl 19 STOP•#tlFFF eeae 73 •• ED TO THE USER AS EXPLAINED BELOU. THEH THE oeee 26 t£MTST••98ElEl eeee 74 •• PROGRAM RETURNS TO THE LAST LOCATION OF THE eeea 21 ADDBUF••9BIE aeaa 75 •• BLOCK OF MEtDRY. STORES B1 AND-REPEATS THE eeaa 22 STACK•#98FF eaaa 76 •• STORE AND COMPARE PROCEDURE. THIS RE- l::laea 23 EXADR·•seaa aeea 77 •• PEATS OVER AHD OVER UNTIL FF HAS BEEN STOR- ElElElEl 24 .. aeaa 78 •• ED AHD COMPARED IN THE LAST LOCATION. THEN eeea 25 .. THE START ADDRESS FOR THE PORTION OF MEMORY eeee 79 .; THE PROGRAM LOADS EXRDR IN R8. ASSIGNS RB eeee 26 .. TO BE TESTED IS .DEFINED BY THE PARA. "START" 0aae 86 •• TO X AND SEPS TO RB. 000El 27 .. IT IS LOCATED AT THE ADDRESS DEFINED BY THE 0ae0 81 eeaa 28 •• PARAMETER "ADDBUF". YOU CAH PATCH A HEW ONE aaaa 82 ••• IF AH ERROR !S DETECTED, THE FOLLOUING EJBBEl 29 .. AT ADDBUF+0 AND ADDBUF+I. SIMILARLY. THE aa0a 83 •• PROCEDURE IS FOLLOUED: 0000 3El .. STOP ADDRESS FOR THE MEMORY UNDER TEST IS eeaa 84 •• A.DEPRESS I KEY. THE HI ADDRESS OF THE ElElElB 31 .. DEFINED BY THE PARA. "STOP". YOU CAN PATCH e6ea 85 •• FAILED MEMORY LOCATION IS DISPLAYED OH ElElBB 32 .. A HEW STOP ADDRESS AT ADDBUF+2 AND ADDBUF+3 aaea 86 •• HEX DISPLAY. ElBEl'3 33 .. eaaa 87 •• B.DEPRESS I KEY. THEH THE LO ADDRESS OF THE Eli'IElEl 34 .. THE LOCATION OF THE ADDRESS BUFFER CAN BE eaaa 88 •• FAILED LOCATION IS DISPLAYED. eeea 35 .. TO A DIFFERENT LOCATION IN MEMORY eeee 89 •• C.DEPRESS I KEY. THEN THE CURRENT TEST DATA EJElElB 36 .. BY CHANGING MEHTST+l TO THE NEW HI ADDRESS 0e0a 98 •• C"SHOULP-BE" VALUE> IS DISPLAYED. ., eoea 37 .. AND MEMTST+39CDEC> TO THE NEW LO ADDRESS. aaea 91 •• D.DEPRESS I KEY. THEN THE FAILED VALUE IS 0 eeea 38 .. eeaa 92 •• DISPLAYED. ee0a THE STACK ADDRESS IS DEFINED BY "STACK". A OJ 39 .. aaaa 93 •• A SUBSEQUENT I KEY DEPRESSION UILL RESUME 0 EJElBB 4El .. STACK AREA CAN BE PATCHED IN BY CHANG- oaea 94 •• THE TESTING OF t'£1'11RY. >< ElElEl£1 lNG MEMTST+4 TO THE HEW HI ADDRESS. AHD BY .j:. 41 .. aaaa 95 .j:. eeea CHANGING MEMTST+7 TO THE NEW LO ADDRESS. w 42 .. 0aae 96 •• WHILE THE PROGRAM IS RUHHIHG AHD NO ERRORS 9 Ell'! BEl 43 .. 0fJElEl 97 •• HAVE BEEN DETECTED. THE CURRENT LAST LOCA- Vl eeaa 44 .. THE EXIT ADDRESS CAN BE PATCHED TO A DIFF- aeaa 98 .• TION TEST VALUE IS DISPLAYED. THE IHDICAT- I>J eeaa ERENT CUARTER-K OF MEMORY THAN CURRENTLY ...::::1 45 .. aeea 99 •• IOH OF AH ERROR IS THE STEADY DISPLAY OF EE I>J eeea 46 .. DEFINED BY "EXADR" CBUT NOT TO ANY ADDRESS eeaa lBB •• AND THE GLOWING OF THE Q LED. Q ElElEll3 47 .. ON THE QUARTER-K THAN Elfl) BY CHANGING THE a0ea lB 1 I>J... eeea 48 .. BYTE AT MEMTST+118CDEC>. eeaa 182 .• 3.TERMIHATIOH OF RUH .P' eeaa 49 .. eaaa ('") 183 •• ., )> eeaa sa .. THE PROGRAM IS RELOCATABLE PROVIDED THE TERMINATION OF THE PROGRAM IS INDICATED BY Ol eaea 184 •• cc \D eeae 51 •. START/STOP ADDRESS BUFFER POINTER CR4) IS aaaa lEIS •• A STEADY BEl OH THE HEX DISPLAY. IF VOU THEH CD Vl El13ElEl 0 52 .. PROPERLY HANDLED AS SUGGESTED ABOVE. THE aaaa 186 •• DEPRESS THE I KEY. THE PROGRAM YJLL RETURN w Vl eaaa STACK IS CARED FOR. AND A FURTHER PATCH .j:. 53 .. 0068 187 •• TO THE SUPER 11lN I TOR • aaae 54 •• HADE AT MEMTST+11CDEC)I REPLACE THE DATA aeee 188 0 aaoa 1139 •• REGISTER ASSIGNI'EHTS: 9800 163 •• c aaea 110 •. REG. 9ea0 164 I I I I I I I I I I I I 1 I I I I I I 1 1 1 1 I I I I I I I I I I I I I I I I I I I I I I I I ["1'1 0aao 111 .. e USED FOR EXIT FROM PROGRAM. LOADED UITH Vl 9800 165 •• ""0 -i aaoe 112 •• "EXADR" AHD SEP•D. AS WELL AS SEX•D . C» 0 98€10 166 •• INITIALIZE THE PROGRAM cc );> 00ee 113 EXITR•+E!EI 9ea0 167 •• d) -i 00aa 114 •• I - 98ae 169 ••••• ' •••• • •••••••••••••••••••••• • ••••••••••• •• );> 0ea0 115 •• 2 USED AS STACK POINTER 900e 169 ("") 0 aaa0 116 ST•+EI2 98EIEI F898 170 LDJ A.1 •• SET THE HI ADDRESS Vl oaoa 117 •• 3 - 98EI2 84 171 · PHI ADBPTR • • OF THE START.IS TOP :s: aaaa 118 •• 4 USED FOR POIHTER TO START AND STOP ADD- );> 98EI3 172 • • ADDRESS BUFFER ("") 00EJO 119 •• RESS BUFFER. THE BUFFER ADDRESS IS DES- 9803 173 •• ("") aaea 120 •• IGHATED BY "ADDBUF" 98E!3 F898 174 LD I A. 1 (STACK> • • SET THE STACK r aaoa 121 AD8PTR••EI4 98€15 B2 175 PHI ST •• POINTER c I:Hl8EI al 122 .. 5 USED FOR THE SUBROUTINE 9806 FBFF 176 LDI STACK 0ooa 123 SUB••05 9869 A2 177 PLO ST 0aoa 124 .. 6 PROGRAM COUNTER 9809 E2 178 SEX ST 0D0El 125 PC••El6 980A 179 eeaa 126 •. 7.8 DUAL USE: 98ElA F898 tea LDI A.l(*) •• SET THE HI ADDRESS aooa 127 •• I • HOLDS MAJOR LOOP TEST PATTERN 98ElC 86 181 PHI PC ..OF PROGRAM COUNTER 0808 128 •• 2. PROVIDES MAJOR LOOP CONTROL 98ElD 85 182 PHI SUB •• AHD SUBROUTINE aooa 129 TSTPAT•+EI7 98ElE 183 •• POINTER eooa 130 •• 7.1 USED TO STORE A FAILED VALUE DETECTED 98EIE 184 eooa 131 •• (IF OHE IS FOUHD).THE FORM OF THE DATA 98ElE F815 185 LDI SUBEHT ..SET THE LO ADDRESS aooa 132 •• WILL THEH BE THE XDR OF THE CURRENT 9810 AS 186 PLO SUB ..OF THE SUBROUTINE aaa0 133 •• PATTERH. 9811 187 •. aoa0 134 FALVAL•+07 9811 FB22 188 LDI MAIH •• SET THE LO ADDRESS 00aa 135 •• 8 HOLDS THE CURRENT TEST PATTERN IN EITH- 9813 A6 189 PLO PC •• AHD SEP THE PROG a0ea 136 •• ER THE STORE OR COMPARE LOOPS. 9814 D6 190 SUBRETaSEP PC ..COUNTER < 0aaa 148 •• TEST COMPARE LOOP 981E 202 +>- eaae 149 CMBYCT••E!B 981E 203 •• ADDRESS BUFFER +>- w aae0 tse .• HOTE : REGS A AHD B INITIALLY HOLD IH THE 98 1E 204 _o aaa0 151 .. MAJOR LOOP THE VALUE OF THE HUMBER OF 981E e0aa 205 .A (START> Vl aaae 152 •• BYTES OF THE BLOCK OF I"£MORY UHDER TEST 9820 BFFF 206 . A aaa0 158 •• E - 9822 212 .•••••••••••••••••••••••••••••••••••••••••••••• 1.0 v. aaee 159 .. F - 9822 213 0v. e0ee 160 •• 9822 F8BB 214 MAIHa LDI 8 •• SET THE INITIAL TEST +>- a0ae 161 •• 9824 A7 215 PLO TSTPAT • .PATTERN 9800 162 ORG MEMTST 9825 216 .. ( ( ( ( ( (

9825 217 .••.••••••••••••••••••••••••••••••••••••••••••• 984A 271 .0 9825 218 •• 984A 19 272 IHC I"EI'PTR •• RE-POIHT TEST t£1'1JRY c rn 9825 219 •• MAJOR LOOP 9848 273 •• POIHlER TO LAST LOC- Vl 9825 220 .• 9848 274 •• ATIOH STORED -I 0 9825 221 ..•.••••••••••••••••••••••••••••••••••••••••••• 9848 275 )> 9825 222 •• 984B 276 ••••••••••••••••••••••••••••••••••••••••••••••• -I )> 9825 AB 223 PATST1 PLO CURPAT •• STORE AHD DISPLAY 9848 277 ('"') 9826 52 224 STR ST •• THE CURRENT TEST 9848 278 • • lEST COI'PARE LOOP 0 9827 64 225· OUT 4 •• PATTERN 9848 279 s:Vl 9828 22 226 DEC ST 9848 288 ..•...•...... •••.•••••••••••••••••••••.••••• )> 9829 227 •• 984B 281 ('"') 9829 F81F 228 LDI ADDBUF+l •• COI1'UTE THE HUMBER 9848 89 282 COI'P: GLO CURPAT •• COMPARE MEMORY ('"') 9828 A4 229 PLO ADBPTR • , OF BYTES OF THE TEST 984C F3 283 >< 9842 18 257 INC CURPAT •• ADJUST FOR THE LOGIC 9868 311 *"' 9843 258 .• 9868 312 • • ••••••••••••••••••••• fit •••••••••••••••••••••••• w*"' 9843 259 .•••.••..••••.••••••••••••••••••••••••••••••••• 9868 313 •• .0 260 .. 9868 314 •• J 9843 261 •. TEST PATTERN STORE LOOP 9868 315 .....:::l I>J 9043 262 .• 9868 316 •••..•••••• 0 •••••••••••••••••••••••••••••••••••• ('"') 9843 263 ...... •...... •..•..•....•...... •.... 0 • 986B 19 317 GTEST: INC CURPAT •• SET THE HEXT PATTERH ...i>J 9843 264 •• 9861 19 318 IHC t'EtPTR •• CHECK FOR EHD OF !" 9843 28 265 STOR: DEC CURPAT ..STORE THE CURRENT 9862 2B 319 DEC CHBVCT • • THIS LOOP# IF HOT ""C Ill ('"') 9844 88 266 GLO CURPin •• PATTERK IN THE 9863 9B 32a GHI CMBVCT •• DOHE. DO THE COMPARE (Q )> 267 STXD •• ORV BLOCK UHDER TEST 9864 3A48 321 BHZ COtP CD 1.0 9845 73 U1 Vl 9846 2A 268 DEC STBVCT 9866 322 0 Vl 9847 9A 269 GHI STBVCT 9866 323 •••.•••..•.•.....•••••••••••.••.••••..••••••••• *"' 9849 3A43 276 BHZ STOR 9866 324 Page 6 9866 325 •• Et-I"D OF THE MAJOR LOOP-THROUGH 9866 326 9866 327 ••••••••.•••••••.•.••.••••••••• •••••••••••••••• 9866 328 9866 E2 329 SEX ST •• SET THE NEXT PATTERN 9867 17 338 INC TSTPAT •• AND CHECK FOR COH- 9868 87 331 GLO TSTPAT .. LETION. IF NOT DONE. 9869 3A25 332 BNZ PATST •• START STORING THE 9868 333 , • NEXT PATTERN 9868 334 9868 335 I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I 9868 336 9868 337 •. DONE WITH JOB 9868 338 9868 339 I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I 9868 348,. .. 9868 DS 341 SEP SUB •. DISPLAY THE END IH- 986C AB 342 PLO EXITR •• DICATION AND JUMP TO 986D FBBB 343 LD I A. lCEXADR> •• THE EXIT LOCATION 986F sa 344 PHI EXITR 9870 Ea 345 SEX EXITR 9871 DO 346 SEP EXITR 9872 347" HID

LISTING 9800 FB98 B4FB 9BB2 FBFF A2E2 F898 9685 F815 9810 A5F8 22A6 D652 6422 3Fl8 371A 3014 0000 9820 0FFF F800 A7A8 5264 22F8 1FA4 4452 1484 9830 A9F7 AAAB 2424 2444 5214 0489 77FC 01BA 9840 88E9 1828 8873 2A9A 3A43 1988 F332 6078 9850 87E2 F8EE D599 D589 D588 D597 F3D5 E97A 9868 1819 2898 3A48 E217 873A 25D5 AOFS 8888 9870 El:JD8

SHADES OF GRAY LOC. CODE COMMENTS By Eugene Jackson 0000 90 B 1 82 83 85 86 Exciting visual effects will be yours when you load 06 F81D A6 Pointer for current page and run SHADES OF GRAY. The program displays 09 FB 32 A3 PC 15 pages of RAM memory in slow to rapid succession oc FB 4F A2 STACK (you choose the rate). Thus, if you load a box outline OF F8 15 A1 Video interrupt routine pointer on page F of memory and fill in the box on pages E 12 D3 and D, an interesting effect will result. By experi- 13 72 70 EXIT (VID. INT. Routines) menting with material entered in the COSMAC pages 15 22 78 22 52 ENTRY via the Super Monitor or other means, you can create 19 C4 C4 C4 blinking lights and 3-D effects. By putting the outline 1C FB OF BO Load current pages address of trains, stoplights, cars, etc. on sequential pages in 1F FB 00 AO slightly different positions and places-animation can 22 80 E2 be produced using this program. 24 E2 20 AO E2 20 AD E2 20 AO The speed of the sequence of memory pages dis- 20 3C 22 25 30 13 (Note the DEC of R5) played by the 1861 is determined by keypad entries 32 E2 61 22 Turn on VIDEO while the program is running. Thus if you enter 01 35 90 87 you will get 60 pages per second (each page displayed 37 F8 10 A7 Load page counter (counts down) four times per second!). On the other hand, if you , 3A 6C 64 22 A5 Load timer value enter FF you will get each page displayed steadily for / 3E 85 3A 3E Timer loop five seconds at a whack. You will find it fun to 41 27 87 32 35 experiment with different speeds and objects on the 45 56 30 3A Store current page in Loc. 0010 display pages.

QUESTDAT A COSMAC CLUB P.O. Box 4430, Santa Clara, CA 95054 Page 7

DEFINE AND STORE START/STOP RESET ADDRESSES TEST MEMORY POINTER

DEFINE STARTING TEST GET AND PATTERN COMPARE CURRENT PATTERN

NO DISPLAY CURRENT TEST PATTERN

GET AND DISPLAY: COMPUTE • FAILED ADDRESS NUMBER OF • SHOULD BE & BYTES OF ERROR PATTERN TEST MEMORY

SET ADDRESS POINTER AND NO BYTE COUNTER

SET THE DEFINE TEST PATTERN NEXT FOR THE NEXT PATTERN TEST MEM. LOC.

YES STORE THE NO SET UP PATTERN IN RETURN RETURN THE PRIOR CONDITIONS MEMORY LOC. MEMORY TEST FLOWCHART

QUESTDATA COSMAC CLUB P.O. Box 4430, Santa Clara, CA 95054 Page 8 PUZZLE UNSCRAMBLED

Computer people are problem solvers. How did you fare on THE GREAT 0 0 0 oxo xo x COSMA C COSMOS PUZZLE in 5 2 ... ox o .... xo x xo x QUESTDATA # 10? The solution is 00 0 ox o - oxo as fascinating as the PUZZLE. I There is a symmetry about it - \t8 you can work the PUZZLE o xx xox from either direction. That is, OXX xox 5-8-2-7-5- 9-7-8-2-5 x o x will work the same as its oxo reverse 5- 2- 8- 7- 9-5- 7 '- 2- 8- 5. The dashed line Solution to THE GREAT COSMAC 43 a\}, 1 boxes represent structures COSMOS PUZZLE 0 00 oxx which are similar, an ''S'' By Reed Davis 0 00 oxx fonnation flipped in the ox o xox opposite direction, for _I example. a Li3 f5 .7 t9 000 OOX oxx oxx 0 00 xo o xox 0 00 xox XXX oxx x xo I 4 3 .3 t7 _.9 3 oxo OOX oox 000 ,oo 51 xxo x I' XXX o xo XX>< I XXX oo x xox Qj l I I 1 J. .2 3'1 xox o xo lox XXX OOX _...... _ --1 X0 0 I XXX 0 ( ) X. GfO_J .r 9 f .,.2 rx! 2XT xo x IO O'xl--- xoo oxo xo o o xo The GREAT COSMA C COSMOS r serving of study since th e techniqu e .nJ PUZZL E diagram is de xox 5 X XX x ox 8 _...., can prove useful for oth er problems and programming oxo 0 x: 0 xox situations. Clear diagra ms are an artfonn .. . thanks - OXG xo x X X X go to Reed Davis, progra mming and math student.

QUESTDATA COSMAC CLUB P.O. Box 4430, Santa Clara, CA 95054 COSffiRC BATTLE OF NUffiBER5··· be replaced by long horizontal bars. He who claims I Note: Floyd Oats felt the need to take a break the fortieth spot wins the game. from chess programming (who can blame him), and After starting the game, the first step is to decide the result of his diversion is the following video who goes first. If the player wishes to go first, he puzzle which will run on 256 byte machines. He has enters his claim, hex 0 1 thru hex 04 (depending on used a modified version of the multipurpose Dzombak how many he wishes to claim), on the keyboard or TVT. The lack of documentation describing how the toggles and presses the INPUT button. The number of program works is deliberate. If you knew how the spots claimed will now be replaced by the long bars, brainteaser worked you would know the trick. Of and the computer will immediately display short bars course you could always trace through the code- to show how many it claims. To cause the computer making this a doubly challenging puzzle.] to go first, enter hex FF and press the INPUT button. The computer will display the short bars and await By Floyd L. Oats •your response. The machine will reject numbers This game will run in practically any COSMAC outside the acceptable range. computer, including the 256-byte ELF. It re- The winner of the game is acknowledged on the hex quires exactly one page of memory to run, with the display. If the computer wins, a hex CC will be dis- last eighty bytes reserved for variables and 1/0. The played and the Q-LED will light. If the opponent command code for the game is listed in Table 1, and wins, a hex 55 is displayed and the Q-LED is out. execution should begin at address hex 00 with the P- , Even after you master the game, you can still have Register equal to zero. fun watching your friends try to beat it. People some- The computer will display forty spots at the lower times do funny things in attempts to defeat the com- portion of the screen, arranged as five rows of eight puter. dots per row. The player takes turns with the com- I will leave you with two general rules which might puter in claiming these spots. Each, in his turn, will help you to defeat the computer: (1) A SINGLE claim at least one but not more than four spots. Spots human error will, in ALL cases, result in a computer claimed by the computer will be replaced by short victory. (2) If the human player claims first, the com- horizontal bars and spots claimed by the player will puter has a WON GAME! Good luck!

COSMAC BATTLE OF NUMBERS BY F.L. Oats LOCATION DATA 0000 90 B1 82 83 FS 2E A3 FS 84 A2 FS 10 A1 03 72 70 0010 22 7S 22 52 C4 C4 C4 FS 00 AO FS 00 BO so E2 E2 0020 20 AO E2 20 AO E2 20 AO 3C 10 30 OE 00 00 E2 69 0030 FS A7 AC 90 8F 8C BA FS BO AF FA OS 32 42 FS OS 0040 30 44 FS 00 5F 1F SF 3A 3A AS 2F FS BS AF 7A EC 0050 10 3F 50 37 53 6C F8 FF 32 66 FC 01 33 50 FC 04 0060 38 50 7A oc 30 78 31 4F FS AS AA EA SS F5 33 73 0070 1A 30 6C 3A 7A so FA 03 FC 01 7B A9 31 S2 FS 7E ooso 30 S4 FS 1C 5F 1F SF FA OS 32 S5 1S ss F8 2S 32 0090 99 29 S9 3A 7C 31 4F 30 6S 31 A3 FS 55 EC 5C 64 OOAO 2C 30 A1 FS cc 30 90 00 00 05 OA OF 14 19 1E 23 0080 thru F F reserved for variables and output area • & .e v Q

QUESTDATA COSMAC CLUB P.O. Box 4430, Santa Clara, CA 95054 Page 10 A FREE EDUCATION Listing of Program: 10 PRINT "$1 SLOT MACHINE" ON SLOT MACHINES 20 PRINT "PAYOFF IS $6 FOR" By Patrick E. Taylor 30 PRINT "3 OF A KIND. ALL" The idea and basic tlowpath for SLOT MACHINE 40 PRINT "OTHERS LOSE." came from Radio Shack's Computer Programming in 50 PRINT "NUMBER OF DOLS." BASIC for Everyone (62-2015). Needless to say, 60 PRINT "TO START"; the program underwent a significant rewrite. 70 INPUT M SLOT MACHINE is a Tiny BASIC program in which 80 LET X=RND(345) the player bets $1 and then the Elf randomly selects a 90 PRINT "DO YOU WISH TO" combination of three oranges, lemons or cherries. 92 PRINT "PLAY (1 YES 0 NO)" Three-of-a-kind wins $6, all other combinations lose. 100 INPUT A The Elf keeps track of the money and ends the game 110 IF A=O-THEN GOTO 410 when you lose your last dollar. A sample run would 120 LET C=O look like this : 130 LET L=O RUN 140 LET 0=0 150 LET 1=0 $1 SLOT MACHINE 155 IF 1=3 THEN GOTO 270 PAYOFF IS $6 FOR 160 LETN=RND(3)+1 3 OF A KIND. ALL 170 IF N=1 THEN GOTO 180 OTHERS LOSE. 172 IF N=2 THEN GOTO 210 NUMBER OF DOLS. 174 IF N=3 THEN GOTQ 240 TO START? 10 180 PRINT "*CH*"; DO YOU WISH TO 190 LET C=C+1 PLAY (1 YES 0 NO) 200 GOTO 260 ?1 210 PRINT "*LM*"; *OR**LM**CH* TOO BAD YOU LOST 220 LET L= L+1 230 GOTO 260 240 PRINT "*OR*"; 250 LET 0=0+1 YOU NOW HAVE $9 260 LET I =I +1 DO YOU WISH TO 265 GOTO 155 PLAy (1 YES 0 NO) 270 IF C=3 THEN GOTO 350 ?1 280 IF L=3 THEN GOTO 350 *LM**LM**LM* YOU WON $6 290 IF 0=3 THEN GOTO 350 300 PRINT " l TOO BAD YOU L<;>ST" "-leave 8 spaces YOU NOW HAVE $15 310 LET M=M-1 DO YOU WISH TO 320 PRINT PLAY (1 YES 0 NO) 330 IF M=O THEN GOTO 400 ?0 340 GOTO 380 SORRY ABOUT THAT 350 PRINT " YOU WON $6" OUESTDATA '-.. leave 8 spaces P.O. Box 4430 360 LET M=M+6 Santa Clara, CA 95054 370 PRINT 380 PRINT "YOU NOW HAVE $";M Publisher . . • ...... • Quest Electronics Editor • ...... Bill Haslacher 390 GOTO 90 400 PRINT "NO MORE MONEY" Circulation ...... •. Laurie Buzzell 410 PRINT "SORRY ABOUT THAT" 420 END The contents of this publication are copyright © and shall not be reproduced permission of OUESTOA T A Permission is granted to quote short sections of arttcles when used in reviews of this publication. OUESTDATA welcomes contributions from its readers. Manuscripts will be returned QUESTDA T A COSMAC CLUB only when accompanied by a self·addressed stamped enve· lope. Articles or programs submitted will appear w•th the authors name unless the contributor wtshes otherw•se. Pav· P.O. Box 4430, Santa Clara, CA 95054 ment is at the rate of $15 per published page. OUESTDA T A exists for the purpose of exchanging informatton about the RCA 1802 . Subscriptions are $12 for thts monthly publication. Page 11 ELECTRONIC DICE By Ron Binning This program uses a fast sequential count to simulate the roll of a pair of dice. Maximum length of time LOC. CODE MNEM. ACTION between addition of one to the value of the dice is 0000 90 GHI 0 Initialization about 3 ten-thousandths of a second, so it leaves to 01 81 PH11 chance any roll. 02 F8 LDI Pointer to wk. Load program at location M(OOOO) or use ROM 03 FC area monitor. When using 32 byte ROM monitor, add 04 A1 PLO 1 R(1) points to OOFC starting location to M{l7), M(21) and M(23). 05 F8 LDI Starting value of roll To start your roll, push run (G) button and to stop 06 11 is 11 the roll, push the wait (W) button. 07 51 STR 1 Mem. Joe. FC=11 08 E1 SEX 1 X=1 09 64 OUT4 Show Joe. FC WHAT's THE MYSTERY? OA 21 DEC 1 Restore address R ( 1) Why has Tiny BASIC source code been secret for 08 FO LOX D Reg. =Loc. ff so long? What hints to programmers lurk in the Tiny oc FC ADI ADD 1 to BASIC code? Find out by ordering your very own OD 01 DReg. copy today. The complete source with Assembly OE 51 STR 1 Put result in loc. FC listing is available form QUEST Electronics for $19. OF FO LOX D Reg.= Loc. FF By ordering your copy of the source code you will 10 FE SHL Shift left be able to modify Tiny BASIC code to suit your 11 FE SHL to get rid of individual needs. You will also see how Tom Pittman 12 FE SHL high order digit uses a modified version of RCA's SCRT to write the 13 FE SHL ... (thus 4 SHL) code. QUEST Electronics has had many inquiries 14 F8 XRI Test about the availability of the source code for Tiny 15 70 for 7 BASIC by people who wish to modify or just read 16 3A 8NZ If D'l 0 "-....-· how the compact coding of Tiny was achieved. If 17 08 then GOTO 08 you have been wondering "just what exactly is the 18 FO LOX DReg.= Loc. FF Interpretive Language embedded in the Tiny BASIC 19 FC ADI ADD 11 code?"-you now have a chance to find out. There 1A 11 to adjust are many interesting tricks and routines you can 18 FF SMI Subtract 7 adapt to other purposes. Now is your chance to find 1C 07 to adjust units out exactly what the "mystery" source code is 1D 51 STR 1 Store in Joe. F F all about. 1E FB XRI Test For a peek and poke at the inner workings of Tiny 1F 71 for 71 BASIC and the inventive mind of Tom Pittman, don't 20 32 8Z ifD'I71 pass up this opportunity to buy the Tiny BASIC 21 05 Thenloc.03 SOURCE CODE. 22 30 BR If not 71 23 08 then Joe. 08

------A one year subscription to QUESTDATA, the monthly publication devoted QUESTDATA entirely to the COSMAC 1802 is $12. P.O. Box 4430 (Add $6.00 for airmail postage to all foreign countries except Canada Santa Clara, CA 95054 and Mexico.) Your comments are always welcome and appreciated. We want to be Payment· your 1802's best friend. 0 Check o r Money Order Enclosed Made payable to Quest Electronics NAME 0 Master Charge No. ______0 Bank Americard No. ______ADDRESS 0 Visa Card No. ______Expiration Date;...------: '---../ 1 I Signature ______CITY STATE ZIP I I 0 Renewal 0 New Subscription I ------.• Pag-: 12

Listing of Program: 1 PRINT "NUMBER GUESS" 2 PRINT "PLAYER A VERSUS" NUMBER GUESS 3 PRINT "PLAYER B. TEN" 4 PRINT "POINTS TO THE" By Patrick E. Taylor 5 PRINT "WINNER. PICK A #" NUMBER GUESS is a Tiny BASIC program in 6 PRINT "FROM 1 TO 100" which the Elf picks a random number and then 15 LET F=O players A and B try to guess which number the Elf 16 LET G=O has picked. Ten points are assigned to the player 20 PRINT "PLAYER A"; who's guess is the closest. The Elf keeps track of the 30 INPUT A score. A sample run would look like this: 35 IF A=O THEN GOTO 1000 40 PRINT "PLAYER B"; RUN 50 INPUT B C= AND (100) NUMBER GUESS 60 65 PRINT "ELF PICKED "· PLA YEA A VERSUS ' PRINT C PLA YEA B. TEN 66 LET D=C-A POINTS TO THE 70 LET E=C-8 WINNER. PICK A # 80 IF D*D>E*E THEN GOTO 500 FROM 1 TO 100 90 PJIIINT "PLAYER A WON!" PLAYER A? 25 100 LET F=F+10 PLAYER B? 78 101 GOTO 950 ELF PICKED 83 110 500 PRINT "PLAYER B WON !" PLAYER B WON! 501 LET G=G+10 A=O 8=10 950 PRINT "A="; F LET'S TRY AGAIN 951 PRINT "B="; G PLAYER A? 990 PRINT "LET'S TRY AGAIN" 991 GOTO 20 (and so on . . . ) 1000 END Note: To end the game enter 0 for player A's guess.

QUESTDATA BULK RATE 11 P.O. Box 4430 U.S. ·Postage Paid Santa Clara, CA 95054 OUEST Electronics

ADDRESS CORRECTION REQUESTED Parmh No. 649 Santa Clara. CA