Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 3.84 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. 39a40,41
  2. > ----------- optimization -----------
  3. > variable goPush: bit
  4. 50c52
  5. <       insAddr <- pc;pc := ( pc + 1 as log numIns bits )||insQ -> ir--readIns();incPC()
  6. ---
  7. >       readIns();incPC()
  8. 181c183
  9. <       pc := 0 || sp:=0 || stopFlag := 0 || acc:=0 ||bcc:=0 ||
  10. ---
  11. >       pc := 0 || sp:=0 || stopFlag := 0 || acc:=0 ||bcc:=0 ||goPush:=0 ||
  12. 194c196,197
  13. <                       push0()
  14. ---
  15. >                       acc:=0;
  16. >                       goPush:=1
  17. 197c200
  18. <                       push()
  19. ---
  20. >                       goPush:=1
  21. 200c203
  22. <                       push()
  23. ---
  24. >                       goPush:=1
  25. 202c205,207
  26. <                       push00()
  27. ---
  28. >                       acc:=0;
  29. >                       push();
  30. >                       goPush:=1
  31. 206c211,212
  32. <                       push0()
  33. ---
  34. >                       acc:=0;
  35. >                       goPush:=1
  36. 209c215
  37. <                       push()
  38. ---
  39. >                       goPush:=1
  40. 212c218
  41. <                       push()
  42. ---
  43. >                       goPush:=1
  44. 214c220,222
  45. <                       push00()
  46. ---
  47. >                       acc:=0;
  48. >                       push();
  49. >                       goPush:=1
  50. 220c228
  51. <                       push()
  52. ---
  53. >                       goPush:=1
  54. 224c232,290
  55. <                       push()
  56. ---
  57. >                       goPush:=1
  58. >               | 0x59 then -- dup
  59. >                       pop(); -- pop value
  60. >                       push();
  61. >                       goPush:=1
  62. >               | 0x5A then -- dup_x1 Before:..., word2, word1 After:..., word1, word2, word1
  63. >                       pop2(); -- bcc=word1, acc=word2
  64. >                       ccc:=acc; -- word2
  65. >                       acc:=bcc; -- word1
  66. >                       push();   -- word1
  67. >                       acc:=ccc; -- word2
  68. >                       push();
  69. >                       acc:=bcc;
  70. >                       goPush:=1
  71. >               | 0x5F then -- swap  Before:..., word2, word1 After:..., word1, word2
  72. >                       pop2();
  73. >                       ccc:=acc;
  74. >                       acc:=bcc;
  75. >                       push();
  76. >                       acc:=ccc;
  77. >                       goPush:=1
  78. >               | 0x60 then -- IADD
  79. >                       pop2();
  80. >                       addAccBcc();
  81. >                       goPush:=1
  82. >               | 0x61..0x63 then -- LADD/FADD/DADD
  83. >                       print "unimplemented instruction = ", ir
  84. >               | 0x64 then -- ISUB
  85. >                       pop2();
  86. >                       subAccBcc();
  87. >                       goPush:=1
  88. >               | 0x74 then -- INEG
  89. >                       pop();
  90. >                       bcc:=acc;
  91. >                       acc:=0;
  92. >                       subAccBcc();
  93. >                       goPush:=1
  94. >               | 0x80 then -- IOR
  95. >                       pop2();
  96. >                       acc:=acc or bcc;
  97. >                       goPush:=1
  98. >               | 0x81 then -- LOR
  99. >                       print "unimplemented instruction = ", ir
  100. >               | 0x82 then -- IXOR
  101. >                       pop2();
  102. >                       acc:=acc xor bcc;
  103. >                       goPush:=1
  104. >               | 0x91 then -- i2b
  105. >                       pop();
  106. >                       acc:=(#acc[0..7]  as ENTRY_SIZE);
  107. >                       goPush:=1
  108. >               | 0x92 then -- i2c (Zero extended)
  109. >                       pop();
  110. >                       acc:=(#acc[0..15] @ #0 as ENTRY_SIZE);
  111. >                       goPush:=1
  112. >               | 0x93 then -- i2s (signed extended)
  113. >                       pop();
  114. >                       acc:=(#acc[0..15]  as ENTRY_SIZE);
  115. >                       goPush:=1
  116. 310,322d375
  117. <               | 0x59 then -- dup
  118. <                       pop(); -- pop value
  119. <                       push();
  120. <                       push()
  121. <               | 0x5A then -- dup_x1 Before:..., word2, word1 After:..., word1, word2, word1
  122. <                       pop2(); -- bcc=word1, acc=word2
  123. <                       ccc:=acc; -- word2
  124. <                       acc:=bcc; -- word1
  125. <                       push();   -- word1
  126. <                       acc:=ccc; -- word2
  127. <                       push();
  128. <                       acc:=bcc;
  129. <                       push()
  130. 331,347d383
  131. <               | 0x5F then -- swap  Before:..., word2, word1 After:..., word1, word2
  132. <                       pop2();
  133. <                       ccc:=acc;
  134. <                       acc:=bcc;
  135. <                       push();
  136. <                       acc:=ccc;
  137. <                       push()
  138. <               | 0x60 then -- IADD
  139. <                       pop2();
  140. <                       addAccBcc();
  141. <                       push()
  142. <               | 0x61..0x63 then -- LADD/FADD/DADD
  143. <                       print "unimplemented instruction = ", ir
  144. <               | 0x64 then -- ISUB
  145. <                       pop2();
  146. <                       subAccBcc();
  147. <                       push()
  148. 352,357d387
  149. <               | 0x74 then -- INEG
  150. <                       pop();
  151. <                       bcc:=acc;
  152. <                       acc:=0;
  153. <                       subAccBcc();
  154. <                       push()
  155. 366,375d395
  156. <               | 0x80 then -- IOR
  157. <                       pop2();
  158. <                       acc:=acc or bcc;
  159. <                       push()
  160. <               | 0x81 then -- LOR
  161. <                       print "unimplemented instruction = ", ir
  162. <               | 0x82 then -- IXOR
  163. <                       pop2();
  164. <                       acc:=acc xor bcc;
  165. <                       push()
  166. 386,397d405
  167. <               | 0x91 then -- i2b
  168. <                       pop();
  169. <                       acc:=(#acc[0..7]  as ENTRY_SIZE);
  170. <                       push()
  171. <               | 0x92 then -- i2c (Zero extended)
  172. <                       pop();
  173. <                       acc:=(#acc[0..15] @ #0 as ENTRY_SIZE);
  174. <                       push()
  175. <               | 0x93 then -- i2s (signed extended)
  176. <                       pop();
  177. <                       acc:=(#acc[0..15]  as ENTRY_SIZE);
  178. <                       push()
  179. 501c509,512
  180. <                       pc_out <- pc || acc_out <-acc
  181. ---
  182. >                       case goPush of 0 then
  183. >                               push()
  184. >                       end
  185. >                       ; pc_out <- pc || acc_out <-acc
  186. 514c525
  187. < end
  188. \ 檔案末沒有 newline 字元
  189. ---
  190. > end