;; Emacs Mode Selection Info: -*-mode: ASM; coding: iso-latin-1-dos;-*- * ;; ******************************************************************************************** ;; File Name: DisDataP5.inc ;; Auther: John L. Weinrich ;; Date: 04/17/03 ;; Useage 4004 TIC-TAC-TOE Game ;; Description: ;; ;; This is an include file that contains the display data routine. ;; ;; ;; See "4004 FPGA Design" and "4004 Software Design " documents for more detail information. ;; ;; Registers used: ARRAY_PTR_P, UTILITY_1_P, SCRATCH_1_L, SCRATCH_1_H, SCRATCH_1_P ;; Memory used: None. ;; Entrance parameters: None. ;; Exit parameters: Accumulator, success, failure ;; Labels used: ClearBoard, ClearName, DisTurn, DisPageError, DisX1, DisX2, DisX3, DisX4, ;; DisX5, DisX6, DisX1_6, DisX7, DisX8, DisX9, DisX7_9, DisO1, DisO2, DisO3, DisO4, ;; DisO5, DisO6, DisO1_6, DisO7, DisO8, DisO9, DisO7_9, DisHorLine, DisVertLine, ;; DisVertHorLine, DisX, DisO, DisXHor, DisOHor, DisBlank, DisGB1, DisGB2, DisGB2, ;; DisGBN1, DisGBN2, DisGBN3, DisGBMSG1, DisGBMSG2, DisString4, Continue4, ;; LowerEOS4, NotEOS4, NoRollover4, EndOfString4, D_HorLine, D_VertHorLine, ;; D_VertLine, D_OHor, D_X, D_O, D_XHor, D_Blank, D_GB1, D_GB2, D_GB3, D_GBN1, ;; D_GBN2, D_GBN3, D_GBMSG1, D_GBMSG2, D_Turn, D_CLR_Board, D_CLR_Name, D_PageError ;; Routines used: DisSetLineCol, DisplayModeCMND, DisplayModeData, WaitForDisplay ;; ******************************************************************************************** ;; ******************************************************************************************** ;; This subroutine displays canned strings ;; ClearBoard fim ARRAY_PTR_P,lo(D_CLR_Board) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string ClearName fim ARRAY_PTR_P,lo(D_CLR_Name) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisTurn fim UTILITY_1_P,L3C1 ; Set the display to line 3 & column 1 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_Turn) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisPageError fim UTILITY_1_P,L1C1 ; Set the display to line 1 & column 1 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_PageError) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisX1 fim UTILITY_1_P,L1C16 ; Set the display to line 3 & column 16 jun DisX1_6 ; Go to routine to display the string DisX2 fim UTILITY_1_P,L1C18 ; Set the display to line 3 & column 16 jun DisX1_6 ; Go to routine to display the string DisX3 fim UTILITY_1_P,L1C20 ; Set the display to line 3 & column 16 jun DisX1_6 ; Go to routine to display the string DisX4 fim UTILITY_1_P,L2C16 ; Set the display to line 3 & column 16 jun DisX1_6 ; Go to routine to display the string DisX5 fim UTILITY_1_P,L2C18 ; Set the display to line 3 & column 16 jun DisX1_6 ; Go to routine to display the string DisX6 fim UTILITY_1_P,L2C20 ; Set the display to line 3 & column 16 DisX1_6 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_XHor) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisX7 fim UTILITY_1_P,L3C16 ; Set the display to line 3 & column 16 jun DisX7_9 ; Go to routine to display the string DisX8 fim UTILITY_1_P,L3C18 ; Set the display to line 3 & column 16 jun DisX7_9 ; Go to routine to display the string DisX9 fim UTILITY_1_P,L3C20 ; Set the display to line 3 & column 16 DisX7_9 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_X) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisO1 fim UTILITY_1_P,L1C16 ; Set the display to line 3 & column 16 jun DisO1_6 ; Go to routine to display the string DisO2 fim UTILITY_1_P,L1C18 ; Set the display to line 3 & column 16 jun DisO1_6 ; Go to routine to display the string DisO3 fim UTILITY_1_P,L1C20 ; Set the display to line 3 & column 16 jun DisO1_6 ; Go to routine to display the string DisO4 fim UTILITY_1_P,L2C16 ; Set the display to line 3 & column 16 jun DisO1_6 ; Go to routine to display the string DisO5 fim UTILITY_1_P,L2C18 ; Set the display to line 3 & column 16 jun DisO1_6 ; Go to routine to display the string DisO6 fim UTILITY_1_P,L2C20 ; Set the display to line 3 & column 16 DisO1_6 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_OHor) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisO7 fim UTILITY_1_P,L3C16 ; Set the display to line 3 & column 16 jun DisO7_9 ; Go to routine to display the string DisO8 fim UTILITY_1_P,L3C18 ; Set the display to line 3 & column 16 jun DisO7_9 ; Go to routine to display the string DisO9 fim UTILITY_1_P,L3C20 ; Set the display to line 3 & column 16 DisO7_9 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_O) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisHorLine jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_HorLine) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisVertLine jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_VertLine) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisVertHorLine jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_VertHorLine) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisX jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_X) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisO jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_O) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisXHor jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_XHor) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisOHor jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_OHor) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisBlank jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_Blank) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisGB1 fim UTILITY_1_P,L1C16 ; Set the display to line 1 & column 16 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_GB1) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisGB2 fim UTILITY_1_P,L2C16 ; Set the display to line 2 & column 16 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_GB2) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisGB3 fim UTILITY_1_P,L3C16 ; Set the display to line 2 & column 16 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_GB3) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisGBN1 fim UTILITY_1_P,L1C12 ; Set the display to line 2 & column 16 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_GBN1) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisGBN2 fim UTILITY_1_P,L2C12 ; Set the display to line 2 & column 16 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_GBN2) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisGBN3 fim UTILITY_1_P,L3C12 ; Set the display to line 2 & column 16 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_GBN3) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisGBMSG1 fim UTILITY_1_P,L1C1 ; Set the display to line 2 & column 16 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_GBMSG1) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string DisGBMSG2 fim UTILITY_1_P,L2C1 ; Set the display to line 2 & column 16 jms DisSetLineCol ; Call the routine to set the display cursor fim ARRAY_PTR_P,lo(D_GBMSG2) ; Get pinter to the string to be displayed jun DisString4 ; Go to routine to display the string org DISDATA_LOCATION + 0100H ; Start the routine & data on a page boundary DisString4 jms DisplayModeCMND jms WaitForDisplay ; Wait for display jms DisplayModeData ; Set display to data mode Continue4 fin SCRATCH_1_P ; Get a byte of the string clb ldm 0Fh ; Load delimiter charactor lower nibble sub SCRATCH_1_L ; Get the lower nibble into accumulator jcn Z,LowerEOS4 ; Check if lower nibble is zero jun NotEOS4 ; Lower nibble not zero, then display it LowerEOS4 clb ldm 0Fh ; Load delimiter charactor upper nibble sub SCRATCH_1_H ; Lower nibble is zero, now check upper nibble jcn Z,EndOfString4 ; Upper nibble zero, go to return NotEOS4 fin SCRATCH_1_P ; Upper nibble not zero, get byte again xch SCRATCH_1_H ; Get the upper nibble into accumulator 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 xch SCRATCH_1_L ; Get the lower nibble into accumulator 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 isz ARRAY_PTR_L,NoRollover4 ; Increment string pointer & check for roll over inc ARRAY_PTR_H ; String pointer rolled over, increment upper nibble NoRollover4 jun DisString4 ; Continue to out more bytes to display EndOfString4 bbl REPORT_SUCCESS ; All done, go back D_HorLine data 00h,0FFh ; Display horizontal line D_VertHorLine data 01h,0FFh ; Display horizontal and vertical line D_VertLine data 02h,0FFh ; Display vertical line D_OHor data 03h,0FFh ; Display O w/vertical line D_X data 04h,0FFh ; Display X D_O data 05h,0FFh ; Display O D_XHor data 06h,0FFh ; Display X w/horizontal line D_Blank data 07h,0FFh ; Display blank D_GB1 data 00h,01h,00h,01h,00h,0FFh ; Display game board line #1 D_GB2 data 00h,01h,00h,01h,00h,0FFh ; Display game board line #2 D_GB3 data 07h,02h,07h,02h,07h,0FFh ; Display game board line #3 D_GBN1 data "1","2","3",0FFh ; Display game board numbering line #1 D_GBN2 data "4","5","6",0FFh ; Display game board numbering line #2 D_GBN3 data "7","8","9",0FFh ; Display game board numbering line #3 D_GBMSG1 data "Use 1-9",0FFh ; Display game board instruction line #1 D_GBMSG2 data "to select.",0FFh ; Display game board instruction line #2 D_Turn data "Your turn, ",0FFh ; Display player turn D_CLR_Board data " ",0FFh ; Clear player turn name D_CLR_Name data " ",0FFh ; Clear board D_PageError data "PAGE ERROR!!!",0FFh ; Display page error