home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / CSAPE32.ARJ / SOURCE / OWLSCR / PCBXLAT.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-02-03  |  1.4 KB  |  53 lines

  1. ; pcbxlat.asm
  2. ;
  3. ; 5/5/88 by Ted
  4. ;
  5. ; Low Level RAM functions for OWL
  6. ;
  7. ; OWL-PCA 1.2
  8. ; Copyright (c) 1988, 1989 Oakland Group Inc.
  9. ; ALL RIGHTS RESERVED
  10. ;
  11. ;------------------------REVISION HISTORY--------------------------------------;
  12. ;------------------------------------------------------------------------------;
  13. include    PCDECL.MAC
  14.  
  15. TAB SEGMENT WORD
  16.     ASSUME SS:TAB
  17.     esfoo label byte    ; this fake label and segment are provided to trick
  18. TAB ENDS                ; masm into assembling the xlat instruction correctly.
  19.  
  20.     PSEG
  21. ; ---------------------------------------------------------------------------- ;
  22. ; void bxlat (dest_addr, nbytes, swaptab)
  23. ; translate through swap table in nbytes bytes at dest_addr
  24.  
  25. pubproc    DIGPRIV bxlat <daddr, dptr, nbytes, swaptab, dptr>
  26.     push bp
  27.     mov  bp, sp
  28.     pushm <ds, es, si, di>
  29.  
  30.     lds    si, [bp].daddr            ; reg. ds = daddr seg
  31.     mov di, si
  32.     mov    cx, [bp].nbytes            ; reg. cx = nbytes
  33.     les    bx, [bp].swaptab        ; reg. es:bx = table address
  34.  
  35.     cld
  36. ploop:
  37.     lodsb
  38.                         ; the es segment override is poked in here
  39.     xlat    es:esfoo    ; because the stupid assembler doesn't get it
  40.     mov ds:[di], al
  41.     inc di
  42.     loop ploop
  43.     
  44.     popm <di, si, es, ds>
  45.     pop    bp
  46.     ret
  47. endproc bxlat
  48. ; ---------------------------------------------------------------------------- ;
  49.     ENDPS
  50.     end
  51. ; ---------------------------------------------------------------------------- ;
  52.  
  53.