home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / PYGMY.ZIP / ASM.DOC next >
Encoding:
Text File  |  1989-08-21  |  8.0 KB  |  1 lines

  1.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    The 8088/8086 assembler in Pygmy is a regular Forth postfix  assembler.  For examples of how it is used, browse through      PYGMY.SCR.                                                                                                                         Begin a code word with CODE and end it with END-CODE.        e.g.     CODE TST1    BX PUSH,   NXT,   END-CODE                                                                                   Except in special cases (& then you know what you are doing) code words must perform next somehow.  In Pygmy, this code is   laid down in-line by the word  NXT,  rather than by a jump to   a central next routine.                                                                                                                                                                                                                                                                                                                                                                                                                                            If your routine disturbs CS, DS, BP, SP, SI, DI, or BX       it must restore it.  The direction flag must be left clear.                                                                        BP points to the return stack and SP points to the data      stack.  The top (data) stack item is kept in BX rather than     on the actual stack.  See example on previous page; it is the   code for DUP.                                                                                                                      DI is dedicated to holding a zero.  If you use it for any    other purpose, zero it before doing NXT,                                                                                           DS:SI is Forth's IP register.  AX is Forth's W register, but you may use it freely without restoring it.                                                                                                                                                                                                                        The assembler words generally end in a comma, signalling thatthey are actively comma'ing data into the dictionary.  This is  useful for another purpose: as the assembler words and the      regular Forth words all sit in the same vocabulary (FORTH), the comma helps distinguish between similar words, e.g. THEN & THEN,                                                                   It is a "structured" assembler with                          <set-codes> <condition> IF,   XXXXXX    ELSE,   XXXXXX   THEN,  and  XX #, CX MOV, BEGIN,  XXXXX  LOOP,     etc                                                                                    If it is not clear from the instr whether the operand is a   byte or a word, a byte is assumed.  E.g.   0 [BX] PUSH, would   push only a single byte.  To override this, use W-PTR  e.g.     0 [BX] W-PTR PUSH,                                                                                                                                                                                 For the shifts & rotates, if an immediate operand precedes   it, it shifts a single bit  ( e.g.  1 #, AX SHR,    or even     300 #, AX SHR, for that matter).  If you want it to shift based on the contents of CL, omit the immediate operand ( e.g.        4 #, CX MOV,  AX SHR, )                                                                                                         examples to shift right 1 bit:                                   1 #, SI SHR,   1 #,  W-PTR  17 [BX] SHR,   1 #, AL SHR,                                                                        examples to shift right the # of bits in CL                      SI SHR,  AL SHR,  1300 ) SHR,  3752 W-PTR  ) SHR,                                                                                                                                                                                                                                                                              IN, & OUT,  (reading & writing I/O ports)                                                                                       use   port #, AL IN,  or  port #, AX IN,  for 8 bit ports        or    AL IN,  or  AX IN,   for port in the DX register          do not use AL DX IN, - the DX is implied                                                                                       JMP, & CALL,                                                       Long JMPs & CALLs are "not supported at this time."                                                                             The instruction that does a bit by bit complement is called  NOT bye Intel, but this assembler it is called COM,             This assembler uses NOT, to invert the test at the beginning of an IF,   e.g.   CS, IF, ( do if carry set)      THEN,                or    CS, NOT, IF, ( do if carry not set)  THEN,