;
;CHAMODE - Program to change screen modes
;
key_in   equ  1h
pstring  equ  9h
doscall  equ  21h

rom_da   segment at 40h
         org 10h
eq_flag  dw  ?
rom_da   ends
;**************************
codeseg  segment
         assume cs:codeseg
         assume ds:codeseg
         org  100h
start:
         mov  dx,offset mess
         mov  ah,pstring
         mov  ds,ax

         mov  ah,key_in
         int  doscall
         cmp  al,'m'
         je   mono
         cmp  al,'h'
         je   hi_res
         cmp  al,'c'
         je   color
         jmp  start
mono:
         mov  ax,eq_flag
         and  ax,11001111b
         or   ax,00110000b
         mov  eq_flag,ax

         mov  al,2
         mov  ah,0
         int  10h
         jmp  exit
hi_res:
         mov  ax,eq_flag
         and  ax,11001111b
         or   ax,00100000b
         mov  eq_flag,ax
         mov  al,6
         mov  ah,0
         int  10h
         jmp  exit
color:
         mov  ax,eq_flag
         and  ax,11001111b
         or   ax,00100000b
         mov  eq_flag,ax

         mov  al,4
         mov  ah,0
         int  10h
         jmp  exit

exit:
         mov  ax,04C00h
         int  21h

mess     db   13,10
         db   'Type "m" for mono',13,10
         db   'Type "h" for 640x200',13,10
         db   'Type "c" for 320x200 color',13,10
         db   'What''s your poison? $'
codeseg  ends
         end  start
