home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / ZAURUS / PILI102 / INTER.PRO < prev    next >
Text File  |  1996-11-11  |  10KB  |  237 lines

  1. ;Here is the OP-CODE list of PILI interpreter
  2. ;mainly it is 32 bit operations but end of opcode indicate the wide of operands
  3. ;example: MULT08 will do a 8 bit multiplication but MULT32 will do a 32 bit (long int) operation.
  4. ;also a MOVE operation (no specifications) will deal with 32bits.
  5. ;
  6. ;p1       : means the first parameter value
  7. ;(p1)     : means value of register indicate by the first parameter
  8. ;[p1]     : means address pointed by the direct value
  9. ;[(p1)]   : means address pointed by the register p1
  10. ;(p1)[p2] : means that the register p1 is considere as an array of 4 bytes and that
  11. ;         : we access at the p2 byte of this array
  12. ;         : ex: if (p1) is 12 34 56 78 h then (p1)[2] is 56h and (p1)[0] is 12h
  13. ;
  14. ;
  15. ;
  16. ;opcodes:
  17. ;
  18.  
  19. EXIT       00  01 00 ; end of program (stop PILI execution definitively)
  20.  
  21.  
  22. MULT08    01  03 05 ;(p1)*(p2) -> (p1) (8 bits)
  23. MULT16    02  03 05 ;(p1)*(p2) -> (p1) (16 bits)
  24. MULT32    03  03 05 ;(p1)*(p2) -> (p1) (32 bits)
  25. DIV08     04  03 05 ;(p1)/(p2) -> (p1)
  26. DIV16     05  03 05 ;(p1)/(p2) -> (p1)
  27. DIV32     06  03 05 ;(p1)/(p2) -> (p1)
  28. MOD08     07  03 05 ;(p1)%(p2) -> (p1)
  29. MOD16     08  03 05 ;(p1)%(p2) -> (p1)
  30. MOD32     09  03 05 ;(p1)%(p2) -> (p1)
  31. ADD08     0A  03 05 ;(p1)+(p2) -> (p1)
  32. ADD16     0B  03 05 ;(p1)+(p2) -> (p1)
  33. ADD32     0C  03 05 ;(p1)+(p2) -> (p1)
  34. SUB08     0D  03 05 ;(p1)-(p2) -> (p1)
  35. SUB16     0E  03 05 ;(p1)-(p2) -> (p1)
  36. SUB32     0F  03 05 ;(p1)-(p2) -> (p1)
  37.  
  38.  
  39.  
  40. RMV08     10  03 05 ;(p2) -> (p1)
  41. RMV16     11  03 05 ;(p2) -> (p1)
  42. RMV32     12  03 05 ;(p2) -> (p1)
  43. RLD08     13  03 05 ;p2 -> (p1)
  44. RLD16     14  04 09 ;p2 -> (p1)
  45. RLD32     15  06 0D ;p2 -> (p1)
  46.  
  47.  
  48.  
  49. RGMOVE     16  04 15 ;(p2) -> (p1) for (p3) moves (full registers moves)
  50. RGSWAP     17  04 15 ;(p2) <-> (p1) for (p3) moves (full registers moves)
  51. IMOVE      18  04 15 ;[(p2)] -> [(p1)] for (p3) bytes (p3 is 16bits)
  52. MOVE       19  0B 2F ;[p2] -> [p1] for p3 bytes (p3 is 16bits)
  53. LOAD08     1A  04 15 ;[(p2)] -> (p1) for (p3) registers (8 bits/registers)
  54. LOAD16     1B  04 15 ;[(p2)] -> (p1) for (p3) registers (16 bits/registers)
  55. LOAD32     1C  04 15 ;[(p2)] -> (p1) for (p3) registers (32 bits/registers)
  56. STOR08     1D  04 15 ;(p1) -> [(p2)] for (p3) registers (8 bits/registers)
  57. STOR16     1E  04 15 ;(p1) -> [(p2)] for (p3) registers (16 bits/registers)
  58. STOR32     1F  04 15 ;(p1) -> [(p2)] for (p3) registers (32 bits/registers)
  59.  
  60.  
  61.  
  62. GBYTE      20  03 15 ;(p1)[p2]->(p3)         byte move
  63. PBYTE      21  05 55 ;(p1)[p2]->(p3)[p4]     byte move
  64. GWORD      22  03 15 ;(p1)[p2]->(p3)         word move
  65. PWORD      23  05 55 ;(p1)[p2]->(p3)[p4]     word move
  66. PMOVE      24  05 55 ; under redefinition
  67.  
  68.  
  69.  
  70. AND        25  06 0D ;(p1) and p2 flag Z is set if result = 0
  71. AND08      26  03 05 ;(p1) and p2 flag Z is set if result = 0
  72. AND16      27  04 09 ;(p1) and p2 flag Z is set if result = 0
  73. REGAND     28  03 05 ;(p1) and (p2) flag Z is set if result = 0
  74. REGAND08   29  05 55 ;(p1)[p2] and (p3)[p4] flag Z is set if result = 0
  75. REGAND16   2A  05 55 ;(p1)[p2] and (p3)[p4] flag Z is set if result = 0
  76.  
  77. OR         2B  06 0D ;(p1) or p2
  78. OR08       2C  03 05 ;(p1) or p2
  79. OR16       2D  04 09 ;(p1) or p2
  80. REGOR      2E  03 05 ;(p1) or (p2)
  81. REGOR08    2F  05 55 ;(p1)[p2] or (p3)[p4]
  82. REGOR16    30  05 55 ;(p1)[p2] or (p3)[p4]
  83.  
  84. XOR        31  06 0D ;(p1) xor p2
  85. XOR08      32  03 05 ;(p1) xor p2
  86. XOR16      33  04 09 ;(p1) xor p2
  87. REGXOR     34  03 05 ;(p1) xor (p2)
  88. REGXOR08   35  05 55 ;(p1)[p2] xor (p3)[p4]
  89. REGXOR16   36  05 55 ;(p1)[p2] xor (p3)[p4]
  90.  
  91.  
  92.  
  93. SHL        37  02 01 ;(p1) << 1 ,last bit in Carry (flag C)
  94. SHR        38  02 01 ;(p1) >> 1 ,last bit in Carry (flag C)
  95. ROL        39  02 01 ;(p1) rol 1 ,bit shifted out is pushed in pos 1 and copied in Carry
  96. ROR        3A  02 01 ;(p1) ror 1 ,bit shifted out is pushed in last pos and copied in Carry
  97.  
  98.  
  99. ; compare functions
  100. ; egal   => Z=1 C=0
  101. ; <      => Z=0 C=1
  102. ; >      => Z=0 C=0
  103.  
  104. CMP        3B  06 0D ;(p1) = p2 ? result with C and Z
  105. CMP08      3C  03 05 ;(p1) = p2 ? result with C and Z (8bits comparaison)
  106. CMP16      3D  04 09 ;(p1) = p2 ? result with C and Z (16 bit comparaison)
  107. REGCMP     3E  03 05 ;(p1) = (p2) ? result with C and Z
  108. REGCMP08   3F  05 55 ;(p1)[p2] = (p3)[p4] ? result with C and Z (8 bits)
  109. REGCMP16   40  05 55 ;(p1)[p2] = (p3)[p4] ? result with C and Z (16 bits)
  110. CMPMEM     41  04 15 ;[p1] = [p2] on (p3) bytes len (equ to memcmp(p1,p2,p3) function in C)
  111.  
  112.  
  113.  
  114. JP         42  05 03 ;jump to p1 (32 bits)
  115. CALL       43  05 03 ;call p1 and return on a RET type instruction, SP (stack pointer) is touch
  116.  
  117.  
  118. CALLZ      44  05 03 ;call p1 if Z=1 (zero flag)
  119. CALLNZ     45  05 03 ;call p1 if Z=0
  120. CALLC      46  05 03 ;call p1 if c=1 (carry)
  121. CALLNC     47  05 03 ;call p1 if c=0 (carry)
  122.  
  123. JPZ        48  05 03 ;jump to p1 address if z=1
  124. JPNZ       49  05 03 ;jump to p1 address if z=0
  125. JPC        4A  05 03 ;jump to p1 address if c=1
  126. JPNC       4B  05 03 ;jump to p1 address if c=0
  127.  
  128. JPRZ       4C  02 01 ;jump to [p1] address if z=1
  129. JPRNZ      4D  02 01 ;jump to [p1] address if z=0
  130. JPRC       4E  02 01 ;jump to [p1] address if c=1
  131. JPRNC      4F  02 01 ;jump to [p1] address if c=0
  132.  
  133.  
  134.  
  135. JR         50  83 02 ;jump to relative address +/- p1  (IP=IP+/- p1)
  136. RCALL      51  83 02 ;call to relative address +/- p1  (IP=IP+/- p1)
  137.  
  138. JRZ        52  83 02 ;jump to relative address +/- p1  (IP=IP+/- p1) if z=1
  139. JRNZ       53  83 02 ;jump to relative address +/- p1  (IP=IP+/- p1) if Z=0
  140. JRC        54  83 02 ;jump to relative address +/- p1  (IP=IP+/- p1) if C=1
  141. JRNC       55  83 02 ;jump to relative address +/- p1  (IP=IP+/- p1) if C=0
  142.  
  143. JRRZ       56  82 01 ;jump to relative address +/- (p1)  (IP=IP+/- (p1)) if Z=1
  144. JRRNZ      57  82 01 ;jump to relative address +/- (p1)  (IP=IP+/- (p1)) if Z=0
  145. JRRC       58  82 01 ;jump to relative address +/- (p1)  (IP=IP+/- (p1)) if C=1
  146. JRRNC      59  82 01 ;jump to relative address +/- (p1)  (IP=IP+/- (p1)) if C=0
  147.  
  148.  
  149.  
  150. RET        5A  01 00 ;return to previous address ((sp)->ip, sp=sp+4)
  151. RETZ       5B  01 00 ;return to previous address ((sp)->ip, sp=sp+4) if Z=1
  152. RETNZ      5C  01 00 ;return to previous address ((sp)->ip, sp=sp+4) if Z=0
  153. RETC       5D  01 00 ;return to previous address ((sp)->ip, sp=sp+4) if C=1
  154. RETNC      5E  01 00 ;return to previous address ((sp)->ip, sp=sp+4) if C=0
  155.  
  156.  
  157.  
  158. FNCALL     5F  0A 3D ;library call: call function # p1 parameters are at address p2, return is stored from register p3 up to 10 registers long or at address p3
  159. FNREGCALL  60  04 15 ;library call: call function # p1 parameters are at [p2] return is to store at address [p3]
  160. FNRCALL    61  85 19 ;library call: call function # p1 parameters are at ip+/-p2 (p2 is 16bit wide), return is stored from register p3 up to 10 registers long
  161.  
  162. USRCALL    62  0A 3D ;not available
  163. USRREGCALL 63  04 15 ;not available
  164. USRRCALL   64  85 19 ;not available
  165.  
  166.  
  167.  
  168. PUSH       65  02 01 ;Save (p1)  sp=sp-4 , [sp]=p1
  169. POP        66  02 01 ;restore in (p1) p1=[sp] , sp=sp+4
  170. ADDSP      67  02 01 ;sp=sp-(p1)
  171. SUBSP      68  02 01 ;sp=sp+(p1)
  172.  
  173.  
  174.  
  175. SC         69  01 00 ; Set Carry (C)
  176. RC         6A  01 00 ; Reset Carry (C)
  177. NOTC       6B  01 00 ; Inverse C (if C=1, C=0 ; if c=0, c=1)
  178. SZ         6C  01 00 ; Set Z
  179. RZ         6D  01 00 ; Reset Z
  180. NOTZ       6E  01 00 ; Inverse Z
  181.  
  182.  
  183.  
  184. LOOP       6F  84 09 ; loop at ip+/- p2 (16 bits) until (p1)=0, (p1)=(p1)-1
  185. RLOOP      70  03 05 ; loop at [p2] until (p1)=0, (p1)=(p1)-1
  186.  
  187.  
  188. RESET      71  01 00 ; Restart programm
  189. OUTBYTE    72  04 15 ; write from PILI memory to COMPUTERS memory [p1]->[p2] for (p3) bytes WARNING p2 map a real computer memory address
  190. INBYTE     73  04 15 ; read from COMPUTERS memory to PILI memory [p2]->[p1] for (p3) bytes WARNING p2 map a real computer memory address
  191. INC        74  02 01 ; (p1)=(p1)+1
  192. DEC        75  02 01 ; (p1)=(p1)-1
  193.  
  194. JRR        76  82 01 ;jp to relative address +/- (p1)  (IP=IP+/- (p1))
  195. RRCALL     77  82 01 ;call to relative address +/- (p1)  (IP=IP+/- (p1))
  196. LOADSP     78  03 02 ;sp = p1 (16 bit) (stack is limited to 8kbytes)
  197. PUSHSP     79  01 00 ;push sp
  198. POPSP      7A  01 00 ;pop  sp
  199. PUSHIP     7B  01 00 ;push ip
  200. POPIP      7C  01 00 ;pop  ip
  201. FREESP     7D  02 01 ;copy the maximum free stack available in (p1)
  202. FNCALL08   7E  04 15 ;library call: call function # p1 parameters are p2(8 bits), return is stored from register p3 (can be up to 10 registers long or more)
  203. FNCALL16   7F  05 19 ;library call: call function # p1 parameters are p2(16 bits), return is stored from register p3 (can be up to 10 registers long or more)
  204.  
  205.  
  206. TRACE      FD  03 05 ; display a debug trace with a wait loop p1 and a trace number (p2)
  207. DEBUG      FE  03 05 ; display a debug trace with a wait loop p1 and the content of the p2 register
  208.  
  209. ; floating point operands
  210. FMULT      80  03 05 ;(p1)*(p2) -> (p1) (float/real)
  211. FDIV       81  03 05 ;(p1)/(p2) -> (p1) (float/real)
  212. FINT       82  03 05 ; integer part of (p2) in (p1)
  213. FADD       83  03 05 ;(p1)+(p2) -> (p1) (float/real)
  214. FSUB       84  03 05 ;(p1)-(p2) -> (p1) (float/real)
  215. FREGCMP    85  03 05 ;(p1) = (p2) ? result with C and Z (float/real)
  216. FREST      86  03 05 ; decimal part of (p2) in (p1)
  217.  
  218. ; additional opcodes
  219.  
  220. ITOF       87  03 05 ; Convert integer to float (p2)->(p1)
  221. LTOC       88  03 05 ;Convert signed long to signed char (p2)->(p1)
  222. LTOI       89  03 05 ;Convert signed long to signed int  (p2)->(p1)
  223. CTOL       8A  03 05 ;Convert signed char to signed long (p2)->(p1)
  224. CTOI       8B  03 05 ;Convert signed int  to signed long (p2)->(p1)
  225. MSHL       8C  03 05 ;Shift for (p2) bits the register (p1) (shift left)
  226. MSHR       8D  03 05 ;Shift for (p2) bits the register (p1) (shift right)
  227. SMODE      8E  01 00 ;Switch to signed mode for all operations (except fncall)
  228. UMODE      8F  01 00 ;Switch to unsigned mode for all operations (except fncall)
  229. CMODE      90  01 00 ;Switch to compatibility mode (default), only longs are signed
  230. FPOW       91  03 05 ;(p1)  pow  (p2) -> (p1)
  231. FSIN       92  02 01 ;      sin  (p1) -> (p1)
  232. FCOS       93  02 01 ;      cos  (p1) -> (p1)
  233. FTAN       94  02 01 ;      tan  (p1) -> (p1)
  234. FLOG       95  02 01 ;      log  (p1) -> (p1)
  235.  
  236.  
  237.