;96 byts (8086)

org 100h
start:
         ;mov       ax,0003h
         ;int       10h

         mov       ax,3509h
         int       21h
         push      es
         push      bx

      	 ;mov       cx,(80h+1)*2
	 xchg 	   ax,cx
;	 dec 	   cx
paint:   mov       al,cl
;         call      print
         call      nprint
         dec       cx
         jns       paint
;         loop      paint

         mov       ax,2509h
         mov       dx,newvect
         int       21h

waitesc: cmp       byte [es:di+1],30h
;         cmp       byte [es:di+1-10],30h
         je        waitesc 

         pop       dx
         pop       ds  
         int       21h
;         ret

iprint:  mov       ah,1fh
nprint:  shl       al,1
;         mov       ah,1fh
         jnc       print
         mov       ah,31h
print:   cld
         mov       di,0b800h
         mov       es,di
         mov       di,ax
         push      cx
         mov       cl,5
         mul       cl
         xchg      ax,di
printnum:ror       al,cl
         push      ax
         and       al,0fh
;         add       al,90h
         daa
         add       al,-10h
         adc       al,40h
;         daa
         stosw
         pop       ax
;         dec       cl
         dec       cx                  ; ! parita from 8 bits
         jnp       printnum
         pop       cx
         mov       ax,3000h+'h'
         stosw
         mov       al,' '              ; ! 20h
         stosw
         stosw
         ret

newvect: push      ax
         in        al,60h
         push      es
         push      di   
         call      iprint
         pop       di
         pop       es
   ;      mov       al,20h 
         out       20h,al
         pop       ax
         iret
