;/*
.b              equ     byte ptr
.w              equ     word ptr
.l              equ     dword ptr

                .model  medium
                .386

                .code

                locals

;int pcharxy(unsigned *font, int xx, int yy, int ch)
;{
;  int tab[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
;  int i,j=0,x=0,y=0,bpr;
;  unsigned o;
;  struct {
;    unsigned int width,yoffs,rows,cols;
;    unsigned char d[];
;  } *p;
;
;  o=font[ch+1];
;  p=(void*)&((char*)font)[o];
;  if (p->rows)
;  {
;    yy+=p->yoffs;
;    for (y=0; y<p->rows; y++)
;      for (x=0; x<p->cols; x++)
;      {
;        for (i=0; i<8; i++)
;          if (p->d[j]&tab[i]) pset(xx+x*8+i,yy+y,15);
;        j++;
;      }
;  }
;
;  return p->width;
;}

; ***********************************************************************
; *  int pcharxy (void *font, int x, int y, int c, int col)             *
; ***********************************************************************

                public  _pcharxy

pcstack         struc
                dw      ?,?,?,? ; DS, DI, SI, BP
                dd      ?   ; Caller
pcpek           dd      ?
pcx             dw      ?
pcy             dw      ?
pcc             dw      ?
pccol           dw      ?
pcstack         ends

_pcharxy        proc    far
                push    bp
                push    ds
                push    si
                push    di
                mov     bp,sp

                mov     bx,[bp].pcc
                inc     bx
                shl     bx,1
                lds     si,[bp].pcpek
                add     si,ds:[si+bx]
                push    word ptr ds:[si]        ; ds:si --> fontdata

                mov     ax,0a000h
                mov     es,ax
                mov     bx,[bp].pcy
                add     bx,ds:[si+2]
                mov     ax,320
                mul     bx
                add     ax,[bp].pcx
                mov     di,ax                   ; es:di --> scroffs
                mov     ax,[bp].pccol

                mov     dx,ds:[si+4]
                or      dx,dx
                je      pout
                mov     bx,ds:[si+6]
                mov     bp,320/8
                sub     bp,bx
                shl     bp,3
                add     si,8                    ; ds:si --> fontbitmap

                mov     ah,080h
pcouter:        mov     cx,bx
pinner:         mov     dh,ds:[si]
pinner2:        test    dh,ah
                je      pnoset
                mov     es:[di],al
pnoset:         inc     di
                ror     ah,1
                jnc     pinner2
                inc     si
                loop    pinner
                add     di,bp
                dec     dl
                jne     pcouter

pout:           pop     ax
                pop     di
                pop     si
                pop     ds
                pop     bp
                ret
_pcharxy        endp

; ***********************************************************************
; *  int pcharwidth (void *font, int c)                                 *
; ***********************************************************************

                public  _pcharwidth

pwstack         struc
                dw      ?,?,?,? ; DS, DI, SI, BP
                dd      ?   ; Caller
pwpek           dd      ?
pwc             dw      ?
pwstack         ends

_pcharwidth     proc    far
                push    bp
                push    ds
                push    si
                push    di
                mov     bp,sp

                mov     bx,[bp].pwc
                inc     bx
                shl     bx,1
                lds     si,[bp].pwpek
                add     si,ds:[si+bx]
                mov     ax,ds:[si]

                pop     di
                pop     si
                pop     ds
                pop     bp
                ret
_pcharwidth     endp
                end