;; Emacs Mode Selection Info: -*-mode: ASM; coding: iso-latin-1-dos;-*- * ;; ******************************************************************************************** ;; File Name: DisN2H.inc ;; Auther: John L. Weinrich ;; Date: 01/31/03 ;; Useage 4004 TIC-TAC-TOE Game ;; Description: ;; ;; This file is an include file containing the display Nibble to Hex routine. ;; ;; See "4004 FPGA Design" and "4004 Software Design " documents for more detail information. ;; ;; Registers used: SCRATCH_0_L, SCRATCH_1_L, SCRATCH_1_H, SCRATCH_1_P ;; Memory used: None. ;; Entrance parameters: SCRATCH_0_L (nibble to display) ;; Exit parameters: Accumulator (success, failure) ;; Labels used: DisNibble2Hex, DisTheData ;; External routines used: DisplayModeCMND, DisplayModeData, DisplayModeData ;; ******************************************************************************************** ;; ******************************************************************************************** ;; This routine displays a binary number (nibble) as a hexidecimal number ;; DisNibble2Hex xch SCRATCH_0_L ; Store the nibble fim SCRATCH_1_P,'0' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 00H ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'1' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 01H ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'2' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 02H ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'3' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 03H ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'4' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 04H ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'5' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 05H ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'6' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 06H ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'7' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 07H ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'8' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 08H ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'9' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 09H ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'A' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 0AH ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'B' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 0BH ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'C' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 0CH ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'D' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 0DH ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'E' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 0EH ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display fim SCRATCH_1_P,'F' ; Get the character to display clb ; Make sure that the accumulator is cleared ldm 0FH ; Get data to compare to sub SCRATCH_0_L ; Subtract the two jcn Z,DisTheData ; If zero, they are the same, then go display DisTheData jms DisplayModeCMND ; Set display to command mode jms WaitForDisplay ; Wait for display jms DisplayModeData ; Set display to data mode ld SCRATCH_1_H ; Get high nibble to display 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 SCRATCH_1_L ; Get low nibble to display 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 bbl REPORT_SUCCESS ; All done, return