TITLE COUNTRY:

EXTRN WHICH_COUNTRY:BYTE, WHICH_COUNTRY2:BYTE
PUBLIC DISPLAY_COUNTRY

.MODEL SMALL
.DATA

LOCATION DW 1007H

.CODE

DISPLAY_COUNTRY  PROC
;Method: displays country names on player's side of the court
;input: which_country is the counrty player one is. which_player2 is the
;country player2 is. Location is the country name for player one.
;output: country names on each side of the court
;

        CMP WHICH_COUNTRY,1             ;check to see which country player
        JE DISPLAY_USA                  ;one choose
        CMP WHICH_COUNTRY,2
        JE DISPLAY_RUSSIA
        CMP WHICH_COUNTRY,3
        JE DISPLAY_CHINA
        CMP WHICH_COUNTRY,4
        JE DISPLAY_KUWAIT

DISPLAY_USA:
        CALL USA                        ;based upon which country was choosen
        JMP SHOW_COUNTRY2               ;call the coressponding procedure
DISPLAY_RUSSIA:                         ;to display name of country
        CALL RUSSIA
        JMP SHOW_COUNTRY2
DISPLAY_CHINA:
        CALL CHINA
        JMP SHOW_COUNTRY2
DISPLAY_KUWAIT:
        CALL KUWAIT
        
SHOW_COUNTRY2:

        ADD LOCATION,14H                ;move location to player two's side

        CMP WHICH_COUNTRY2,1            ;which country is player two
        JE DISPLAY_USA2
        CMP WHICH_COUNTRY2,2
        JE DISPLAY_RUSSIA2
        CMP WHICH_COUNTRY2,3
        JE DISPLAY_CHINA2
        CMP WHICH_COUNTRY2,4
        JE DISPLAY_KUWAIT2

DISPLAY_USA2:                           ;based on country, call corresponding
        CALL USA                        ;procedure to display name.
        JMP FINISH
DISPLAY_RUSSIA2:
        CALL RUSSIA
        JMP FINISH
DISPLAY_CHINA2:
        CALL CHINA
        JMP FINISH
DISPLAY_KUWAIT2:
        CALL KUWAIT

FINISH:
        SUB LOCATION,14H                        ;return to orginal location

        RET

DISPLAY_COUNTRY ENDP


USA PROC
                                        ;display usa
      PUSH AX                           ;save registers
      PUSH BX
      PUSH DX

      MOV   DX,LOCATION                 ;set position for country
      CALL  SETPOS
      MOV   AL,'U'                      ;set message country:
      CALL  WCHAR                       ;write character
      MOV   AL,'S'
      CALL  WCHAR
      MOV   AL,'A'
      CALL  WCHAR

      POP DX                           ;restore registers
      POP BX
      POP AX
RET

USA ENDP


RUSSIA PROC                             
                                        ;display russia
      PUSH AX                           ;save registers
      PUSH BX
      PUSH DX

      MOV   DX,LOCATION                 ;set position for country
      CALL  SETPOS
      MOV   AL,'R'                      ;set message country
      CALL  WCHAR                       ;write character
      MOV   AL,'U'
      CALL  WCHAR
      MOV   AL,'S'
      CALL  WCHAR
      MOV   AL,'S'
      CALL  WCHAR
      MOV   AL,'I'
      CALL  WCHAR
      MOV   AL,'A'
      CALL  WCHAR

      POP DX                            ;restore register
      POP BX
      POP AX
RET

RUSSIA ENDP


CHINA PROC                              ;display china

      PUSH AX                           ;save registers
      PUSH BX
      PUSH DX

      MOV   DX,LOCATION                 ;set position for country
      CALL  SETPOS
      MOV   AL,'C'                      ;set message country
      CALL  WCHAR                       ;write character
      MOV   AL,'H'
      CALL  WCHAR
      MOV   AL,'I'
      CALL  WCHAR
      MOV   AL,'N'
      CALL  WCHAR
      MOV   AL,'A'
      CALL  WCHAR

      POP DX                            ;restore registers
      POP BX
      POP AX

RET

CHINA ENDP

KUWAIT PROC                     ;display kuwait

      PUSH AX                   ;save registers
      PUSH BX
      PUSH DX

      MOV   DX,LOCATION         ;set position for country
      CALL  SETPOS
      MOV   AL,'K'              ;set message country
      CALL  WCHAR               ;write character
      MOV   AL,'U'
      CALL  WCHAR
      MOV   AL,'W'
      CALL  WCHAR
      MOV   AL,'A'
      CALL  WCHAR
      MOV   AL,'I'
      CALL  WCHAR
      MOV   AL,'T'
      CALL  WCHAR

      POP DX                    ;restore registers
      POP BX
      POP AX

RET

KUWAIT ENDP



WCHAR      PROC
      PUSH  AX             ; save registers
      PUSH  BX
      PUSH  BP
      SUB   BH,BH          ; set page zero
      MOV   AH,14          ; set code for write teletype
      INT   10H            ; write character
      POP   BP             ; restore registers
      POP   BX
      POP   AX
      RET                  ; return to caller
WCHAR      ENDP


SETPOS      PROC
      PUSH  AX            ; save registers
      PUSH  BX
      MOV   BH,0          ; set cursor
      MOV   AH,2
      INT   10H
      POP   BX            ; restore registers
      POP   AX
      RET                 ; return to caller
SETPOS      ENDP

END
