;; Emacs Mode Selection Info: -*-mode: ASM; coding: iso-latin-1-dos;-*- * ;; ******************************************************************************************** ;; File Name: BoardTest.inc ;; Auther: John L. Weinrich ;; Date: 01/31/03 ;; Useage 4004 TIC-TAC-TOE Game ;; Description: ;; ;; This routine is used for the 4004 TIC-TAC-TOE Game. ;; ;; Assumptions: ;; This assembly code and all the included files assume the following: ;; ;; RAM Memory: 2048 X 4 (8 RAM banks, 4 RAMs/bank, 4 registers/RAM, 16 Char/Reg) ;; 256 status characters. ;; 2 I/O Port ;; RAM1: SPEAKER PITCH/write ;; RAM2: SPEAKER LEVEL/write ;; ;; ROM Memory: 4096 X 8 (16 ROMs @ 256 locations ;; 11 I/O Ports (3 - R/W, 4- Read, 4 - Write) ;; ROM0: MISC/read ;; ROM0: MISC/write ;; ROM3: DISPLAY HIGH IN/read ;; ROM3: DISPLAY HIGH OUT/write ;; ROM4: DISPLAY LOW IN/read ;; ROM4: DISPLAY LOW OUT/write ;; ROM5: KEYBOARD HIGH INPUT/read ;; ROM6: KEYBOARD LOW INPUT/read ;; ROM7: MISC2/write ;; ROM8: PAGE/write ;; ROM9: RANDOM NUMBER GENERATOR/read ;; ROM10: FPGA VERSION/read ;; ;; See "4004 FPGA Design" and "4004 Software Design " documents for more detail information. ;; ;; Registers used: ;; Memory used: ;; Entrance parameters: ;; Exit parameters: ;; Labels used: ;; ******************************************************************************************** ;; Board checking routines ;; Returns a true/false in accumulator Check1X fim SRC_P,POS1_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_X_CHAR ; Get the X charactor sbm ; Test is game board position is an X jcn Z,Yes1X ; If X, return with true bbl FALSE ; Return false Yes1X bbl TRUE ; Return true Check2X fim SRC_P,POS2_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_X_CHAR ; Get the X charactor sbm ; Test is game board position is an X jcn Z,Yes2X ; If X, return with true bbl FALSE ; Return false Yes2X bbl TRUE ; Return true Check3X fim SRC_P,POS3_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_X_CHAR ; Get the X charactor sbm ; Test is game board position is an X jcn Z,Yes3X ; If X, return with true bbl FALSE ; Return false Yes3X bbl TRUE ; Return true Check4X fim SRC_P,POS4_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_X_CHAR ; Get the X charactor sbm ; Test is game board position is an X jcn Z,Yes4X ; If X, return with true bbl FALSE ; Return false Yes4X bbl TRUE ; Return true Check5X fim SRC_P,POS5_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_X_CHAR ; Get the X charactor sbm ; Test is game board position is an X jcn Z,Yes5X ; If X, return with true bbl FALSE ; Return false Yes5X bbl TRUE ; Return true Check6X fim SRC_P,POS6_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_X_CHAR ; Get the X charactor sbm ; Test is game board position is an X jcn Z,Yes6X ; If X, return with true bbl FALSE ; Return false Yes6X bbl TRUE ; Return true Check7X fim SRC_P,POS7_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_X_CHAR ; Get the X charactor sbm ; Test is game board position is an X jcn Z,Yes7X ; If X, return with true bbl FALSE ; Return false Yes7X bbl TRUE ; Return true Check8X fim SRC_P,POS8_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_X_CHAR ; Get the X charactor sbm ; Test is game board position is an X jcn Z,Yes8X ; If X, return with true bbl FALSE ; Return false Yes8X bbl TRUE ; Return true Check9X fim SRC_P,POS9_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_X_CHAR ; Get the X charactor sbm ; Test is game board position is an X jcn Z,Yes9X ; If X, return with true bbl FALSE ; Return false Yes9X bbl TRUE ; Return true Check1O fim SRC_P,POS1_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_O_CHAR ; Get the O charactor sbm ; Test is game board position is an O jcn Z,Yes1O ; If O, return with true bbl FALSE ; Return false Yes1O bbl TRUE ; Return true Check2O fim SRC_P,POS2_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_O_CHAR ; Get the O charactor sbm ; Test is game board position is an O jcn Z,Yes2O ; If O, return with true bbl FALSE ; Return false Yes2O bbl TRUE ; Return true Check3O fim SRC_P,POS3_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_O_CHAR ; Get the O charactor sbm ; Test is game board position is an O jcn Z,Yes3O ; If O, return with true bbl FALSE ; Return false Yes3O bbl TRUE ; Return true Check4O fim SRC_P,POS4_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_O_CHAR ; Get the O charactor sbm ; Test is game board position is an O jcn Z,Yes4O ; If O, return with true bbl FALSE ; Return false Yes4O bbl TRUE ; Return true Check5O fim SRC_P,POS5_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_O_CHAR ; Get the O charactor sbm ; Test is game board position is an O jcn Z,Yes5O ; If O, return with true bbl FALSE ; Return false Yes5O bbl TRUE ; Return true Check6O fim SRC_P,POS6_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_O_CHAR ; Get the O charactor sbm ; Test is game board position is an O jcn Z,Yes6O ; If O, return with true bbl FALSE ; Return false Yes6O bbl TRUE ; Return true Check7O fim SRC_P,POS7_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_O_CHAR ; Get the O charactor sbm ; Test is game board position is an O jcn Z,Yes7O ; If O, return with true bbl FALSE ; Return false Yes7O bbl TRUE ; Return true Check8O fim SRC_P,POS8_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_O_CHAR ; Get the O charactor sbm ; Test is game board position is an O jcn Z,Yes8O ; If O, return with true bbl FALSE ; Return false Yes8O bbl TRUE ; Return true Check9O fim SRC_P,POS9_RAM ; Select RAM game board position src SRC_P ; Send out RAM charactor selection clb ; Make sure accumulator is clear ldm PLAYER_O_CHAR ; Get the O charactor sbm ; Test is game board position is an O jcn Z,Yes9O ; If O, return with true bbl FALSE ; Return false Yes9O bbl TRUE ; Return true