;; Emacs Mode Selection Info: -*-mode: ASM; coding: iso-latin-1-dos;-*- * ;; ******************************************************************************************** ;; File Name: DisPlayerName.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. ;; ;; ;; See "4004 FPGA Design" and "4004 Software Design " documents for more detail information. ;; ;; Registers used: UTILITY_0_L, UTILITY_0_H, UTILITY_0_P, UTILITY_1_L, UTILITY_1_H, ;; UTILITY_1_P, UTILITY_2_L, UTILITY_2_H ;; Memory used: PLAYER_1_RAM, PLAYER_2_RAM ;; Entrance parameters: None. ;; Exit parameters: Accumulator, success, failure ;; Labels used: Player1Name, Player2Name, Player, NextChar, NoRollover, NotEnd, ;; NoRollover1 ;; ******************************************************************************************** ;; Display players names ;; Select player #1 RAM space Player1Name fim UTILITY_0_P,PLAYER_1_RAM ; Get address of player #1 RAM space jun Player ; Go to Player ;; Select player #2 RAM space Player2Name fim UTILITY_0_P,PLAYER_2_RAM ; Get address of player #2 RAM space Player ldm RAM_BANK_0 ; Move RAM bank pointer to ACC dcl ; Select RAM bank ;; Preset charactor counter fim UTILITY_1_P, 00001h ; Load charactor counter ;; Get RAM charactor NextChar src UTILITY_0_P ; Send out RAM charactor pointer rdm ; get lower nibble of charactor xch UTILITY_2_L ; Put lower nibble of RAM charactor in UTILITY_2 isz UTILITY_0_L,NoRollover ; Increment lower RAM charactor pointer inc UTILITY_0_H ; Increment upper RAM pointer NoRollover src UTILITY_0_P ; Send out RAM charactor pointer rdm ; get upper nibble of charactor xch UTILITY_2_H ; Put upper nibble of RAM charactor in UTILITY_2 ;; Check RAM charactor for end of string clb ; Clear out accumulator ld UTILITY_2_L ; Get lower nibble of RAM charactor jcn NZ,NotEnd ; Check if zero clb ; Clear out accumulator ld UTILITY_2_H ; Get upper nibble of RAM charactor jcn NZ,NotEnd ; Also check if it is zero ;; End of string, return bbl REPORT_SUCCESS ; Both upper and lower zero, exit ;; Not end of string, send to display NotEnd ld UTILITY_2_L ; Not end of string, get lower nibble of RAM charactor fim SRC_P,DISPLAY_HIGH_PORT ; Get address to display upper nibble port src SRC_P ; Send out display upper nibble address wrr ; Write the display upper nibble to display ld UTILITY_2_H ; Get upper nibble of RAM charactor fim SRC_P,DISPLAY_LOW_PORT ; Get address to display lower nibble port src SRC_P ; Send out display lower nibble address wrr ; Write the display lower nibble to display ;; Increment RAM charactor pointer isz UTILITY_0_L,NoRollover1 ; Increment lower RAM charactor pointer inc UTILITY_0_H ; Increment upper RAM pointer ;; Increment charactor counter and check if max charactor is reached NoRollover1 isz UTILITY_1_L,NextChar ; Check is max charactors are displayed ;; Max charactor reached, return bbl REPORT_SUCCESS ; Max charactors displayed, exit