home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / CEXPRESS.ZIP / SCREEN.ASM / WRTVERTB.ASM < prev   
Assembly Source File  |  1989-05-03  |  1KB  |  56 lines

  1. ;void  write_vertical_b(strg,col,row,color);
  2. ;  unsigned char  *strg,col,row,color;
  3.  
  4.     EXTRN  _memory_model:byte
  5.     EXTRN  _video_page:byte
  6.  
  7. _TEXT    SEGMENT BYTE PUBLIC 'CODE'
  8.     ASSUME CS:_TEXT
  9.     PUBLIC _write_vertical_b
  10. _write_vertical_b proc near
  11.     push bp            ;
  12.     mov  bp,sp        ;set stack frame
  13.     push si            ;
  14.     cmp  _memory_model,0    ;near or far?
  15.     jle  begin        ;jump if near
  16.     inc  bp            ;else add 2 to BP
  17.     inc  bp            ;
  18. begin:    push ds            ;save DS too
  19.     mov  bh,_video_page    ;pagenum to BH    
  20.     cmp  _memory_model,2    ;data near or far?
  21.     jb   L0            ;jump if near
  22.     lds  si,dword ptr[bp+4] ;DS:SI pts to Strg
  23.     inc  bp            ;add 2 to BP since dword ptr    
  24.     inc  bp            ;
  25.     jmp  short L00        ;
  26. L0:    mov  si,[bp+4]        ;near case
  27. L00:    mov  bl,[bp+10]        ;attribute in BL
  28.     mov  dh,[bp+8]        ;row in DH
  29.     dec  dh            ;count from 0
  30.     mov  dl,[bp+6]        ;col in DL
  31.     dec  dl            ;count from 0
  32.     sub  ax,ax        ;clear AX
  33.     cmp  byte ptr[si],0    ;test for null stinrg
  34.     je   L2            ;
  35.     mov  cx,1        ;write 1 char each time
  36. L1:    mov  ah,2        ;function to set cursor
  37.     int  10h        ;set the cursor
  38.     mov  ah,9        ;function to write char
  39.     mov  al,[si]        ;move char to al
  40.     inc  si            ;inc string pointer for next time
  41.     cmp  al,0        ;test for end of string
  42.     je   L2            ;
  43.     int  10h        ;write char & attribute
  44.     inc  dh            ;forward row position
  45.     jmp  short L1        ;loop
  46. L2:    pop  ds            ;
  47.     pop  si            ;
  48.     pop  bp            ;
  49.     cmp  _memory_model,0    ;quit
  50.     jle  quit        ;
  51.     db   0CBh        ;RET far
  52. quit:    ret            ;RET near
  53. _write_vertical_b endp
  54. _TEXT    ENDS
  55.     END
  56.