home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / PC8BITPL.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-09-06  |  2.2 KB  |  91 lines

  1. ; pc8bitpl.asm
  2. ;
  3. ; 7/21/89 by Ted
  4. ;
  5. ; font plotter for 8 bit per pixel display modes (VGA mode 13h)
  6. ;
  7. ; Copyright (c) 1989 Oakland Group Inc.
  8. ; ALL RIGHTS RESERVED
  9. ;
  10. ;------------------------REVISION HISTORY--------------------------------------;
  11. ; 9/06/89 ted    Initialized ds in large data models; I forgot to before.
  12. ;------------------------------------------------------------------------------;
  13. include    PCDECL.MAC
  14. include    PCDATA.MAC
  15.  
  16.     PSEG
  17. ;------------------------------------------------------------------------------;
  18. ; void DIGPRIV pc_8bitplotchar()
  19.  
  20. pubproc DIGPRIV    pc_8bitplotchar
  21.     pushm <bp, ds, es, di, si>    ; no args, so bp is not needed
  22.  
  23. IF FAR_DATA
  24.     mov ax, seg pcdatastruc_ext
  25.     mov ds, ax
  26. ENDIF
  27.  
  28. ;; get everything we need out of pcdatastruc_ext
  29.     mov si, word ptr pcdatastruc_ext.fontoffs
  30.     mov di, pcdatastruc_ext.vidaddr
  31.     mov es, pcdatastruc_ext.dispseg
  32.  
  33.     mov dx, pcdatastruc_ext.starty        ; put y in dx
  34.     mov bp, dx
  35.     add bp, pcdatastruc_ext.fontlines    ; put ending y val in bp
  36.  
  37. ; get fg, bg colors into bx
  38.     mov bx, word ptr pcdatastruc_ext.fgcol    ; bl = fgcol; bh = bgcol
  39.  
  40. linesloop:
  41.     push ds                        ; save ds
  42.     mov ds, pcdatastruc_ext.fontseg
  43.     lodsb                        ; load font byte for this line; inc fontaddr
  44.     pop ds                        ; restore ds
  45.  
  46. ; plot this scanline for all 'nsame' chars
  47.     push di                        ; save vidaddr
  48.     push dx                        ; save y
  49.     mov dl, al
  50.     mov cx, pcdatastruc_ext.nsame
  51. charsloop:
  52.     mov ah, 8
  53. pixloop:
  54.     mov al, bl    ; fg color
  55.     rol dl, 1    ; rotate font byte left; bit duplicated in carry is current bit.
  56.     jc fgplot
  57.     mov al, bh    ; bg color
  58. fgplot:
  59.     stosb
  60.     dec ah
  61.     jnz pixloop
  62.  
  63.     loop charsloop
  64.     pop dx                        ; restore y
  65.     pop di                        ; restore vidaddr
  66.  
  67. ;; if (++y > endy) break;
  68.     inc dx
  69.     cmp dx, bp
  70.     jae alldone
  71.  
  72. ;; vidaddr += ((y & ilmask) == 0) ? vbincr : ilsize;
  73.     test dx, pcdatastruc_ext.ilmask
  74.     jz incvidbuf
  75.     add di, pcdatastruc_ext.ilsize
  76.     jmp linesloop
  77. incvidbuf:
  78.     add di, pcdatastruc_ext.vbincr
  79.     jmp linesloop
  80.  
  81. ;---------
  82. alldone:
  83.     popm <si, di, es, ds, bp>
  84.     ret
  85. endproc pc_8bitplotchar
  86. ;------------------------------------------------------------------------------;
  87.     ENDPS
  88.     end
  89. ;------------------------------------------------------------------------------;
  90.  
  91.