home *** CD-ROM | disk | FTP | other *** search
/ ftp.update.uu.se / ftp.update.uu.se.2014.03.zip / ftp.update.uu.se / pub / rainbow / msdos / decus / RB140 / grlib03a.arj / LTEXT.ASM < prev    next >
Assembly Source File  |  1988-12-08  |  11KB  |  318 lines

  1. PAGE ,132
  2. ;LTEXT.ASM
  3. ;UPDATE HISTORY
  4. ;==============
  5. ; 15 nov 84    Convert to CI86 V2.2
  6.  
  7.     include    asmc.h
  8.  
  9.     SEGEND    CODE
  10.  
  11.     SEGDEF    DATA
  12.  
  13. EXTRN    l_type:BYTE, t_col:BYTE, gbmod:BYTE, t_sca:BYTE
  14.  
  15. Lflag    DB      1
  16. Lxs    DW      1
  17. Lys    DW      1
  18. Lxf    DW      1
  19. Lyf    DW      1
  20.  
  21. ;******************************************************************
  22. ;*                                                                *
  23. ;*                      stroke font character set                 *
  24. ;*                                                                *
  25. ;******************************************************************
  26. ;
  27. ;the following tables are vertice information for a stroked character
  28. ;set the x,y coordinate information is represented by 4 bit 2's 
  29. ;complement numbers in the range of +-7 x, +-7 y. end of character
  30. ;is represented by -8 x, -8 y and dark vector is represented by -8 x,
  31. ; 0 y.
  32. ;
  33. ;       bit     7 6 5 4 3 2 1 0
  34. ;               |     | |     |
  35. ;                \   ;   \   ;
  36. ;                  x       y
  37. ;
  38. ;characters are currently mapped into the positive quadrant,
  39. ;with the origin at the lower left corner of an upper case character,
  40. ;therfore, lowercase characters will descend below the line specified
  41. ;for the character.
  42.  
  43. Lf_20  DB  88H
  44. Lf_21  DB  20H,21H,80H,23H,26H,88H
  45. Lf_22  DB  24H,26H,80H,54H,56H,88H
  46. Lf_23  DB  20H,26H,80H,40H,46H,80H,04H,64H,80H,02H,62H,88H
  47. Lf_24  DB  2fH,27H,80H,01H,10H,30H,41H,42H,33H,13H,04H,05H
  48.        DB  16H,36H,45H,88H
  49. Lf_25  DB  11H,55H,80H,14H,15H,25H,24H,14H,80H,41H,51H,52H
  50.        DB  42H,41H,88H
  51. Lf_26  DB  50H,14H,15H,26H,36H,45H,44H,11H,10H,30H,52H,88H
  52. Lf_27  DB  34H,36H,88H
  53. Lf_28  DB  4eH,11H,14H,47H,88H
  54. Lf_29  DB  0eH,31H,34H,07H,88H
  55. Lf_2a  DB  30H,36H,80H,11H,55H,80H,15H,51H,80H,03H,63H,88H
  56. Lf_2b  DB  30H,36H,80H,03H,63H,88H
  57. Lf_2c  DB  11H,20H,2fH,0dH,88H
  58. Lf_2d  DB  03H,63H,88H
  59. Lf_2e  DB  00H,01H,11H,10H,00H,88H
  60. Lf_2f  DB  00H,01H,45H,46H,88H
  61. Lf_30  DB  01H,05H,16H,36H,45H,41H,30H,10H,01H,88H
  62. Lf_31  DB  04H,26H,20H,80H,00H,40H,88H
  63. Lf_32  DB  05H,16H,36H,45H,44H,00H,40H,41H,88H
  64. Lf_33  DB  05H,16H,36H,45H,44H,33H,42H,41H,30H,10H,01H,80H
  65.        DB  13H,33H,88H
  66. Lf_34  DB  06H,03H,43H,80H,20H,26H,88H
  67. Lf_35  DB  01H,10H,30H,41H,42H,33H,03H,06H,46H,88H
  68. Lf_36  DB  02H,13H,33H,42H,41H,30H,10H,01H,05H,16H
  69.        DB  36H,45H,88H
  70. Lf_37  DB  06H,46H,44H,00H,88H
  71. Lf_38  DB  01H,02H,13H,04H,05H,16H,36H,45H,44H,33H,42H,41H
  72.        DB  30H,10H,01H,80H,13H,23H,88H
  73. Lf_39  DB  01H,10H,30H,41H,45H,36H,16H
  74.        DB  05H,04H,13H,33H,44H,88H
  75. Lf_3a  DB  15H,25H,24H,14H,15H,80H,12H,22H,21H,11H,12H,88H
  76. Lf_3b  DB  15H,25H,24H,14H,15H,80H
  77.        DB  21H,11H,12H,22H,20H,1fH,88H
  78. Lf_3c  DB  30H,03H,36H,88H
  79. Lf_3d  DB  02H,42H,80H,04H,44H,88H
  80. Lf_3e  DB  10H,43H,16H,88H
  81. Lf_3f  DB  06H,17H,37H,46H,45H,34H,24H,22H,80H,21H,20H,88H
  82. Lf_40  DB  50H,10H,01H,06H,17H,57H,66H,63H,52H,32H,23H,24H
  83.        DB  35H,55H,64H,88H
  84. Lf_41  DB  00H,04H,26H,44H,40H,80H,03H,43H,88H
  85. Lf_42  DB  00H,06H,36H,45H,44H,33H,42H,41H,30H
  86.        DB  00H,80H,03H,33H,88H
  87. Lf_43  DB  45H,36H,16H,05H,01H,10H,30H,41H,88H
  88. Lf_44  DB  00H,06H,36H,45H,41H,30H,00H,88H
  89. Lf_45  DB  40H,00H,06H,46H,80H,03H,23H,88H
  90. Lf_46  DB  00H,06H,46H,80H,03H,23H,88H
  91. Lf_47  DB  45H,36H,16H,05H,01H,10H,30H,41H,43H,23H,88H
  92. Lf_48  DB  00H,06H,80H,03H,43H,80H,40H,46H,88H
  93. Lf_49  DB  10H,30H,80H,20H,26H,80H,16H,36H,88H
  94. Lf_4a  DB  01H,10H,30H,41H,46H,88H
  95. Lf_4b  DB  00H,06H,80H,02H,46H,80H,13H,40H,88H
  96. Lf_4c  DB  40H,00H,06H,88H
  97. Lf_4d  DB  00H,06H,24H,46H,40H,88H
  98. Lf_4e  DB  00H,06H,80H,05H,41H,80H,40H,46H,88H
  99. Lf_4f  DB  01H,05H,16H,36H,45H,41H,30H,10H,01H,88H
  100. Lf_50  DB  00H,06H,36H,45H,44H,33H,03H,88H
  101. Lf_51  DB  12H,30H,10H,01H,05H,16H,36H,45H,41H,30H,88H
  102. Lf_52  DB  00H,06H,36H,45H,44H,33H,03H,80H,13H,40H,88H
  103. Lf_53  DB  01H,10H,30H,41H,42H,33H,13H,04H,05H,16H,36H
  104.        DB  45H,88H
  105. Lf_54  DB  06H,46H,80H,20H,26H,88H
  106. Lf_55  DB  06H,01H,10H,30H,41H,046H,88H
  107. Lf_56  DB  06H,02H,20H,42H,46H,88H
  108. Lf_57  DB  06H,00H,22H,40H,46H,88H
  109. Lf_58  DB  00H,01H,45H,46H,80H,40H,41H,05H,06H,88H
  110. Lf_59  DB  06H,24H,20H,80H,24H,46H,88H
  111. Lf_5a  DB  06H,46H,45H,01H,00H,40H,88H
  112. Lf_5b  DB  37H,17H,1fH,3fH,88H
  113. Lf_5c  DB  06H,05H,41H,40H,88H
  114. Lf_5d  DB  17H,37H,3fH,2fH,88H
  115. Lf_5e  DB  04H,26H,44H,88H
  116. Lf_5f  DB  0fH,7fH,88H
  117. Lf_60  DB  54H,36H,88H
  118. Lf_61  DB  40H,43H,34H,14H,03H,01H,10H,30H,41H,88H
  119. Lf_62  DB  06H,01H,10H,30H,41H,43H,34H,14H,03H,88H
  120. Lf_63  DB  41H,30H,10H,01H,03H,14H,34H,043H,88H
  121. Lf_64  DB  46H,41H,30H,10H,01H,03H,14H,34H,43H,88H
  122. Lf_65  DB  41H,30H,10H,01H,03H,14H,34H,43H,42H,02H,88H
  123. Lf_66  DB  20H,25H,36H,46H,55H,80H,03H,43H,88H
  124. Lf_67  DB  41H,30H,10H,01H,03H,14H,34H,43H,4fH
  125.        DB  3eH,1eH,0fH,88H
  126. Lf_68  DB  00H,06H,80H,03H,14H,34H,43H,40H,88H
  127. Lf_69  DB  20H,23H,80H,25H,26H,88H
  128. Lf_6a  DB  46H,45H,80H,43H,4fH,3eH,1eH,0fH,88H
  129. Lf_6b  DB  00H,06H,80H,01H,34H,80H,12H,30H,88H
  130. Lf_6c  DB  20H,26H,88H
  131. Lf_6d  DB  00H,04H,80H,03H,14H,23H,34H,43H,40H,88H
  132. Lf_6e  DB  00H,04H,80H,03H,14H,34H,43H,40H,88H
  133. Lf_6f  DB  01H,03H,14H,34H,43H,41H,30H,10H,01H,88H
  134. Lf_70  DB  04H,0eH,80H,01H,10H,30H,41H,43H,34H,14H,03H,88H
  135. Lf_71  DB  41H,30H,10H,01H,03H,14H,34H,43H,80H,44H,4eH,88H
  136. Lf_72  DB  00H,04H,80H,03H,14H,34H,88H
  137. Lf_73  DB  01H,10H,30H,41H,32H,12H,03H,14H,34H,43H,88H
  138. Lf_74  DB  04H,44H,80H,26H,21H,30H,40H,51H,88H
  139. Lf_75  DB  04H,01H,10H,30H,41H,80H,44H,40H,88H
  140. Lf_76  DB  04H,02H,20H,42H,44H,88H
  141. Lf_77  DB  04H,00H,22H,40H,44H,88H
  142. Lf_78  DB  00H,44H,80H,04H,40H,88H
  143. Lf_79  DB  04H,01H,10H,30H,41H,80H,44H,4fH,3eH,1eH,0fH,88H
  144. Lf_7a  DB  04H,44H,00H,40H,88H
  145. Lf_7b  DB  40H,11H,32H,03H,34H,15H,46H,88H
  146. Lf_7c  DB  20H,23H,80H,25H,27H,88H
  147. Lf_7d  DB  00H,31H,12H,43H,14H,35H,06H,88H
  148. Lf_7e  DB  06H,27H,46H,67H,88H
  149. Lf_7f  DB  07H,77H,88H
  150.  
  151. Llf_tabl equ  $
  152.       DW  Lf_20, Lf_21, Lf_22, Lf_23, Lf_24, Lf_25, Lf_26, Lf_27, Lf_28, Lf_29
  153.       DW  Lf_2a, Lf_2b, Lf_2c, Lf_2d, Lf_2e, Lf_2f, Lf_30, Lf_31, Lf_32, Lf_33
  154.       DW  Lf_34, Lf_35, Lf_36, Lf_37, Lf_38, Lf_39, Lf_3a, Lf_3b, Lf_3c, Lf_3d
  155.       DW  Lf_3e, Lf_3f, Lf_40, Lf_41, Lf_42, Lf_43, Lf_44, Lf_45, Lf_46, Lf_47
  156.       DW  Lf_48, Lf_49, Lf_4a, Lf_4b, Lf_4c, Lf_4d, Lf_4e, Lf_4f, Lf_50, Lf_51
  157.       DW  Lf_52, Lf_53, Lf_54, Lf_55, Lf_56, Lf_57, Lf_58, Lf_59, Lf_5a, Lf_5b
  158.       DW  Lf_5c, Lf_5d, Lf_5e, Lf_5f, Lf_60, Lf_61, Lf_62, Lf_63, Lf_64, Lf_65
  159.       DW  Lf_66, Lf_67, Lf_68, Lf_69, Lf_6a, Lf_6b, Lf_6c, Lf_6d, Lf_6e, Lf_6f
  160.       DW  Lf_70, Lf_71, Lf_72, Lf_73, Lf_74, Lf_75, Lf_76, Lf_77, Lf_78, Lf_79
  161.       DW  Lf_7a, Lf_7b, Lf_7c, Lf_7d, Lf_7e, Lf_7f
  162.  
  163.     SEGEND    DATA
  164.  
  165.     SEGDEF    CODE
  166.  
  167. PUBLIC    ltext
  168.  
  169.     IF    @bigmodel
  170. EXTRN    gdc_nb:FAR, chk_col:FAR, a_mode:FAR, line:FAR, a_patrn:FAR
  171. EXTRN    eseg_sav:FAR
  172.     ELSE
  173. EXTRN    gdc_nb:NEAR, chk_col:NEAR, a_mode:NEAR, line:NEAR, a_patrn:NEAR
  174. EXTRN    eseg_sav:NEAR
  175.     ENDIF
  176.  
  177. ;************************************************************************
  178. ;*                                                                      *
  179. ;*      F U N C T I O N     ltext(x, y, string)                          *
  180. ;*                          int x, y;  char *string;                    *
  181. ;*                                                                      *
  182. ;*      entry:            8[bp] 'x' co-ordinate                         *
  183. ;*                       10[bp] 'y' co-ordinate                         *
  184. ;*                       12[bp] pointer to string array.                *
  185. ;*                                                                      *
  186. ;************************************************************************
  187.  
  188.  
  189.     PROCDEF    ltext
  190.     push    si
  191.     push    di                  ;-2[bp] temp x.
  192.     push    bp                  ;-4[bp] temp y.
  193.     mov     bp,sp
  194.     sub     sp,04H
  195.  
  196.     mov     ax,cs:WORD PTR eseg_sav
  197.     mov     es,ax
  198.  
  199.     call    gdc_nb
  200.     mov     al,BYTE PTR l_type     ;get and save old line type.
  201.     push    ax
  202.     mov     BYTE PTR l_type,0      ;set up line type for solid lines.
  203.     call    a_patrn            ;set pattern multiplier.
  204.     pop     ax                  ;restore old line type.
  205.     mov     BYTE PTR l_type,al
  206.     mov     al,BYTE PTR t_col      ;check for correct colour.
  207.     call    chk_col
  208.     test    BYTE PTR gbmod,2       ;are we in vector mode.
  209.     jnz     Lstrg
  210.     or      BYTE PTR gbmod,12H
  211.     call    a_mode
  212. Lstrg:
  213.     mov     ax,08[bp]
  214.     mov     -2[bp],ax
  215.     mov     ax,10[bp]
  216.     mov     -4[bp],ax
  217.     mov     si,12[bp]           ;point to string array.
  218. Ldo_strg:
  219.     lodsb                       ;get character.
  220.     or      al,al
  221.     jz      L0                  ;exit if end of string.
  222.     cmp     al,1FH
  223.     ja      Ldo_1               ;loop if control character.
  224.     cmp     al,7FH
  225.     jbe     Ldo_1               ;loop if > DEL.
  226.     jmp     Ldo_strg
  227. Ldo_1:  push    si
  228.     call    Lsho_char           ;display it
  229.     pop     si
  230.     mov     al,BYTE PTR t_sca       ;adjust 'x' position by scale factor.
  231.     xor     ah,ah
  232.     shl    ax,1
  233.     shl    ax,1
  234.     add     -2[bp],ax
  235.     jmp     Ldo_strg            ;loop until done
  236.  
  237. L0:     mov    sp,bp
  238.     pop     bp
  239.     pop     di
  240.     pop     si
  241.     ret
  242.  
  243. Lsho_char:
  244.     mov     BYTE PTR Lflag,0        ;set FLAG to first vector.
  245.     xor     ah,ah
  246.     sub     al,20H                  ;make character zero relative.
  247.     shl     ax,1
  248.     mov     si,ax
  249.     mov     si,WORD PTR Llf_tabl[si] ;point into font vectors.
  250. L1:     mov     al,[si]                 ;get vector.
  251.     test    al,80H            ;is it an end ?
  252.     jz      L3                      ;skip if not.
  253.     mov     BYTE PTR Lflag,0
  254.     test    al,8            ;is it END OF CHAR ?
  255.     jz      L2      
  256.     ret                             ;quit if yes.
  257. L2:     inc     si                      ;point to next vector and start again.
  258.     jmp     L1
  259.  
  260. L3:     test    BYTE PTR Lflag,1        ;is this the first vector ?
  261.     jz      L4                      ;jump if it is.
  262.     lea     di, Lxf
  263.     jmp     L5
  264. L4:     lea     di, Lxs
  265. L5:     call    Llvect                  ;work out and add in the offset s.
  266.     test    BYTE PTR Lflag,1        ;is it the first vector ?
  267.     jnz     L6                      ;skip if not.
  268.     mov     BYTE PTR Lflag,1        ;set FLAG to indicate first vector set
  269.     jmp     L1                  ;and start again.
  270. L6:     lea     ax, Lxs
  271.     push    ax
  272.     call    line               ;at last the line can be drawn.
  273.     add     sp,2
  274.     mov     ax,Lxf              ;make the end of the last line
  275.     mov     Lxs,ax              ;the start of the next line.
  276.     mov     ax,Lyf
  277.     mov     Lys,ax
  278.     jmp     L1
  279.  
  280. Llvect:
  281.     mov     ax,-2[bp]       ;get x value.
  282.     mov     [di],ax
  283.     mov     ax,-4[bp]       ;get y value.
  284.     mov     2[di],ax
  285.     lodsb                   ;get stroke info
  286.     mov     bx,ax           ;and duplicate in bx for x offset .
  287.     and     ax,0FH       ;mask to y value
  288.     test    al,8         ;negative ?
  289.     jz      L7
  290.     or      ax,0FFF0H    ;sign extend
  291. L7:     mov     cl,BYTE PTR t_sca
  292.     xor     ch,ch
  293.     push    cx
  294.     imul    cx              ;multiply by scale value
  295.     mov    cx,2
  296.     idiv    cx            ;and divide by two.
  297.     add     2[di],ax        ;subtract to y offset 
  298.     and     bx,0F0H      ;mask to x value
  299.     mov     cl,4           ;shift to 4 lsb
  300.     shr     bx,cl
  301.     test    bl,8         ;negative ?
  302.     jz      L8
  303.     or      bx,0FFF0H    ;sign extend
  304. L8:     mov     ax,bx
  305.     pop     cx
  306.     imul    cx              ;multiply by scale value
  307.     mov    cx,2
  308.     idiv    cx        ;and divide by two
  309.     add     [di],ax         ;add to x offset 
  310.     ret
  311.     PROCEND    ltext
  312.  
  313.     include    epilogue.h
  314.  
  315.  
  316.     END
  317. 
  318.