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