home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / CEXPRESS.ZIP / GRAPHIC.ASM / STRLINEB.ASM < prev    next >
Assembly Source File  |  1989-05-03  |  2KB  |  77 lines

  1. ;void string_line_b(strg,dir,col,row,length,color);
  2. ;  unsigned char  *strg,dir,col,row,length,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 _string_line_b
  10. _string_line_b proc near
  11.     push bp            ;
  12.     mov  bp,sp        ;set stack frame
  13.     push di            ;
  14.     push si            ;
  15.     cmp  _memory_model,0    ;near or far?
  16.     jle  begin        ;jump if near
  17.     inc  bp            ;else add 2 to BP
  18.     inc  bp            ;
  19. begin:    push ds            ;save DS
  20.     mov  bh,_video_page    ;set video page
  21.     cmp  _memory_model,2    ;data near or far?    
  22.     jb   L0            ;jump if near
  23.     lds  si,dword ptr[bp+4] ;DS:SI pts to Strg
  24.     inc  bp            ;add 2 to BP since dword ptr
  25.     inc  bp            ;
  26.     jmp  short L00        ;
  27. L0:    mov  si,[bp+4]        ;
  28. L00:    mov  [bp+4],si        ;move Strg ptr in FAR case
  29.     mov  dl,[bp+8]        ;Col in DL
  30.     dec  dl            ;count from 0
  31.     mov  dh,[bp+10]        ;Row in DH
  32.     dec  dh            ;count from 0
  33.     mov  ah,2        ;function to set cursor
  34.     int  10h        ;set cursor to line
  35.     sub  cx,cx        ;
  36.     mov  cl,[bp+12]        ;string length in DI
  37.     mov  di,cx        ;
  38.     or   di,di        ;test for zero
  39.     jz   L6            ;quit if zero
  40.     mov  bl,[bp+14]        ;attribute in BL
  41.     cmp  byte ptr[si],0    ;test for null string
  42.     je   L6            ;
  43.     mov  cx,1        ;number chars to write in function
  44. L1:    mov  al,[si]        ;get char from Strg
  45.     inc  si            ;forward Strg ptr for next time
  46.     cmp  al,0        ;end of Strg?
  47.     jne  L2            ;jump if not
  48.     mov  si,[bp+4]        ;set ptr back to start
  49.     jmp  short L1        ;restart
  50. L2:    mov  ah,9        ;function to write char
  51.     int  10h        ;write it
  52.     dec  di            ;dec length counter
  53.     or   di,di        ;zero yet?
  54.     jz   L6            ;quit if zero
  55. L3:    mov  ah,[bp+6]        ;get direction param
  56.     cmp  ah,'V'        ;write vertically?
  57.     je   L4            ;jump ahead if so
  58.     cmp  ah,'v'        ;test for small 'v'
  59.     je   L4            ;jump if small 'v'
  60.     inc  dl            ;inc col number
  61.     jmp  short L5        ;jump ahead
  62. L4:    inc  dh            ;inc row number
  63. L5:    mov  ah,2        ;function to set cursor
  64.     int  10h        ;reset cursor
  65.     jmp  short L1        ;go write next
  66. L6:    pop  ds            ;
  67.     pop  si            ;
  68.     pop  di            ;
  69.     pop  bp            ;
  70.     cmp  _memory_model,0    ;quit
  71.     jle  quit        ;
  72.     db   0CBh        ;RET far
  73. quit:    ret            ;RET near
  74. _string_line_b endp
  75. _TEXT    ENDS
  76.     END
  77.