EM_table 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885
  1. #define small(x) ((x)>=1 && (x)<=8)
  2. /******************************************************************************/
  3. /* */
  4. /* Group 1 : Load instructions */
  5. /* */
  6. /******************************************************************************/
  7. /* a6 : local base.
  8. * sp : stack pointer
  9. */
  10. C_loc ==> "pea ($1)".
  11. C_lol ==> "move.l ($1, a6), -(sp)".
  12. C_loe.. ==> "move.l ($1+$2), -(sp)".
  13. C_lil ==> "move.l ([$1,a6]), -(sp)".
  14. C_lof ==> "move.l (sp)+, a0";
  15. "move.l ($1,a0),-(sp)".
  16. C_lal ==> "pea ($1,a6)".
  17. C_lae.. ==> "pea ($1+$2)".
  18. C_lxl
  19. $1 == 0 ==> "move.l a6, -(sp)".
  20. $1 == 1 ==> "move.l (8, a6), -(sp)".
  21. default ==> "move.l (8, a6), a0";
  22. "move.l #$1-2, d0";
  23. "1: move.l (8,a0), a0";
  24. "dbf d0, 1b";
  25. "move.l a0, -(sp)".
  26. C_lxa
  27. $1 == 0 ==> "pea (8,a6)".
  28. $1 == 1 ==> "pea ([8,a6],8)".
  29. default ==> "move.l (8, a6), a0";
  30. "move.l #$1-2, d0";
  31. "1: move.l (8,a0), a0";
  32. "dbf d0, 1b";
  33. "pea (8,a0)".
  34. C_loi
  35. $1 == 1 ==> "move.l (sp)+, a0";
  36. "clr.l -(sp)";
  37. "move.b (a0), (3,sp)".
  38. $1 == 2 ==> "move.l (sp)+, a0";
  39. "clr.l -(sp)";
  40. "move.w (a0), (2,sp)".
  41. $1 == 4 ==> "move.l (sp)+, a0";
  42. "move.l (a0),-(sp)".
  43. $1 == 8 ==> "move.l (sp)+, a0";
  44. "move.l (4,a0),-(sp)";
  45. "move.l (a0), -(sp)".
  46. $1 % 4 == 0 ==> "move.l (sp)+, a0";
  47. "move.l #$1/4, d0";
  48. "add.l #$1, a0";
  49. "1:";
  50. "move.l -(a0), -(sp)";
  51. "sub.l #1, d0";
  52. "bne 1b".
  53. default ==> arg_error( "loi", $1).
  54. C_los
  55. $1 == 4 ==> "jsr (.los)".
  56. default ==> arg_error( "los", $1).
  57. C_ldl ==> "move.l ($1+4, a6), -(sp)";
  58. "move.l ($1, a6), -(sp)".
  59. C_lde.. ==> "move.l ($1+$2+4), -(sp)";
  60. "move.l ($1+$2), -(sp)".
  61. C_ldf ==> "move.l (sp)+, a0";
  62. "move.l ($1+4,a0),-(sp)";
  63. "move.l ($1,a0), -(sp)".
  64. C_lpi ==> "pea ($1)".
  65. /******************************************************************************/
  66. /* */
  67. /* Group 2 : Store instructions */
  68. /* */
  69. /******************************************************************************/
  70. C_stl ==> "move.l (sp)+, ($1,a6)".
  71. C_ste.. ==> "move.l (sp)+, ($1+$2)".
  72. C_sil ==> "move.l (sp)+, ([$1,a6])".
  73. C_stf ==> "move.l (sp)+, a0";
  74. "move.l (sp)+, ($1,a0)".
  75. C_sti
  76. $1 == 1 ==> "move.l (sp)+, a0";
  77. "move.l (sp)+, d0";
  78. "move.b d0, (a0)".
  79. $1 == 2 ==> "move.l (sp)+, a0";
  80. "move.l (sp)+, d0";
  81. "move.w d0, (a0)".
  82. $1 == 4 ==> "move.l (sp)+, a0";
  83. "move.l (sp)+, (a0)".
  84. $1 == 8 ==> "move.l (sp)+, a0";
  85. "move.l (sp)+, (a0)+";
  86. "move.l (sp)+, (a0)".
  87. $1 % 4 == 0 ==> "move.l (sp)+, a0";
  88. "move.l #$1/4, d0";
  89. "1:move.l (sp)+, (a0)+";
  90. "sub.l #1, d0";
  91. "bne 1b".
  92. default ==> arg_error( "sti", (arith) $1).
  93. C_sts ==> "jsr (.sts)".
  94. C_sdl ==> "move.l (sp)+, ($1,a6)";
  95. "move.l (sp)+, ($1+4,a6)".
  96. C_sde.. ==> "move.l (sp)+, ($1+$2)";
  97. "move.l (sp)+, ($1+$2+4)".
  98. C_sdf ==> "move.l (sp)+, a0";
  99. "move.l (sp)+, ($1,a0)";
  100. "move.l (sp)+, ($1+4,a0)".
  101. /******************************************************************************/
  102. /* */
  103. /* Group 3 : Integer arithmetic */
  104. /* */
  105. /******************************************************************************/
  106. C_adi
  107. $1 == 4 ==> "move.l (sp)+, d0";
  108. "add.l d0, (sp)".
  109. default ==> arg_error( "adi", $1).
  110. C_sbi
  111. $1 == 4 ==> "move.l (sp)+, d0";
  112. "sub.l d0, (sp)".
  113. default ==> arg_error( "sbi", $1).
  114. C_mli
  115. $1 == 4 ==> "move.l (sp)+, d0";
  116. "muls.l (sp)+, d0";
  117. "move.l d0,-(sp)".
  118. default ==> arg_error( "mli", $1).
  119. C_dvi
  120. $1 == 4 ==> "move.l (sp)+, d0";
  121. "move.l (sp)+, d1";
  122. "divs.l d0, d1";
  123. "move.l d1,-(sp)".
  124. default ==> arg_error( "dvi", $1).
  125. C_rmi
  126. $1 == 4 ==> "move.l (sp)+, d0";
  127. "move.l (sp), d1";
  128. "move.l d0,(sp)";
  129. "divsl.l (sp)+, d0:d1";
  130. "move.l d0,-(sp)".
  131. default ==> arg_error( "rmi", $1).
  132. C_ngi
  133. $1 == 4 ==> "neg.l (sp)".
  134. default ==> arg_error( "ngi", $1).
  135. C_sli
  136. $1 == 4 ==> "move.l (sp)+, d0";
  137. "move.l (sp)+, d1";
  138. "asl.l d0, d1";
  139. "move.l d1,-(sp)".
  140. default ==> arg_error( "sli", $1).
  141. C_sri
  142. $1 == 4 ==> "move.l (sp)+, d0";
  143. "move.l (sp)+, d1";
  144. "asr.l d0, d1";
  145. "move.l d1,-(sp)".
  146. default ==> arg_error( "sri", $1).
  147. /******************************************************************************/
  148. /* */
  149. /* Group 4 : Unsigned arithmetic */
  150. /* */
  151. /******************************************************************************/
  152. C_adu ==> C_adi( w).
  153. C_sbu ==> C_sbi( w).
  154. C_mlu
  155. $1 == 4 ==> "move.l (sp)+, d0";
  156. "mulu.l (sp)+, d0";
  157. "move.l d0, -(sp)".
  158. default ==> arg_error( "mlu", $1).
  159. C_dvu
  160. $1 == 4 ==> "move.l (sp)+, d0";
  161. "move.l (sp)+, d1";
  162. "divu.l d0, d1";
  163. "move.l d1, -(sp)".
  164. default ==> arg_error( "dvu", $1).
  165. C_rmu
  166. $1 == 4 ==> "move.l (sp)+, d0";
  167. "move.l (sp), d1";
  168. "move.l d0, (sp)";
  169. "divul.l (sp)+, d0:d1";
  170. "move.l d0, -(sp)".
  171. default ==> arg_error( "rmu", $1).
  172. C_slu ==> C_sli( w).
  173. C_sru
  174. $1 == 4 ==> "move.l (sp)+, d0";
  175. "move.l (sp)+, d1";
  176. "lsr.l d0, d1";
  177. "move.l d1, -(sp)".
  178. default ==> arg_error( "sru", $1).
  179. /******************************************************************************/
  180. /* */
  181. /* Group 5 : Floating point arithmetic */
  182. /* */
  183. /******************************************************************************/
  184. C_adf
  185. $1 == 4 ==> "jsr (.adf4)";
  186. "tst.l (sp)+".
  187. $1 == 8 ==> "jsr (.adf8)";
  188. "lea (8, sp), sp".
  189. default ==> arg_error( "adf", $1).
  190. C_sbf
  191. $1 == 4 ==> "jsr (.sbf4)";
  192. "tst.l (sp)+".
  193. $1 == 8 ==> "jsr (.sbf8)";
  194. "lea (8, sp), sp".
  195. default ==> arg_error( "sbf", $1).
  196. C_mlf
  197. $1 == 4 ==> "jsr (.mlf4)";
  198. "tst.l (sp)+".
  199. $1 == 8 ==> "jsr (.mlf8)";
  200. "lea (8, sp), sp".
  201. default ==> arg_error( "mlf", $1).
  202. C_dvf
  203. $1 == 4 ==> "jsr (.dvf4)";
  204. "tst.l (sp)+".
  205. $1 == 8 ==> "jsr (.dvf8)";
  206. "lea (8, sp), sp".
  207. default ==> arg_error( "dvf", $1).
  208. C_ngf
  209. $1 == 4 ==> "jsr (.ngf4)".
  210. $1 == 8 ==> "jsr (.ngf8)".
  211. default ==> arg_error( "ngf", $1).
  212. C_fif
  213. $1 == 4 ==> C_lor((arith)1);
  214. "jsr (.fif4)";
  215. "tst.l (sp)+".
  216. $1 == 8 ==> C_lor((arith)1);
  217. "jsr (.fif8)";
  218. "tst.l (sp)+".
  219. default ==> arg_error( "fif", $1).
  220. C_fef
  221. $1 == 4 ==> C_lor( (arith) 1);
  222. "sub.l #4, (sp)";
  223. "jsr (.fef4)".
  224. $1 == 8 ==> C_lor((arith)1);
  225. "sub.l #4, (sp)";
  226. "jsr (.fef8)".
  227. default ==> arg_error( "fef", $1).
  228. /******************************************************************************/
  229. /* */
  230. /* Group 6 : Pointer arithmetic */
  231. /* */
  232. /******************************************************************************/
  233. C_adp
  234. $1 == 0 ==> .
  235. default ==> "add.l #$1, (sp)".
  236. C_ads
  237. $1 == 4 ==> "move.l (sp)+, d0";
  238. "add.l d0, (sp)".
  239. default ==> arg_error( "ads", $1).
  240. C_sbs
  241. $1 == 4 ==> "move.l (sp)+, d0";
  242. "sub.l d0, (sp)".
  243. default ==> arg_error( "sbs", $1).
  244. /******************************************************************************/
  245. /* */
  246. /* Group 7 : Increment/decrement/zero */
  247. /* */
  248. /******************************************************************************/
  249. C_inc ==> "add.l #1, (sp)".
  250. C_inl ==> "add.l #1, ($1, a6)".
  251. C_ine.. ==> "add.l #1, ($1+$2)".
  252. C_dec ==> "sub.l #1, (sp)".
  253. C_del ==> "sub.l #1, ($1, a6)".
  254. C_dee.. ==> "sub.l #1, ($1+$2)".
  255. C_zrl ==> "clr.l ($1, a6)".
  256. C_zre.. ==> "clr.l ($1+$2)".
  257. C_zrf ==> C_zer( $1).
  258. C_zer
  259. $1 == 4 ==> "clr.l -(sp)".
  260. $1 == 8 ==> "clr.l -(sp)";
  261. "clr.l -(sp)".
  262. default ==> "move.l #$1/4, d0";
  263. "1:";
  264. "clr.l -(sp)";
  265. "sub.l #1, d0";
  266. "bne 1b".
  267. /******************************************************************************/
  268. /* */
  269. /* Group 8 : Convert */
  270. /* */
  271. /******************************************************************************/
  272. /* cii, ciu, cuu, cui are assumed to be called with legal arguments only */
  273. C_cii ==> " move.l (sp)+, d0";
  274. " move.l (sp)+, d1";
  275. " cmp.l d1, d0";
  276. " ble 4f";
  277. " move.l (sp), d0";
  278. " cmp.l #1, d1";
  279. " bne 2f";
  280. " ext.w d0";
  281. "2: ext.l d0";
  282. " move.l d0,(sp)";
  283. "4:".
  284. C_cuu ==> "lea (8,sp),sp".
  285. C_ciu ==> "lea (8,sp),sp".
  286. C_cui ==> "lea (8,sp),sp".
  287. C_cfi ==> "jsr (.cfi)";
  288. "move.l (4, sp), d0";
  289. "cmp.l #4, d0";
  290. "beq 1f";
  291. "tst.l (sp)+";
  292. "1:";
  293. "lea (8, sp), sp".
  294. C_cfu ==> "jsr (.cfu)";
  295. "move.l (4, sp), d0";
  296. "cmp.l #4, d0";
  297. "beq 1f";
  298. "tst.l (sp)+";
  299. "1:";
  300. "lea (8, sp), sp".
  301. C_cff ==> "move.l (sp)+, d0";
  302. "move.l (sp)+, d1";
  303. "cmp.l d0, d1";
  304. "beq 1f";
  305. "cmp.l #4, d0";
  306. "bne 2f";
  307. "jsr (.cff4)";
  308. "add.l #4, sp";
  309. "bra 1f";
  310. "2:";
  311. "move.l (sp), d0";
  312. "clr.l (sp)";
  313. "move.l d0,-(sp)";
  314. "jsr (.cff8)";
  315. "1:".
  316. C_cif ==> "move.l (sp)+, d0";
  317. "cmp.l #4, d0";
  318. "bne 1f";
  319. "jsr (.cif4)";
  320. "add.l #4, sp";
  321. "bra 2f";
  322. "1:";
  323. "jsr (.cif8)";
  324. "2:".
  325. C_cuf ==> "move.l (sp)+, d0";
  326. "cmp.l #4, d0";
  327. "bne 1f";
  328. "jsr (.cuf4)";
  329. "add.l #4, sp";
  330. "bra 2f";
  331. "1:";
  332. "jsr (.cuf8)";
  333. "2:".
  334. /******************************************************************************/
  335. /* */
  336. /* Group 9 : Logical */
  337. /* */
  338. /******************************************************************************/
  339. C_and
  340. $1 == 4 ==> "move.l (sp)+, d0";
  341. "and.l d0, (sp)".
  342. default ==> "move.l #$1/4, d0";
  343. "lea ($1, sp), a0";
  344. "1:";
  345. "move.l (sp)+, d1";
  346. "and.l d1, (a0)+";
  347. "sub.l #1, d0";
  348. "bne 1b".
  349. C_ior
  350. $1 == 4 ==> "move.l (sp)+, d0";
  351. "or.l d0, (sp)".
  352. default ==> "move.l #$1/4, d0";
  353. "lea ($1, sp), a0";
  354. "1:";
  355. "move.l (sp)+, d1";
  356. "or.l d1, (a0)+";
  357. "sub.l #1, d0";
  358. "bne 1b".
  359. C_xor
  360. $1 == 4 ==> "move.l (sp)+, d0";
  361. "eor.l d0, (sp)".
  362. default ==> "move.l #$1/4, d0";
  363. "lea ($1, sp), a0";
  364. "1:";
  365. "move.l (sp)+, d1";
  366. "eor.l d1, (a0)+";
  367. "sub.l #1, d0";
  368. "bne 1b".
  369. C_com
  370. $1 == 4 ==> "not.l (sp)".
  371. $1 == 8 ==> "not.l (sp)";
  372. "not.l (4, sp)".
  373. default ==> "move.l #$1/4, d0";
  374. "move.l sp, a0";
  375. "1:";
  376. "not.l (a0)+";
  377. "sub.l #1, d0";
  378. "bne 1b".
  379. C_rol
  380. $1 == 4 ==> "move.l (sp)+, d0";
  381. "move.l (sp)+, d1";
  382. "rol.l d0, d1";
  383. "move.l d1, -(sp)".
  384. default ==> arg_error( "rol", $1).
  385. C_ror
  386. $1 == 4 ==> "move.l (sp)+, d0";
  387. "move.l (sp)+, d1";
  388. "ror.l d0, d1";
  389. "move.l d1, -(sp)".
  390. default ==> arg_error( "ror", $1).
  391. /******************************************************************************/
  392. /* */
  393. /* Group 10 : Sets */
  394. /* */
  395. /******************************************************************************/
  396. C_inn
  397. $1 == 4 ==> "move.l (sp)+, d0";
  398. "move.l (sp)+, d1";
  399. "btst d0, d1";
  400. "sne d1";
  401. "and.l #1, d1";
  402. "move.l d1, -(sp)".
  403. default ==> "move.l (sp)+, d0";
  404. "move.l #$1, d1";
  405. "jsr (.inn)";
  406. "move.l d0, -(sp)".
  407. C_inn_narg ==> "move.l (sp)+, d1";
  408. "move.l (sp)+, d0";
  409. "jsr (.inn)";
  410. "move.l d0, -(sp)".
  411. C_set
  412. $1 == 4 ==> "move.l (sp)+, d0";
  413. "clr.l d1";
  414. "bset d0, d1";
  415. "move.l d1, -(sp)".
  416. default ==> "move.l (sp)+, d0";
  417. "move.l #$1, d1";
  418. "jsr (.set)".
  419. C_set_narg ==> "move.l (sp)+, d1";
  420. "move.l (sp)+, d0";
  421. "jsr (.set)".
  422. /******************************************************************************/
  423. /* */
  424. /* Group 11 : Array */
  425. /* */
  426. /******************************************************************************/
  427. C_lar ==> "move.l #$1, d0";
  428. "jsr (.lar)".
  429. C_lar_narg ==> "move.l (sp)+, d0";
  430. "jsr (.lar)".
  431. C_sar ==> "move.l #$1, d0";
  432. "jsr (.sar)".
  433. C_sar_narg ==> "move.l (sp)+, d0";
  434. "jsr (.sar)".
  435. C_aar ==> "move.l #$1, d0";
  436. "jsr (.aar)";
  437. "move.l a0, -(sp)".
  438. C_aar_narg ==> "move.l (sp)+, d0";
  439. "jsr (.aar)";
  440. "move.l a0, -(sp)".
  441. /******************************************************************************/
  442. /* */
  443. /* Group 12 : Compare */
  444. /* */
  445. /******************************************************************************/
  446. C_cmi
  447. $1 == 4 ==> "clr.l d0";
  448. "cmp.l (sp)+, (sp)+";
  449. "beq 2f";
  450. "blt 1f";
  451. "add.l #1, d0";
  452. "bra 2f";
  453. "1 : sub.l #1, d0";
  454. "2 : move.l d0, -(sp)".
  455. default ==> "move.l #$1, d0";
  456. "jsr (.cmi)";
  457. "move.l d0, -(sp)".
  458. C_cmu
  459. $1 == 4 ==> "clr.l d0";
  460. "cmp.l (sp)+, (sp)+";
  461. "beq 2f";
  462. "bcs 1f";
  463. "add.l #1, d0";
  464. "bra 2f";
  465. "1 : sub.l #1, d0";
  466. "2 : move.l d0, -(sp)".
  467. default ==> "move.l #$1, d0";
  468. "jsr (.cmu)";
  469. "move.l d0, -(sp)".
  470. C_cmu_narg ==> "move.l (sp)+, d0";
  471. "jsr (.cmu)";
  472. "move.l d0, -(sp)".
  473. C_cms ==> "move.l #$1, d0";
  474. "jsr (.cms)";
  475. "move.l d0, -(sp)".
  476. C_cms_narg ==> "move.l (sp)+, d0";
  477. "jsr (.cms)";
  478. "move.l d0, -(sp)".
  479. C_cmp ==> C_cmu( (arith)4).
  480. C_tlt ==> "move.l (sp), d0";
  481. "move.l #1, (sp)";
  482. "tst.l d0";
  483. "blt 1f";
  484. "clr.l (sp)";
  485. "1:".
  486. C_tle ==> "move.l (sp), d0";
  487. "move.l #1, (sp)";
  488. "tst.l d0";
  489. "ble 1f";
  490. "clr.l (sp)";
  491. "1:".
  492. C_teq ==> "move.l (sp), d0";
  493. "move.l #1, (sp)";
  494. "tst.l d0";
  495. "beq 1f";
  496. "clr.l (sp)";
  497. "1:".
  498. C_tne ==> "move.l (sp), d0";
  499. "move.l #1, (sp)";
  500. "tst.l d0";
  501. "bne 1f";
  502. "clr.l (sp)";
  503. "1:".
  504. C_tge ==> "move.l (sp), d0";
  505. "move.l #1, (sp)";
  506. "tst.l d0";
  507. "bge 1f";
  508. "clr.l (sp)";
  509. "1:".
  510. C_tgt ==> "move.l (sp), d0";
  511. "move.l #1, (sp)";
  512. "tst.l d0";
  513. "bgt 1f";
  514. "clr.l (sp)";
  515. "1:".
  516. C_cmf
  517. $1 == 4 ==> "jsr (.cmf4)";
  518. "tst.l (sp)+";
  519. "move.l d0,(sp)".
  520. $1 == 8 ==> "jsr (.cmf8)";
  521. "lea (12,sp), sp";
  522. "move.l d0,(sp)".
  523. default ==> arg_error("cmf", $1).
  524. /******************************************************************************/
  525. /* */
  526. /* Group 13 : Branch */
  527. /* */
  528. /******************************************************************************/
  529. C_bra ==> "bra $1".
  530. C_blt ==> "move.l (sp)+, d0";
  531. "cmp.l (sp)+, d0";
  532. "bgt $1".
  533. C_ble ==> "move.l (sp)+, d0";
  534. "cmp.l (sp)+, d0";
  535. "bge $1".
  536. C_beq ==> "move.l (sp)+, d0";
  537. "cmp.l (sp)+, d0";
  538. "beq $1".
  539. C_bne ==> "move.l (sp)+, d0";
  540. "cmp.l (sp)+, d0";
  541. "bne $1".
  542. C_bge ==> "move.l (sp)+, d0";
  543. "cmp.l (sp)+, d0";
  544. "ble $1".
  545. C_bgt ==> "move.l (sp)+, d0";
  546. "cmp.l (sp)+, d0";
  547. "blt $1".
  548. C_zlt ==> "tst.l (sp)+";
  549. "blt $1".
  550. C_zle ==> "tst.l (sp)+";
  551. "ble $1".
  552. C_zeq ==> "tst.l (sp)+";
  553. "beq $1".
  554. C_zne ==> "tst.l (sp)+";
  555. "bne $1".
  556. C_zge ==> "tst.l (sp)+";
  557. "bge $1".
  558. C_zgt ==> "tst.l (sp)+";
  559. "bgt $1".
  560. /******************************************************************************/
  561. /* */
  562. /* Group 14 : Procedure call instructions */
  563. /* */
  564. /******************************************************************************/
  565. C_cai ==> "move.l (sp)+, a0";
  566. "jsr (a0)".
  567. C_cal ==> "jsr ($1)".
  568. C_lfr
  569. $1 == 4 ==> "move.l d0, -(sp)".
  570. $1 == 8 ==> "move.l d1, -(sp)";
  571. "move.l d0, -(sp)".
  572. default ==> arg_error( "lfr", $1).
  573. C_ret
  574. $1 == 0 ==> "unlk a6";
  575. "rts".
  576. $1 == 4 ==> "move.l (sp)+, d0";
  577. "unlk a6";
  578. "rts".
  579. $1 == 8 ==> "move.l (sp)+, d0";
  580. "move.l (sp)+, d1";
  581. "unlk a6";
  582. "rts".
  583. default ==> arg_error( "ret", $1).
  584. /******************************************************************************/
  585. /* */
  586. /* Group 15 : Miscellaneous instructions */
  587. /* */
  588. /******************************************************************************/
  589. C_asp
  590. small( $1) ==> "add.l #$1, sp".
  591. default ==> "lea ($1, sp), sp".
  592. C_ass
  593. $1 == 4 ==> "add.l (sp)+, sp".
  594. default ==> arg_error( "ass", $1).
  595. C_blm
  596. $1 == 4 ==> "move.l (sp)+, a0";
  597. "move.l (sp)+, a1";
  598. "move.l (a1), (a0)".
  599. $1 == 8 ==> "move.l (sp)+, a0";
  600. "move.l (sp)+, a1";
  601. "move.l (a1), (a0)";
  602. "move.l (4, a1), (4, a0)".
  603. default ==> "move.l (sp)+, a0";
  604. "move.l (sp)+, a1";
  605. "move.l #$1/4, d0";
  606. "1:";
  607. "move.l (a1)+, (a0)+";
  608. "sub.l #1, d0";
  609. "bne 1b".
  610. C_bls
  611. $1 == 4 ==> "move.l (sp)+, d0";
  612. "move.l (sp)+, a0";
  613. "move.l (sp)+, a1";
  614. "asr.l #2, d0";
  615. "beq 2f";
  616. "1:";
  617. "move.l (a1)+, (a0)+";
  618. "sub.l #1, d0";
  619. "bne 1b";
  620. "2:".
  621. default ==> arg_error( "bls", $1).
  622. C_csa
  623. $1 == 4 ==> "move.l (sp)+,a0";
  624. "move.l (sp)+,d0";
  625. "jmp (.csa)".
  626. default ==> arg_error( "csa", $1).
  627. C_csb
  628. $1 == 4 ==> "move.l (sp)+,a0";
  629. "move.l (sp)+,d0";
  630. "jmp (.csb)".
  631. default ==> arg_error( "csb", $1).
  632. C_dch ==> C_loi( (arith)4).
  633. C_dup
  634. $1 == 4 ==> "move.l (sp), -(sp)".
  635. $1 == 8 ==> "move.l (4, sp), -(sp)";
  636. "move.l (4, sp), -(sp)".
  637. default ==> "move.l #$1/4, d0";
  638. "lea ($1, sp), a0";
  639. "1:";
  640. "move.l -(a0), -(sp)";
  641. "sub.l #1, d0";
  642. "bne 1b".
  643. C_dus
  644. $1 == 4 ==> "move.l (sp)+, d0";
  645. "lea (0, sp, d0.l*1), a0";
  646. "asr.l #2, d0";
  647. "beq 2f";
  648. "1:";
  649. "move.l -(a0), -(sp)";
  650. "sub.l #1, d0";
  651. "bne 1b";
  652. "2:".
  653. default ==> arg_error( "dus", $1).
  654. C_exg ==> "move.l #$1, d0";
  655. "jsr (.exg)".
  656. C_fil.. ==> "move.l #$1+$2, (.filn)".
  657. C_gto.. ==> "move.l #$1+$2, a0";
  658. "move.l (8, a0), a6";
  659. "move.l (4, a0), sp";
  660. "jmp ([0,a0], 0)".
  661. C_lim ==> "move.l (.trpim), -(sp)".
  662. C_lin ==> "move.l #$1, (.lino)".
  663. C_lni ==> "add.l #1, (.lino)".
  664. C_lor
  665. $1 == 0 ==> "move.l a6, -(sp)".
  666. $1 == 1 ==> "move.l sp, -(sp)".
  667. $1 == 2 ==> "move.l (.reghp), -(sp)".
  668. default ==> arg_error( "lor", $1).
  669. C_lpb ==> C_adp( (arith)8).
  670. C_mon ==> "jsr (.mon)".
  671. C_nop ==> .
  672. C_rck
  673. $1 == 4 ==> "move.l (sp)+, a0";
  674. "move.l (sp)+, d0";
  675. "cmp2.l (a0), d0";
  676. "bcc 1f";
  677. "pea (1)"; /* push constant 1 == ERANGE */
  678. "jsr (.trp)";
  679. "1: move.l d0, -(sp)".
  680. default ==> arg_error( "rck", $1).
  681. C_rtt ==> C_ret( (arith)0).
  682. C_sig ==> "move.l (.trppc), a0";
  683. "move.l (sp)+, (.trppc)";
  684. "move.l a0, -(sp)".
  685. C_sim ==> "move.l (sp)+, (.trpim)".
  686. C_str
  687. $1 == 0 ==> "move.l (sp)+, a6".
  688. $1 == 1 ==> "move.l (sp)+, sp".
  689. $1 == 2 ==> "jsr (.strhp)".
  690. default ==> arg_error( "str", $1).
  691. C_trp ==> "jsr (.trp)".
  692. /*****************************************************************************/
  693. ..icon
  694. $2 == 1 ==> gen1( (ONE_BYTE) atoi( $1)).
  695. $2 == 2 ==> gen2( (TWO_BYTES) atoi( $1)).
  696. $2 == 4 ==> gen4( (FOUR_BYTES) atol( $1)).
  697. default ==> arg_error( "icon", $2).
  698. ..ucon
  699. $2 == 1 ==> gen1( (ONE_BYTE) atoi( $1)).
  700. $2 == 2 ==> gen2( (TWO_BYTES) atoi( $1)).
  701. $2 == 4 ==> gen4( (FOUR_BYTES) atol( $1)).
  702. default ==> arg_error( "icon", $2).
  703. ..fcon ==> con_float($1, $2).
  704. /*****************************************************************************/
  705. C_prolog ==> .
  706. C_jump ==> "bra $1".
  707. C_locals ==> "link a6, #-$1".
  708. C_db_sline ==> "jsr (___u_LiB)".