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

  1. ;void  vertical_line_b(vrt_char,top_col,top_row,depth);
  2. ;  unsigned char  vrt_char,top_col,top_row,depth;
  3.  
  4.     EXTRN  _memory_model:byte
  5.     EXTRN  _video_page:byte
  6.  
  7. _TEXT    SEGMENT  BYTE PUBLIC 'CODE'
  8.     ASSUME CS:_TEXT
  9.     PUBLIC _vertical_line_b
  10. _vertical_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:    mov  bh,_video_page    ;set the page number
  20.     mov  dl,[bp+6]        ;column to DL
  21.     dec  dl            ;count from 0
  22.     mov  dh,[bp+8]        ;row to DH
  23.     dec  dh            ;count from 0
  24.     mov  ah,2        ;function to set cursor
  25.     int  10h        ;set the cursor
  26.     mov  ah,8        ;func to read attri:char
  27.     int  10h        ;now attri:char in AH:AL
  28.     mov  cl,[bp+10]        ;width to CL
  29.     cmp  cl,1        ;test for 0 and 1
  30.     jnbe B1            ;jump ahead if OK
  31.     jmp  L1            ;else quit routine
  32. B1:    sub  cl,2        ;adjust for end chars
  33.     mov  bl,[bp+4]        ;ln thickness code to BL
  34.     mov  ch,0b3h        ;assume single vert line
  35.     mov  di,0d7ceh        ;center chars for dbl ln
  36.     cmp  bl,'D'        ;is it a double line?
  37.     je   C1            ;jump ahead if so
  38.     cmp  bl,'d'        ;is it a double line?
  39.     je   C1            ;jump ahead if so
  40.     mov  bl,0cdh        ;dbl vert char to BL
  41.     jmp  short E1        ;jump ahead
  42. C1:    mov  bl,0cdh        ;dbl vert char to BL
  43.     jne  E1            ;now jump if not double
  44.     mov  ch,0bah        ;dbl vert char to CH
  45.     mov  si,0d0cah        ;chars for other end
  46.     cmp  al,bl        ;double horizontal char?
  47.     jne  D1            ;jump ahead if not
  48.     mov  al,0cbh        ;char for double,double
  49.     jmp  short G1        ;ready to go, jump ahead
  50. D1:    mov  al,0d2h        ;char for double,single
  51.     jmp  short G1        ;ready to go, jump ahead
  52. E1:    mov  di,0c5d8h        ;center chars for dbl ln
  53.     mov  si,0c1cfh        ;chars for other end
  54.     cmp  al,bl        ;double horizontal char?
  55.     jne  F1            ;jump ahead if not
  56.     mov  al,0d1h        ;char for single,single
  57.     jmp  short G1        ;ready to go, jump ahead
  58. F1:    mov  al,0c2h        ;char for single,single
  59. G1:    mov  bl,ah        ;attribute to BL
  60.     mov  ah,9        ;func to write char-attri
  61.     push cx            ;save counter
  62.     mov  cx,1        ;write 1 char
  63.     int  10h        ;write the char and attri
  64.     pop  cx            ;restore counter
  65.     mov  bp,0c4cdh        ;two horz chars in BP
  66.     or   cl,cl        ;any vert straights?
  67.     jz   K1            ;jump ahead if not
  68. H1:    inc  dh            ;inc cursor row setting
  69.     mov  ah,2        ;function to set cursor
  70.     int  10h        ;forward the cursor
  71.     mov  ah,8        ;func to read attri:char
  72.     int  10h        ;get attri:char (AH:AL)
  73.     mov  ah,ch        ;vert straight char to AH
  74.     xchg dx,bp        ;move horizontals to DX
  75.     xchg cx,di        ;move center chars to CX
  76.     cmp  al,dl        ;double horizontal char?
  77.     je   I1            ;jump ahead if so
  78.     cmp  al,dh        ;single horizontal char?
  79.     jne  J1            ;jump ahead if not so
  80.     mov  ah,ch        ;vertical char to AH
  81.     jmp  short J1        ;go print it
  82. I1:    mov  ah,cl        ;double center char to AH
  83. J1:    mov  al,ah        ;transfer char to AL
  84.     xchg cx,di        ;restore counter to CX
  85.     xchg dx,bp        ;restore cursor pos to DX
  86.     mov  ah,9        ;function to write char
  87.     push cx            ;save CX values
  88.     mov  cx,1        ;write 1 char
  89.     int  10h        ;write the char and attri
  90.     pop  cx            ;restore CX values
  91.     or   si,si        ;has SI been set to 0?
  92.     jz   L1            ;quit if so
  93.     dec  cl            ;decrement counter
  94.     jnz  H1            ;loop until 0
  95. K1:    mov  di,si        ;end chars to DI
  96.     sub  si,si        ;clear SI as flag
  97.     jmp  short H1        ;go write end char
  98. L1:    pop  si            ;
  99.     pop  di            ;
  100.     pop  bp            ;
  101.     cmp  _memory_model,0    ;quit
  102.     jle  quit        ;
  103.     db   0CBh        ;RET far
  104. quit:    ret            ;RET near
  105. _vertical_line_b endp
  106. _TEXT    ENDS
  107.     END
  108.