POINT AX,"C" ; 3rd letter of the alphabet
FETCH BX,AX
; now BX contains the character id for "C"
MOV AX,BX
OUTPUT
; this will output the character id for "C" (67)
OUTPUT CHARACTER
; this will output "C"
SUB AX,64
OUTPUT
; this will output 3
; repeat this for "G" (7th letter of alphabet)
; yields 7
; hence, SUB AX,64 converts upper case to ordinal
POINT AX,"c"
FETCH BX,AX
; now BX contains the character id for "c"
MOV AX,BX
OUTPUT
; this will output the character id for "c" (99)
OUTPUT CHARACTER
; this will output "c"
SUB AX,96
OUTPUT
; this will output 3
; repeat this for "g" (7th letter of alphabet)
; yields 7
; hence, SUB AX,96 converts lower case to ordinal
MOV BX,"C"
FETCH AX,BX
SUB AX,64
ADD AX,96
OUTPUT CHARACTER
; this will output "c"
; by simple arithmetic, we find ADD AX,32 converts upper case to lower case
; it also follows that SUB AX,32 converts lower case to upper case
; this only works because character id's, unlike text id's, are
; garunteed to always be the same for the same characters