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

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