;Copyright 2000 - Mark McDonald All rights reserved
; DECLARE: FUNCTION ucaseint(BYVAL integer) AS INTEGER
; DESC:    Convert a character byte from lower case to upper case.  Works
;          with international characters as well.
; EXAMP:   NewChar = ucaseint(OldChar)

MCODE Segment Byte
        Assume  CS: MCODE

; Table of international characters
Intrnl  DB      '', '', 'A', '', 'A', '', '', 'E', 'E', 'E'
        DB      'I', 'I', 'I', '', '', '', '', '', 'O', ''
        DB      'O', 'U', 'U', 'Y', '', '', '', '', '', ''
        DB      '', 'A', 'I', 'O', 'U', '', '', 'A', 'O'

        Public  ucaseint

ucaseint Proc Far

arg     Char:   WORD = Retbytes

        push    BP                      ;
        mov     BP, SP                  ;
        push    BX                      ;

        mov     AX, Char                ; put charactor in AX
        or      AH, AH                  ; is AH clear?
        jnz     Exit                    ; no, exit
        cmp     AL,'a'                  ; is char less than "a"?
        jb      Exit                    ; yes, exit
        cmp     AL,167                  ; is char greater than 167?
        JA      Exit                    ; yes, exit
        cmp     AL,'z'                  ; is it greater than "z"?
        ja      International           ; yes, check international chars
        sub     AL,32                   ; Convert to uppercase
        jmp     Short Exit              ;
International:
        cmp     AL,129                  ; is it less than 129?
        jb      Exit                    ; yes, exit
        sub     AL,129                  ; make it base 0
        mov     BX,OFFSET Intrnl        ; put offset of table into BX
        xlat    CS: [BX]                ; get proper upper case char
Exit:
        pop     BX                      ;
        pop     BP                      ;
        retf    Retbytes                ;
ucaseint EndP
MCODE EndS
        End