PageRenderTime 51ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/test-012.asm

https://bitbucket.org/jadudm/eocs-assembler-test-generator
Assembly | 1727 lines | 1727 code | 0 blank | 0 comment | 24 complexity | 8e72e775192036bdd62a07d874cd630f MD5 | raw file
  1. // Test 012
  2. // Source:
  3. //
  4. // (if (< (let ((x54 8)) (- (* 4 (+ (* 9 1) x54)) (- (let ((x55 4)) (* (let ((x56 7)) (if (> x56 7) x56 6)) (- 9 x54))) (if (< x54 (let ((x57 5)) (if (> 1 9) 4 x57))) (if (< x54 x54) 3 x54) 8)))) 0) (if (> (if (< 7 (if (< 2 4) 8 7)) 5 (if (> (- 8 1) (* 8 6)) (if (< 0 3) 4 7) 2)) (* (- (- 7 6) 0) 7)) 7 (+ (+ 5 (let ((x58 4)) (let ((x59 7)) (let ((x60 7)) (- x58 7))))) (let ((x61 8)) (+ (if (> 4 4) 7 4) (* x61 3))))) (- (let ((x62 2)) (+ (let ((x63 3)) (if (> (- x63 x63) (+ 5 x62)) x62 (+ 3 x62))) (let ((x64 7)) 0))) (if (> 2 0) (+ (* 4 8) (if (> 4 6) 3 6)) (let ((x65 0)) (+ (* x65 x65) (* 7 x65))))))
  5. //
  6. // Result (in RAM0): -33
  7. // Generated on 20130309 at 19:54.
  8. // -----------------------------------//
  9. // Do test, leave result in D
  10. // Leave LHS in D; ends at bool-done664.
  11. @8
  12. D=A
  13. @x54
  14. M=D
  15. @4
  16. D=A
  17. @mullhs669
  18. M=D
  19. @9
  20. D=A
  21. @mullhs675
  22. M=D
  23. @1
  24. D=A
  25. @mulrhs676
  26. M=D
  27. // Set multctr673.
  28. @mulrhs676
  29. D=M
  30. @multctr673
  31. M=D
  32. // Set mulsum674.
  33. @0
  34. D=A
  35. @mulsum674
  36. M=D
  37. // Top of whiletop677
  38. (whiletop677)
  39. // Test; jump to whileend678 if zero.
  40. // Leave LHS in D; ends at bool-done683.
  41. @multctr673
  42. D=M
  43. // Move to lhs679
  44. @lhs679
  45. M=D
  46. // Leave RHS in D.
  47. @0
  48. D=A
  49. @rhs680
  50. M=D
  51. // Subtract LHS from RHS
  52. @lhs679
  53. D=M
  54. @rhs680
  55. // These instructions are prescient ... 20130308
  56. A=M
  57. D=A-D
  58. @one682
  59. // Jump and leave 1 in D if true.
  60. D;JLT
  61. @0
  62. D=A
  63. @bool-done683
  64. 0;JMP
  65. (one682)
  66. @1
  67. D=A
  68. // Done with boolean op.
  69. (bool-done683)
  70. @whileend678
  71. D;JEQ
  72. // Run body of whiletop677.
  73. // Set mulsum674.
  74. @mulsum674
  75. D=M
  76. @lhs684
  77. M=D
  78. @mullhs675
  79. D=M
  80. @rhs685
  81. M=D
  82. // Stick LHS result lhs684 in D
  83. @lhs684
  84. D=M
  85. // Stick RHS result rhs685 in A
  86. @rhs685
  87. A=M
  88. D=D+A
  89. @mulsum674
  90. M=D
  91. // Set multctr673.
  92. @multctr673
  93. D=M
  94. @lhs686
  95. M=D
  96. @1
  97. D=A
  98. @rhs687
  99. M=D
  100. // Stick LHS result lhs686 in D
  101. @lhs686
  102. D=M
  103. // Stick RHS result rhs687 in A
  104. @rhs687
  105. A=M
  106. D=D-A
  107. @multctr673
  108. M=D
  109. // Go to top of loop.
  110. @whiletop677
  111. 0;JMP
  112. // End of whiletop677.
  113. (whileend678)
  114. @mulsum674
  115. D=M
  116. @lhs671
  117. M=D
  118. @x54
  119. D=M
  120. @rhs672
  121. M=D
  122. // Stick LHS result lhs671 in D
  123. @lhs671
  124. D=M
  125. // Stick RHS result rhs672 in A
  126. @rhs672
  127. A=M
  128. D=D+A
  129. @mulrhs670
  130. M=D
  131. // Set multctr667.
  132. @mulrhs670
  133. D=M
  134. @multctr667
  135. M=D
  136. // Set mulsum668.
  137. @0
  138. D=A
  139. @mulsum668
  140. M=D
  141. // Top of whiletop688
  142. (whiletop688)
  143. // Test; jump to whileend689 if zero.
  144. // Leave LHS in D; ends at bool-done694.
  145. @multctr667
  146. D=M
  147. // Move to lhs690
  148. @lhs690
  149. M=D
  150. // Leave RHS in D.
  151. @0
  152. D=A
  153. @rhs691
  154. M=D
  155. // Subtract LHS from RHS
  156. @lhs690
  157. D=M
  158. @rhs691
  159. // These instructions are prescient ... 20130308
  160. A=M
  161. D=A-D
  162. @one693
  163. // Jump and leave 1 in D if true.
  164. D;JLT
  165. @0
  166. D=A
  167. @bool-done694
  168. 0;JMP
  169. (one693)
  170. @1
  171. D=A
  172. // Done with boolean op.
  173. (bool-done694)
  174. @whileend689
  175. D;JEQ
  176. // Run body of whiletop688.
  177. // Set mulsum668.
  178. @mulsum668
  179. D=M
  180. @lhs695
  181. M=D
  182. @mullhs669
  183. D=M
  184. @rhs696
  185. M=D
  186. // Stick LHS result lhs695 in D
  187. @lhs695
  188. D=M
  189. // Stick RHS result rhs696 in A
  190. @rhs696
  191. A=M
  192. D=D+A
  193. @mulsum668
  194. M=D
  195. // Set multctr667.
  196. @multctr667
  197. D=M
  198. @lhs697
  199. M=D
  200. @1
  201. D=A
  202. @rhs698
  203. M=D
  204. // Stick LHS result lhs697 in D
  205. @lhs697
  206. D=M
  207. // Stick RHS result rhs698 in A
  208. @rhs698
  209. A=M
  210. D=D-A
  211. @multctr667
  212. M=D
  213. // Go to top of loop.
  214. @whiletop688
  215. 0;JMP
  216. // End of whiletop688.
  217. (whileend689)
  218. @mulsum668
  219. D=M
  220. @lhs665
  221. M=D
  222. @4
  223. D=A
  224. @x55
  225. M=D
  226. @7
  227. D=A
  228. @x56
  229. M=D
  230. // Do test, leave result in D
  231. // Leave LHS in D; ends at bool-done712.
  232. @x56
  233. D=M
  234. // Move to lhs708
  235. @lhs708
  236. M=D
  237. // Leave RHS in D.
  238. @7
  239. D=A
  240. @rhs709
  241. M=D
  242. // Subtract LHS from RHS
  243. @lhs708
  244. D=M
  245. @rhs709
  246. // These instructions are prescient ... 20130308
  247. A=M
  248. D=A-D
  249. @one711
  250. // Jump and leave 1 in D if true.
  251. D;JLT
  252. @0
  253. D=A
  254. @bool-done712
  255. 0;JMP
  256. (one711)
  257. @1
  258. D=A
  259. // Done with boolean op.
  260. (bool-done712)
  261. // If the result was zero, we jump to iffalse706
  262. @iffalse706
  263. D;JEQ
  264. @x56
  265. D=M
  266. // Jump to the ifend707 when done with the true case.
  267. @ifend707
  268. 0;JMP
  269. (iffalse706)
  270. @6
  271. D=A
  272. (ifend707)
  273. @mullhs703
  274. M=D
  275. @9
  276. D=A
  277. @lhs713
  278. M=D
  279. @x54
  280. D=M
  281. @rhs714
  282. M=D
  283. // Stick LHS result lhs713 in D
  284. @lhs713
  285. D=M
  286. // Stick RHS result rhs714 in A
  287. @rhs714
  288. A=M
  289. D=D-A
  290. @mulrhs704
  291. M=D
  292. // Set multctr701.
  293. @mulrhs704
  294. D=M
  295. @multctr701
  296. M=D
  297. // Set mulsum702.
  298. @0
  299. D=A
  300. @mulsum702
  301. M=D
  302. // Top of whiletop715
  303. (whiletop715)
  304. // Test; jump to whileend716 if zero.
  305. // Leave LHS in D; ends at bool-done721.
  306. @multctr701
  307. D=M
  308. // Move to lhs717
  309. @lhs717
  310. M=D
  311. // Leave RHS in D.
  312. @0
  313. D=A
  314. @rhs718
  315. M=D
  316. // Subtract LHS from RHS
  317. @lhs717
  318. D=M
  319. @rhs718
  320. // These instructions are prescient ... 20130308
  321. A=M
  322. D=A-D
  323. @one720
  324. // Jump and leave 1 in D if true.
  325. D;JLT
  326. @0
  327. D=A
  328. @bool-done721
  329. 0;JMP
  330. (one720)
  331. @1
  332. D=A
  333. // Done with boolean op.
  334. (bool-done721)
  335. @whileend716
  336. D;JEQ
  337. // Run body of whiletop715.
  338. // Set mulsum702.
  339. @mulsum702
  340. D=M
  341. @lhs722
  342. M=D
  343. @mullhs703
  344. D=M
  345. @rhs723
  346. M=D
  347. // Stick LHS result lhs722 in D
  348. @lhs722
  349. D=M
  350. // Stick RHS result rhs723 in A
  351. @rhs723
  352. A=M
  353. D=D+A
  354. @mulsum702
  355. M=D
  356. // Set multctr701.
  357. @multctr701
  358. D=M
  359. @lhs724
  360. M=D
  361. @1
  362. D=A
  363. @rhs725
  364. M=D
  365. // Stick LHS result lhs724 in D
  366. @lhs724
  367. D=M
  368. // Stick RHS result rhs725 in A
  369. @rhs725
  370. A=M
  371. D=D-A
  372. @multctr701
  373. M=D
  374. // Go to top of loop.
  375. @whiletop715
  376. 0;JMP
  377. // End of whiletop715.
  378. (whileend716)
  379. @mulsum702
  380. D=M
  381. @lhs699
  382. M=D
  383. // Do test, leave result in D
  384. // Leave LHS in D; ends at bool-done733.
  385. @x54
  386. D=M
  387. // Move to lhs729
  388. @lhs729
  389. M=D
  390. // Leave RHS in D.
  391. @5
  392. D=A
  393. @x57
  394. M=D
  395. // Do test, leave result in D
  396. // Leave LHS in D; ends at bool-done741.
  397. @1
  398. D=A
  399. // Move to lhs737
  400. @lhs737
  401. M=D
  402. // Leave RHS in D.
  403. @9
  404. D=A
  405. @rhs738
  406. M=D
  407. // Subtract LHS from RHS
  408. @lhs737
  409. D=M
  410. @rhs738
  411. // These instructions are prescient ... 20130308
  412. A=M
  413. D=A-D
  414. @one740
  415. // Jump and leave 1 in D if true.
  416. D;JLT
  417. @0
  418. D=A
  419. @bool-done741
  420. 0;JMP
  421. (one740)
  422. @1
  423. D=A
  424. // Done with boolean op.
  425. (bool-done741)
  426. // If the result was zero, we jump to iffalse735
  427. @iffalse735
  428. D;JEQ
  429. @4
  430. D=A
  431. // Jump to the ifend736 when done with the true case.
  432. @ifend736
  433. 0;JMP
  434. (iffalse735)
  435. @x57
  436. D=M
  437. (ifend736)
  438. @rhs730
  439. M=D
  440. // Subtract LHS from RHS
  441. @lhs729
  442. D=M
  443. @rhs730
  444. // These instructions are prescient ... 20130308
  445. A=M
  446. D=A-D
  447. @one732
  448. // Jump and leave 1 in D if true.
  449. D;JGT
  450. @0
  451. D=A
  452. @bool-done733
  453. 0;JMP
  454. (one732)
  455. @1
  456. D=A
  457. // Done with boolean op.
  458. (bool-done733)
  459. // If the result was zero, we jump to iffalse727
  460. @iffalse727
  461. D;JEQ
  462. // Do test, leave result in D
  463. // Leave LHS in D; ends at bool-done749.
  464. @x54
  465. D=M
  466. // Move to lhs745
  467. @lhs745
  468. M=D
  469. // Leave RHS in D.
  470. @x54
  471. D=M
  472. @rhs746
  473. M=D
  474. // Subtract LHS from RHS
  475. @lhs745
  476. D=M
  477. @rhs746
  478. // These instructions are prescient ... 20130308
  479. A=M
  480. D=A-D
  481. @one748
  482. // Jump and leave 1 in D if true.
  483. D;JGT
  484. @0
  485. D=A
  486. @bool-done749
  487. 0;JMP
  488. (one748)
  489. @1
  490. D=A
  491. // Done with boolean op.
  492. (bool-done749)
  493. // If the result was zero, we jump to iffalse743
  494. @iffalse743
  495. D;JEQ
  496. @3
  497. D=A
  498. // Jump to the ifend744 when done with the true case.
  499. @ifend744
  500. 0;JMP
  501. (iffalse743)
  502. @x54
  503. D=M
  504. (ifend744)
  505. // Jump to the ifend728 when done with the true case.
  506. @ifend728
  507. 0;JMP
  508. (iffalse727)
  509. @8
  510. D=A
  511. (ifend728)
  512. @rhs700
  513. M=D
  514. // Stick LHS result lhs699 in D
  515. @lhs699
  516. D=M
  517. // Stick RHS result rhs700 in A
  518. @rhs700
  519. A=M
  520. D=D-A
  521. @rhs666
  522. M=D
  523. // Stick LHS result lhs665 in D
  524. @lhs665
  525. D=M
  526. // Stick RHS result rhs666 in A
  527. @rhs666
  528. A=M
  529. D=D-A
  530. // Move to lhs660
  531. @lhs660
  532. M=D
  533. // Leave RHS in D.
  534. @0
  535. D=A
  536. @rhs661
  537. M=D
  538. // Subtract LHS from RHS
  539. @lhs660
  540. D=M
  541. @rhs661
  542. // These instructions are prescient ... 20130308
  543. A=M
  544. D=A-D
  545. @one663
  546. // Jump and leave 1 in D if true.
  547. D;JGT
  548. @0
  549. D=A
  550. @bool-done664
  551. 0;JMP
  552. (one663)
  553. @1
  554. D=A
  555. // Done with boolean op.
  556. (bool-done664)
  557. // If the result was zero, we jump to iffalse658
  558. @iffalse658
  559. D;JEQ
  560. // Do test, leave result in D
  561. // Leave LHS in D; ends at bool-done757.
  562. // Do test, leave result in D
  563. // Leave LHS in D; ends at bool-done765.
  564. @7
  565. D=A
  566. // Move to lhs761
  567. @lhs761
  568. M=D
  569. // Leave RHS in D.
  570. // Do test, leave result in D
  571. // Leave LHS in D; ends at bool-done773.
  572. @2
  573. D=A
  574. // Move to lhs769
  575. @lhs769
  576. M=D
  577. // Leave RHS in D.
  578. @4
  579. D=A
  580. @rhs770
  581. M=D
  582. // Subtract LHS from RHS
  583. @lhs769
  584. D=M
  585. @rhs770
  586. // These instructions are prescient ... 20130308
  587. A=M
  588. D=A-D
  589. @one772
  590. // Jump and leave 1 in D if true.
  591. D;JGT
  592. @0
  593. D=A
  594. @bool-done773
  595. 0;JMP
  596. (one772)
  597. @1
  598. D=A
  599. // Done with boolean op.
  600. (bool-done773)
  601. // If the result was zero, we jump to iffalse767
  602. @iffalse767
  603. D;JEQ
  604. @8
  605. D=A
  606. // Jump to the ifend768 when done with the true case.
  607. @ifend768
  608. 0;JMP
  609. (iffalse767)
  610. @7
  611. D=A
  612. (ifend768)
  613. @rhs762
  614. M=D
  615. // Subtract LHS from RHS
  616. @lhs761
  617. D=M
  618. @rhs762
  619. // These instructions are prescient ... 20130308
  620. A=M
  621. D=A-D
  622. @one764
  623. // Jump and leave 1 in D if true.
  624. D;JGT
  625. @0
  626. D=A
  627. @bool-done765
  628. 0;JMP
  629. (one764)
  630. @1
  631. D=A
  632. // Done with boolean op.
  633. (bool-done765)
  634. // If the result was zero, we jump to iffalse759
  635. @iffalse759
  636. D;JEQ
  637. @5
  638. D=A
  639. // Jump to the ifend760 when done with the true case.
  640. @ifend760
  641. 0;JMP
  642. (iffalse759)
  643. // Do test, leave result in D
  644. // Leave LHS in D; ends at bool-done781.
  645. @8
  646. D=A
  647. @lhs782
  648. M=D
  649. @1
  650. D=A
  651. @rhs783
  652. M=D
  653. // Stick LHS result lhs782 in D
  654. @lhs782
  655. D=M
  656. // Stick RHS result rhs783 in A
  657. @rhs783
  658. A=M
  659. D=D-A
  660. // Move to lhs777
  661. @lhs777
  662. M=D
  663. // Leave RHS in D.
  664. @8
  665. D=A
  666. @mullhs786
  667. M=D
  668. @6
  669. D=A
  670. @mulrhs787
  671. M=D
  672. // Set multctr784.
  673. @mulrhs787
  674. D=M
  675. @multctr784
  676. M=D
  677. // Set mulsum785.
  678. @0
  679. D=A
  680. @mulsum785
  681. M=D
  682. // Top of whiletop788
  683. (whiletop788)
  684. // Test; jump to whileend789 if zero.
  685. // Leave LHS in D; ends at bool-done794.
  686. @multctr784
  687. D=M
  688. // Move to lhs790
  689. @lhs790
  690. M=D
  691. // Leave RHS in D.
  692. @0
  693. D=A
  694. @rhs791
  695. M=D
  696. // Subtract LHS from RHS
  697. @lhs790
  698. D=M
  699. @rhs791
  700. // These instructions are prescient ... 20130308
  701. A=M
  702. D=A-D
  703. @one793
  704. // Jump and leave 1 in D if true.
  705. D;JLT
  706. @0
  707. D=A
  708. @bool-done794
  709. 0;JMP
  710. (one793)
  711. @1
  712. D=A
  713. // Done with boolean op.
  714. (bool-done794)
  715. @whileend789
  716. D;JEQ
  717. // Run body of whiletop788.
  718. // Set mulsum785.
  719. @mulsum785
  720. D=M
  721. @lhs795
  722. M=D
  723. @mullhs786
  724. D=M
  725. @rhs796
  726. M=D
  727. // Stick LHS result lhs795 in D
  728. @lhs795
  729. D=M
  730. // Stick RHS result rhs796 in A
  731. @rhs796
  732. A=M
  733. D=D+A
  734. @mulsum785
  735. M=D
  736. // Set multctr784.
  737. @multctr784
  738. D=M
  739. @lhs797
  740. M=D
  741. @1
  742. D=A
  743. @rhs798
  744. M=D
  745. // Stick LHS result lhs797 in D
  746. @lhs797
  747. D=M
  748. // Stick RHS result rhs798 in A
  749. @rhs798
  750. A=M
  751. D=D-A
  752. @multctr784
  753. M=D
  754. // Go to top of loop.
  755. @whiletop788
  756. 0;JMP
  757. // End of whiletop788.
  758. (whileend789)
  759. @mulsum785
  760. D=M
  761. @rhs778
  762. M=D
  763. // Subtract LHS from RHS
  764. @lhs777
  765. D=M
  766. @rhs778
  767. // These instructions are prescient ... 20130308
  768. A=M
  769. D=A-D
  770. @one780
  771. // Jump and leave 1 in D if true.
  772. D;JLT
  773. @0
  774. D=A
  775. @bool-done781
  776. 0;JMP
  777. (one780)
  778. @1
  779. D=A
  780. // Done with boolean op.
  781. (bool-done781)
  782. // If the result was zero, we jump to iffalse775
  783. @iffalse775
  784. D;JEQ
  785. // Do test, leave result in D
  786. // Leave LHS in D; ends at bool-done806.
  787. @0
  788. D=A
  789. // Move to lhs802
  790. @lhs802
  791. M=D
  792. // Leave RHS in D.
  793. @3
  794. D=A
  795. @rhs803
  796. M=D
  797. // Subtract LHS from RHS
  798. @lhs802
  799. D=M
  800. @rhs803
  801. // These instructions are prescient ... 20130308
  802. A=M
  803. D=A-D
  804. @one805
  805. // Jump and leave 1 in D if true.
  806. D;JGT
  807. @0
  808. D=A
  809. @bool-done806
  810. 0;JMP
  811. (one805)
  812. @1
  813. D=A
  814. // Done with boolean op.
  815. (bool-done806)
  816. // If the result was zero, we jump to iffalse800
  817. @iffalse800
  818. D;JEQ
  819. @4
  820. D=A
  821. // Jump to the ifend801 when done with the true case.
  822. @ifend801
  823. 0;JMP
  824. (iffalse800)
  825. @7
  826. D=A
  827. (ifend801)
  828. // Jump to the ifend776 when done with the true case.
  829. @ifend776
  830. 0;JMP
  831. (iffalse775)
  832. @2
  833. D=A
  834. (ifend776)
  835. (ifend760)
  836. // Move to lhs753
  837. @lhs753
  838. M=D
  839. // Leave RHS in D.
  840. @7
  841. D=A
  842. @lhs813
  843. M=D
  844. @6
  845. D=A
  846. @rhs814
  847. M=D
  848. // Stick LHS result lhs813 in D
  849. @lhs813
  850. D=M
  851. // Stick RHS result rhs814 in A
  852. @rhs814
  853. A=M
  854. D=D-A
  855. @lhs811
  856. M=D
  857. @0
  858. D=A
  859. @rhs812
  860. M=D
  861. // Stick LHS result lhs811 in D
  862. @lhs811
  863. D=M
  864. // Stick RHS result rhs812 in A
  865. @rhs812
  866. A=M
  867. D=D-A
  868. @mullhs809
  869. M=D
  870. @7
  871. D=A
  872. @mulrhs810
  873. M=D
  874. // Set multctr807.
  875. @mulrhs810
  876. D=M
  877. @multctr807
  878. M=D
  879. // Set mulsum808.
  880. @0
  881. D=A
  882. @mulsum808
  883. M=D
  884. // Top of whiletop815
  885. (whiletop815)
  886. // Test; jump to whileend816 if zero.
  887. // Leave LHS in D; ends at bool-done821.
  888. @multctr807
  889. D=M
  890. // Move to lhs817
  891. @lhs817
  892. M=D
  893. // Leave RHS in D.
  894. @0
  895. D=A
  896. @rhs818
  897. M=D
  898. // Subtract LHS from RHS
  899. @lhs817
  900. D=M
  901. @rhs818
  902. // These instructions are prescient ... 20130308
  903. A=M
  904. D=A-D
  905. @one820
  906. // Jump and leave 1 in D if true.
  907. D;JLT
  908. @0
  909. D=A
  910. @bool-done821
  911. 0;JMP
  912. (one820)
  913. @1
  914. D=A
  915. // Done with boolean op.
  916. (bool-done821)
  917. @whileend816
  918. D;JEQ
  919. // Run body of whiletop815.
  920. // Set mulsum808.
  921. @mulsum808
  922. D=M
  923. @lhs822
  924. M=D
  925. @mullhs809
  926. D=M
  927. @rhs823
  928. M=D
  929. // Stick LHS result lhs822 in D
  930. @lhs822
  931. D=M
  932. // Stick RHS result rhs823 in A
  933. @rhs823
  934. A=M
  935. D=D+A
  936. @mulsum808
  937. M=D
  938. // Set multctr807.
  939. @multctr807
  940. D=M
  941. @lhs824
  942. M=D
  943. @1
  944. D=A
  945. @rhs825
  946. M=D
  947. // Stick LHS result lhs824 in D
  948. @lhs824
  949. D=M
  950. // Stick RHS result rhs825 in A
  951. @rhs825
  952. A=M
  953. D=D-A
  954. @multctr807
  955. M=D
  956. // Go to top of loop.
  957. @whiletop815
  958. 0;JMP
  959. // End of whiletop815.
  960. (whileend816)
  961. @mulsum808
  962. D=M
  963. @rhs754
  964. M=D
  965. // Subtract LHS from RHS
  966. @lhs753
  967. D=M
  968. @rhs754
  969. // These instructions are prescient ... 20130308
  970. A=M
  971. D=A-D
  972. @one756
  973. // Jump and leave 1 in D if true.
  974. D;JLT
  975. @0
  976. D=A
  977. @bool-done757
  978. 0;JMP
  979. (one756)
  980. @1
  981. D=A
  982. // Done with boolean op.
  983. (bool-done757)
  984. // If the result was zero, we jump to iffalse751
  985. @iffalse751
  986. D;JEQ
  987. @7
  988. D=A
  989. // Jump to the ifend752 when done with the true case.
  990. @ifend752
  991. 0;JMP
  992. (iffalse751)
  993. @5
  994. D=A
  995. @lhs828
  996. M=D
  997. @4
  998. D=A
  999. @x58
  1000. M=D
  1001. @7
  1002. D=A
  1003. @x59
  1004. M=D
  1005. @7
  1006. D=A
  1007. @x60
  1008. M=D
  1009. @x58
  1010. D=M
  1011. @lhs830
  1012. M=D
  1013. @7
  1014. D=A
  1015. @rhs831
  1016. M=D
  1017. // Stick LHS result lhs830 in D
  1018. @lhs830
  1019. D=M
  1020. // Stick RHS result rhs831 in A
  1021. @rhs831
  1022. A=M
  1023. D=D-A
  1024. @rhs829
  1025. M=D
  1026. // Stick LHS result lhs828 in D
  1027. @lhs828
  1028. D=M
  1029. // Stick RHS result rhs829 in A
  1030. @rhs829
  1031. A=M
  1032. D=D+A
  1033. @lhs826
  1034. M=D
  1035. @8
  1036. D=A
  1037. @x61
  1038. M=D
  1039. // Do test, leave result in D
  1040. // Leave LHS in D; ends at bool-done841.
  1041. @4
  1042. D=A
  1043. // Move to lhs837
  1044. @lhs837
  1045. M=D
  1046. // Leave RHS in D.
  1047. @4
  1048. D=A
  1049. @rhs838
  1050. M=D
  1051. // Subtract LHS from RHS
  1052. @lhs837
  1053. D=M
  1054. @rhs838
  1055. // These instructions are prescient ... 20130308
  1056. A=M
  1057. D=A-D
  1058. @one840
  1059. // Jump and leave 1 in D if true.
  1060. D;JLT
  1061. @0
  1062. D=A
  1063. @bool-done841
  1064. 0;JMP
  1065. (one840)
  1066. @1
  1067. D=A
  1068. // Done with boolean op.
  1069. (bool-done841)
  1070. // If the result was zero, we jump to iffalse835
  1071. @iffalse835
  1072. D;JEQ
  1073. @7
  1074. D=A
  1075. // Jump to the ifend836 when done with the true case.
  1076. @ifend836
  1077. 0;JMP
  1078. (iffalse835)
  1079. @4
  1080. D=A
  1081. (ifend836)
  1082. @lhs832
  1083. M=D
  1084. @x61
  1085. D=M
  1086. @mullhs844
  1087. M=D
  1088. @3
  1089. D=A
  1090. @mulrhs845
  1091. M=D
  1092. // Set multctr842.
  1093. @mulrhs845
  1094. D=M
  1095. @multctr842
  1096. M=D
  1097. // Set mulsum843.
  1098. @0
  1099. D=A
  1100. @mulsum843
  1101. M=D
  1102. // Top of whiletop846
  1103. (whiletop846)
  1104. // Test; jump to whileend847 if zero.
  1105. // Leave LHS in D; ends at bool-done852.
  1106. @multctr842
  1107. D=M
  1108. // Move to lhs848
  1109. @lhs848
  1110. M=D
  1111. // Leave RHS in D.
  1112. @0
  1113. D=A
  1114. @rhs849
  1115. M=D
  1116. // Subtract LHS from RHS
  1117. @lhs848
  1118. D=M
  1119. @rhs849
  1120. // These instructions are prescient ... 20130308
  1121. A=M
  1122. D=A-D
  1123. @one851
  1124. // Jump and leave 1 in D if true.
  1125. D;JLT
  1126. @0
  1127. D=A
  1128. @bool-done852
  1129. 0;JMP
  1130. (one851)
  1131. @1
  1132. D=A
  1133. // Done with boolean op.
  1134. (bool-done852)
  1135. @whileend847
  1136. D;JEQ
  1137. // Run body of whiletop846.
  1138. // Set mulsum843.
  1139. @mulsum843
  1140. D=M
  1141. @lhs853
  1142. M=D
  1143. @mullhs844
  1144. D=M
  1145. @rhs854
  1146. M=D
  1147. // Stick LHS result lhs853 in D
  1148. @lhs853
  1149. D=M
  1150. // Stick RHS result rhs854 in A
  1151. @rhs854
  1152. A=M
  1153. D=D+A
  1154. @mulsum843
  1155. M=D
  1156. // Set multctr842.
  1157. @multctr842
  1158. D=M
  1159. @lhs855
  1160. M=D
  1161. @1
  1162. D=A
  1163. @rhs856
  1164. M=D
  1165. // Stick LHS result lhs855 in D
  1166. @lhs855
  1167. D=M
  1168. // Stick RHS result rhs856 in A
  1169. @rhs856
  1170. A=M
  1171. D=D-A
  1172. @multctr842
  1173. M=D
  1174. // Go to top of loop.
  1175. @whiletop846
  1176. 0;JMP
  1177. // End of whiletop846.
  1178. (whileend847)
  1179. @mulsum843
  1180. D=M
  1181. @rhs833
  1182. M=D
  1183. // Stick LHS result lhs832 in D
  1184. @lhs832
  1185. D=M
  1186. // Stick RHS result rhs833 in A
  1187. @rhs833
  1188. A=M
  1189. D=D+A
  1190. @rhs827
  1191. M=D
  1192. // Stick LHS result lhs826 in D
  1193. @lhs826
  1194. D=M
  1195. // Stick RHS result rhs827 in A
  1196. @rhs827
  1197. A=M
  1198. D=D+A
  1199. (ifend752)
  1200. // Jump to the ifend659 when done with the true case.
  1201. @ifend659
  1202. 0;JMP
  1203. (iffalse658)
  1204. @2
  1205. D=A
  1206. @x62
  1207. M=D
  1208. @3
  1209. D=A
  1210. @x63
  1211. M=D
  1212. // Do test, leave result in D
  1213. // Leave LHS in D; ends at bool-done868.
  1214. @x63
  1215. D=M
  1216. @lhs869
  1217. M=D
  1218. @x63
  1219. D=M
  1220. @rhs870
  1221. M=D
  1222. // Stick LHS result lhs869 in D
  1223. @lhs869
  1224. D=M
  1225. // Stick RHS result rhs870 in A
  1226. @rhs870
  1227. A=M
  1228. D=D-A
  1229. // Move to lhs864
  1230. @lhs864
  1231. M=D
  1232. // Leave RHS in D.
  1233. @5
  1234. D=A
  1235. @lhs871
  1236. M=D
  1237. @x62
  1238. D=M
  1239. @rhs872
  1240. M=D
  1241. // Stick LHS result lhs871 in D
  1242. @lhs871
  1243. D=M
  1244. // Stick RHS result rhs872 in A
  1245. @rhs872
  1246. A=M
  1247. D=D+A
  1248. @rhs865
  1249. M=D
  1250. // Subtract LHS from RHS
  1251. @lhs864
  1252. D=M
  1253. @rhs865
  1254. // These instructions are prescient ... 20130308
  1255. A=M
  1256. D=A-D
  1257. @one867
  1258. // Jump and leave 1 in D if true.
  1259. D;JLT
  1260. @0
  1261. D=A
  1262. @bool-done868
  1263. 0;JMP
  1264. (one867)
  1265. @1
  1266. D=A
  1267. // Done with boolean op.
  1268. (bool-done868)
  1269. // If the result was zero, we jump to iffalse862
  1270. @iffalse862
  1271. D;JEQ
  1272. @x62
  1273. D=M
  1274. // Jump to the ifend863 when done with the true case.
  1275. @ifend863
  1276. 0;JMP
  1277. (iffalse862)
  1278. @3
  1279. D=A
  1280. @lhs873
  1281. M=D
  1282. @x62
  1283. D=M
  1284. @rhs874
  1285. M=D
  1286. // Stick LHS result lhs873 in D
  1287. @lhs873
  1288. D=M
  1289. // Stick RHS result rhs874 in A
  1290. @rhs874
  1291. A=M
  1292. D=D+A
  1293. (ifend863)
  1294. @lhs859
  1295. M=D
  1296. @7
  1297. D=A
  1298. @x64
  1299. M=D
  1300. @0
  1301. D=A
  1302. @rhs860
  1303. M=D
  1304. // Stick LHS result lhs859 in D
  1305. @lhs859
  1306. D=M
  1307. // Stick RHS result rhs860 in A
  1308. @rhs860
  1309. A=M
  1310. D=D+A
  1311. @lhs857
  1312. M=D
  1313. // Do test, leave result in D
  1314. // Leave LHS in D; ends at bool-done882.
  1315. @2
  1316. D=A
  1317. // Move to lhs878
  1318. @lhs878
  1319. M=D
  1320. // Leave RHS in D.
  1321. @0
  1322. D=A
  1323. @rhs879
  1324. M=D
  1325. // Subtract LHS from RHS
  1326. @lhs878
  1327. D=M
  1328. @rhs879
  1329. // These instructions are prescient ... 20130308
  1330. A=M
  1331. D=A-D
  1332. @one881
  1333. // Jump and leave 1 in D if true.
  1334. D;JLT
  1335. @0
  1336. D=A
  1337. @bool-done882
  1338. 0;JMP
  1339. (one881)
  1340. @1
  1341. D=A
  1342. // Done with boolean op.
  1343. (bool-done882)
  1344. // If the result was zero, we jump to iffalse876
  1345. @iffalse876
  1346. D;JEQ
  1347. @4
  1348. D=A
  1349. @mullhs887
  1350. M=D
  1351. @8
  1352. D=A
  1353. @mulrhs888
  1354. M=D
  1355. // Set multctr885.
  1356. @mulrhs888
  1357. D=M
  1358. @multctr885
  1359. M=D
  1360. // Set mulsum886.
  1361. @0
  1362. D=A
  1363. @mulsum886
  1364. M=D
  1365. // Top of whiletop889
  1366. (whiletop889)
  1367. // Test; jump to whileend890 if zero.
  1368. // Leave LHS in D; ends at bool-done895.
  1369. @multctr885
  1370. D=M
  1371. // Move to lhs891
  1372. @lhs891
  1373. M=D
  1374. // Leave RHS in D.
  1375. @0
  1376. D=A
  1377. @rhs892
  1378. M=D
  1379. // Subtract LHS from RHS
  1380. @lhs891
  1381. D=M
  1382. @rhs892
  1383. // These instructions are prescient ... 20130308
  1384. A=M
  1385. D=A-D
  1386. @one894
  1387. // Jump and leave 1 in D if true.
  1388. D;JLT
  1389. @0
  1390. D=A
  1391. @bool-done895
  1392. 0;JMP
  1393. (one894)
  1394. @1
  1395. D=A
  1396. // Done with boolean op.
  1397. (bool-done895)
  1398. @whileend890
  1399. D;JEQ
  1400. // Run body of whiletop889.
  1401. // Set mulsum886.
  1402. @mulsum886
  1403. D=M
  1404. @lhs896
  1405. M=D
  1406. @mullhs887
  1407. D=M
  1408. @rhs897
  1409. M=D
  1410. // Stick LHS result lhs896 in D
  1411. @lhs896
  1412. D=M
  1413. // Stick RHS result rhs897 in A
  1414. @rhs897
  1415. A=M
  1416. D=D+A
  1417. @mulsum886
  1418. M=D
  1419. // Set multctr885.
  1420. @multctr885
  1421. D=M
  1422. @lhs898
  1423. M=D
  1424. @1
  1425. D=A
  1426. @rhs899
  1427. M=D
  1428. // Stick LHS result lhs898 in D
  1429. @lhs898
  1430. D=M
  1431. // Stick RHS result rhs899 in A
  1432. @rhs899
  1433. A=M
  1434. D=D-A
  1435. @multctr885
  1436. M=D
  1437. // Go to top of loop.
  1438. @whiletop889
  1439. 0;JMP
  1440. // End of whiletop889.
  1441. (whileend890)
  1442. @mulsum886
  1443. D=M
  1444. @lhs883
  1445. M=D
  1446. // Do test, leave result in D
  1447. // Leave LHS in D; ends at bool-done907.
  1448. @4
  1449. D=A
  1450. // Move to lhs903
  1451. @lhs903
  1452. M=D
  1453. // Leave RHS in D.
  1454. @6
  1455. D=A
  1456. @rhs904
  1457. M=D
  1458. // Subtract LHS from RHS
  1459. @lhs903
  1460. D=M
  1461. @rhs904
  1462. // These instructions are prescient ... 20130308
  1463. A=M
  1464. D=A-D
  1465. @one906
  1466. // Jump and leave 1 in D if true.
  1467. D;JLT
  1468. @0
  1469. D=A
  1470. @bool-done907
  1471. 0;JMP
  1472. (one906)
  1473. @1
  1474. D=A
  1475. // Done with boolean op.
  1476. (bool-done907)
  1477. // If the result was zero, we jump to iffalse901
  1478. @iffalse901
  1479. D;JEQ
  1480. @3
  1481. D=A
  1482. // Jump to the ifend902 when done with the true case.
  1483. @ifend902
  1484. 0;JMP
  1485. (iffalse901)
  1486. @6
  1487. D=A
  1488. (ifend902)
  1489. @rhs884
  1490. M=D
  1491. // Stick LHS result lhs883 in D
  1492. @lhs883
  1493. D=M
  1494. // Stick RHS result rhs884 in A
  1495. @rhs884
  1496. A=M
  1497. D=D+A
  1498. // Jump to the ifend877 when done with the true case.
  1499. @ifend877
  1500. 0;JMP
  1501. (iffalse876)
  1502. @0
  1503. D=A
  1504. @x65
  1505. M=D
  1506. @x65
  1507. D=M
  1508. @mullhs912
  1509. M=D
  1510. @x65
  1511. D=M
  1512. @mulrhs913
  1513. M=D
  1514. // Set multctr910.
  1515. @mulrhs913
  1516. D=M
  1517. @multctr910
  1518. M=D
  1519. // Set mulsum911.
  1520. @0
  1521. D=A
  1522. @mulsum911
  1523. M=D
  1524. // Top of whiletop914
  1525. (whiletop914)
  1526. // Test; jump to whileend915 if zero.
  1527. // Leave LHS in D; ends at bool-done920.
  1528. @multctr910
  1529. D=M
  1530. // Move to lhs916
  1531. @lhs916
  1532. M=D
  1533. // Leave RHS in D.
  1534. @0
  1535. D=A
  1536. @rhs917
  1537. M=D
  1538. // Subtract LHS from RHS
  1539. @lhs916
  1540. D=M
  1541. @rhs917
  1542. // These instructions are prescient ... 20130308
  1543. A=M
  1544. D=A-D
  1545. @one919
  1546. // Jump and leave 1 in D if true.
  1547. D;JLT
  1548. @0
  1549. D=A
  1550. @bool-done920
  1551. 0;JMP
  1552. (one919)
  1553. @1
  1554. D=A
  1555. // Done with boolean op.
  1556. (bool-done920)
  1557. @whileend915
  1558. D;JEQ
  1559. // Run body of whiletop914.
  1560. // Set mulsum911.
  1561. @mulsum911
  1562. D=M
  1563. @lhs921
  1564. M=D
  1565. @mullhs912
  1566. D=M
  1567. @rhs922
  1568. M=D
  1569. // Stick LHS result lhs921 in D
  1570. @lhs921
  1571. D=M
  1572. // Stick RHS result rhs922 in A
  1573. @rhs922
  1574. A=M
  1575. D=D+A
  1576. @mulsum911
  1577. M=D
  1578. // Set multctr910.
  1579. @multctr910
  1580. D=M
  1581. @lhs923
  1582. M=D
  1583. @1
  1584. D=A
  1585. @rhs924
  1586. M=D
  1587. // Stick LHS result lhs923 in D
  1588. @lhs923
  1589. D=M
  1590. // Stick RHS result rhs924 in A
  1591. @rhs924
  1592. A=M
  1593. D=D-A
  1594. @multctr910
  1595. M=D
  1596. // Go to top of loop.
  1597. @whiletop914
  1598. 0;JMP
  1599. // End of whiletop914.
  1600. (whileend915)
  1601. @mulsum911
  1602. D=M
  1603. @lhs908
  1604. M=D
  1605. @7
  1606. D=A
  1607. @mullhs927
  1608. M=D
  1609. @x65
  1610. D=M
  1611. @mulrhs928
  1612. M=D
  1613. // Set multctr925.
  1614. @mulrhs928
  1615. D=M
  1616. @multctr925
  1617. M=D
  1618. // Set mulsum926.
  1619. @0
  1620. D=A
  1621. @mulsum926
  1622. M=D
  1623. // Top of whiletop929
  1624. (whiletop929)
  1625. // Test; jump to whileend930 if zero.
  1626. // Leave LHS in D; ends at bool-done935.
  1627. @multctr925
  1628. D=M
  1629. // Move to lhs931
  1630. @lhs931
  1631. M=D
  1632. // Leave RHS in D.
  1633. @0
  1634. D=A
  1635. @rhs932
  1636. M=D
  1637. // Subtract LHS from RHS
  1638. @lhs931
  1639. D=M
  1640. @rhs932
  1641. // These instructions are prescient ... 20130308
  1642. A=M
  1643. D=A-D
  1644. @one934
  1645. // Jump and leave 1 in D if true.
  1646. D;JLT
  1647. @0
  1648. D=A
  1649. @bool-done935
  1650. 0;JMP
  1651. (one934)
  1652. @1
  1653. D=A
  1654. // Done with boolean op.
  1655. (bool-done935)
  1656. @whileend930
  1657. D;JEQ
  1658. // Run body of whiletop929.
  1659. // Set mulsum926.
  1660. @mulsum926
  1661. D=M
  1662. @lhs936
  1663. M=D
  1664. @mullhs927
  1665. D=M
  1666. @rhs937
  1667. M=D
  1668. // Stick LHS result lhs936 in D
  1669. @lhs936
  1670. D=M
  1671. // Stick RHS result rhs937 in A
  1672. @rhs937
  1673. A=M
  1674. D=D+A
  1675. @mulsum926
  1676. M=D
  1677. // Set multctr925.
  1678. @multctr925
  1679. D=M
  1680. @lhs938
  1681. M=D
  1682. @1
  1683. D=A
  1684. @rhs939
  1685. M=D
  1686. // Stick LHS result lhs938 in D
  1687. @lhs938
  1688. D=M
  1689. // Stick RHS result rhs939 in A
  1690. @rhs939
  1691. A=M
  1692. D=D-A
  1693. @multctr925
  1694. M=D
  1695. // Go to top of loop.
  1696. @whiletop929
  1697. 0;JMP
  1698. // End of whiletop929.
  1699. (whileend930)
  1700. @mulsum926
  1701. D=M
  1702. @rhs909
  1703. M=D
  1704. // Stick LHS result lhs908 in D
  1705. @lhs908
  1706. D=M
  1707. // Stick RHS result rhs909 in A
  1708. @rhs909
  1709. A=M
  1710. D=D+A
  1711. (ifend877)
  1712. @rhs858
  1713. M=D
  1714. // Stick LHS result lhs857 in D
  1715. @lhs857
  1716. D=M
  1717. // Stick RHS result rhs858 in A
  1718. @rhs858
  1719. A=M
  1720. D=D-A
  1721. (ifend659)
  1722. // Move D register to RAM[0] for final result.
  1723. @0
  1724. M=D
  1725. (ENDOFLINE)
  1726. @ENDOFLINE
  1727. 0;JMP