home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol7n08.zip / OPCODE.PAS < prev    next >
Pascal/Delphi Source File  |  1988-04-26  |  1KB  |  39 lines

  1. CONST
  2.   ES_Override    = $2690; {ES Override of instruction}
  3.   LES_DI__BPdisp = $BEC4; {load addr on stack into ES:DI}
  4.   MOV_AX__BPdisp = $868B; {move integer on stack to AX}
  5.   ADD__DI_AX     = $0501; {add AX to [DI] }
  6.   SUB__DI_AX     = $0529; {subtract AX from [DI] }
  7.   INC__DI        = $05FF; {increment [DI] }
  8.   DEC__DI        = $0DFF; {decrement [DI] }
  9.  
  10.   PROCEDURE ptr_incr(VAR Pntr);
  11.   (* increment a pointer *)
  12.   BEGIN
  13.     INLINE(LES_DI__BPdisp/Pntr); {load addr of variable in ES:DI}
  14.     INLINE(ES_Override/INC__DI); {increment variable ES:[DI] }
  15.   END;
  16.  
  17.   PROCEDURE ptr_add(VAR Pntr; bytes : Integer);
  18.   (* add a number of bytes to a pointer *)
  19.   BEGIN
  20.     INLINE(LES_DI__BPdisp/Pntr);   {load addr of variable in ES:DI}
  21.     INLINE(MOV_AX__BPdisp/bytes);  {mov length to AX}
  22.     INLINE(ES_Override/ADD__DI_AX);{add AX to ES:[DI] }
  23.   END;
  24.  
  25.   PROCEDURE ptr_decr(VAR Pntr);
  26.   (* decrement a pointer *)
  27.   BEGIN
  28.     INLINE(LES_DI__BPdisp/Pntr); {load addr of variable in ES:DI}
  29.     INLINE(ES_Override/DEC__DI); {increment variable ES:[DI] }
  30.   END;
  31.  
  32.   PROCEDURE ptr_sub(VAR Pntr; bytes : Integer);
  33.   (* subtract a number of bytes from a pointer *)
  34.   BEGIN
  35.     INLINE(LES_DI__BPdisp/Pntr);   {load addr of variable in ES:DI}
  36.     INLINE(MOV_AX__BPdisp/bytes);  {mov length to AX}
  37.     INLINE(ES_Override/SUB__DI_AX);{subtract AX from ES:[DI] }
  38.   END;
  39.