PageRenderTime 47ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/test-011.asm

https://bitbucket.org/jadudm/eocs-assembler-test-generator
Assembly | 1043 lines | 1043 code | 0 blank | 0 comment | 13 complexity | ecac6e479edd2b9406c9e08603cec655 MD5 | raw file
  1. // Test 011
  2. // Source:
  3. //
  4. // (if (< 6 (- (let ((x37 5)) (+ x37 5)) (let ((x38 8)) (+ (if (> (* 8 x38) x38) (let ((x39 9)) (let ((x40 8)) (let ((x41 5)) x41))) (+ 9 8)) 2)))) (if (< (+ (+ (let ((x42 5)) (let ((x43 2)) 5)) (* 6 8)) 1) (let ((x44 5)) x44)) (if (> 6 (let ((x45 9)) x45)) (let ((x46 1)) (+ x46 (if (> 7 4) 4 7))) 5) (* (let ((x47 4)) x47) (+ (+ 3 7) (if (> 4 7) 1 7)))) (let ((x48 1)) (- (* (* (* 1 9) (- 0 x48)) (let ((x49 1)) (let ((x50 9)) (let ((x51 5)) 3)))) (let ((x52 0)) (let ((x53 7)) x48)))))
  5. //
  6. // Result (in RAM0): -28
  7. // Generated on 20130309 at 19:54.
  8. // -----------------------------------//
  9. // Do test, leave result in D
  10. // Leave LHS in D; ends at bool-done504.
  11. @6
  12. D=A
  13. // Move to lhs500
  14. @lhs500
  15. M=D
  16. // Leave RHS in D.
  17. @5
  18. D=A
  19. @x37
  20. M=D
  21. @x37
  22. D=M
  23. @lhs507
  24. M=D
  25. @5
  26. D=A
  27. @rhs508
  28. M=D
  29. // Stick LHS result lhs507 in D
  30. @lhs507
  31. D=M
  32. // Stick RHS result rhs508 in A
  33. @rhs508
  34. A=M
  35. D=D+A
  36. @lhs505
  37. M=D
  38. @8
  39. D=A
  40. @x38
  41. M=D
  42. // Do test, leave result in D
  43. // Leave LHS in D; ends at bool-done518.
  44. @8
  45. D=A
  46. @mullhs521
  47. M=D
  48. @x38
  49. D=M
  50. @mulrhs522
  51. M=D
  52. // Set multctr519.
  53. @mulrhs522
  54. D=M
  55. @multctr519
  56. M=D
  57. // Set mulsum520.
  58. @0
  59. D=A
  60. @mulsum520
  61. M=D
  62. // Top of whiletop523
  63. (whiletop523)
  64. // Test; jump to whileend524 if zero.
  65. // Leave LHS in D; ends at bool-done529.
  66. @multctr519
  67. D=M
  68. // Move to lhs525
  69. @lhs525
  70. M=D
  71. // Leave RHS in D.
  72. @0
  73. D=A
  74. @rhs526
  75. M=D
  76. // Subtract LHS from RHS
  77. @lhs525
  78. D=M
  79. @rhs526
  80. // These instructions are prescient ... 20130308
  81. A=M
  82. D=A-D
  83. @one528
  84. // Jump and leave 1 in D if true.
  85. D;JLT
  86. @0
  87. D=A
  88. @bool-done529
  89. 0;JMP
  90. (one528)
  91. @1
  92. D=A
  93. // Done with boolean op.
  94. (bool-done529)
  95. @whileend524
  96. D;JEQ
  97. // Run body of whiletop523.
  98. // Set mulsum520.
  99. @mulsum520
  100. D=M
  101. @lhs530
  102. M=D
  103. @mullhs521
  104. D=M
  105. @rhs531
  106. M=D
  107. // Stick LHS result lhs530 in D
  108. @lhs530
  109. D=M
  110. // Stick RHS result rhs531 in A
  111. @rhs531
  112. A=M
  113. D=D+A
  114. @mulsum520
  115. M=D
  116. // Set multctr519.
  117. @multctr519
  118. D=M
  119. @lhs532
  120. M=D
  121. @1
  122. D=A
  123. @rhs533
  124. M=D
  125. // Stick LHS result lhs532 in D
  126. @lhs532
  127. D=M
  128. // Stick RHS result rhs533 in A
  129. @rhs533
  130. A=M
  131. D=D-A
  132. @multctr519
  133. M=D
  134. // Go to top of loop.
  135. @whiletop523
  136. 0;JMP
  137. // End of whiletop523.
  138. (whileend524)
  139. @mulsum520
  140. D=M
  141. // Move to lhs514
  142. @lhs514
  143. M=D
  144. // Leave RHS in D.
  145. @x38
  146. D=M
  147. @rhs515
  148. M=D
  149. // Subtract LHS from RHS
  150. @lhs514
  151. D=M
  152. @rhs515
  153. // These instructions are prescient ... 20130308
  154. A=M
  155. D=A-D
  156. @one517
  157. // Jump and leave 1 in D if true.
  158. D;JLT
  159. @0
  160. D=A
  161. @bool-done518
  162. 0;JMP
  163. (one517)
  164. @1
  165. D=A
  166. // Done with boolean op.
  167. (bool-done518)
  168. // If the result was zero, we jump to iffalse512
  169. @iffalse512
  170. D;JEQ
  171. @9
  172. D=A
  173. @x39
  174. M=D
  175. @8
  176. D=A
  177. @x40
  178. M=D
  179. @5
  180. D=A
  181. @x41
  182. M=D
  183. @x41
  184. D=M
  185. // Jump to the ifend513 when done with the true case.
  186. @ifend513
  187. 0;JMP
  188. (iffalse512)
  189. @9
  190. D=A
  191. @lhs534
  192. M=D
  193. @8
  194. D=A
  195. @rhs535
  196. M=D
  197. // Stick LHS result lhs534 in D
  198. @lhs534
  199. D=M
  200. // Stick RHS result rhs535 in A
  201. @rhs535
  202. A=M
  203. D=D+A
  204. (ifend513)
  205. @lhs509
  206. M=D
  207. @2
  208. D=A
  209. @rhs510
  210. M=D
  211. // Stick LHS result lhs509 in D
  212. @lhs509
  213. D=M
  214. // Stick RHS result rhs510 in A
  215. @rhs510
  216. A=M
  217. D=D+A
  218. @rhs506
  219. M=D
  220. // Stick LHS result lhs505 in D
  221. @lhs505
  222. D=M
  223. // Stick RHS result rhs506 in A
  224. @rhs506
  225. A=M
  226. D=D-A
  227. @rhs501
  228. M=D
  229. // Subtract LHS from RHS
  230. @lhs500
  231. D=M
  232. @rhs501
  233. // These instructions are prescient ... 20130308
  234. A=M
  235. D=A-D
  236. @one503
  237. // Jump and leave 1 in D if true.
  238. D;JGT
  239. @0
  240. D=A
  241. @bool-done504
  242. 0;JMP
  243. (one503)
  244. @1
  245. D=A
  246. // Done with boolean op.
  247. (bool-done504)
  248. // If the result was zero, we jump to iffalse498
  249. @iffalse498
  250. D;JEQ
  251. // Do test, leave result in D
  252. // Leave LHS in D; ends at bool-done543.
  253. @5
  254. D=A
  255. @x42
  256. M=D
  257. @2
  258. D=A
  259. @x43
  260. M=D
  261. @5
  262. D=A
  263. @lhs546
  264. M=D
  265. @6
  266. D=A
  267. @mullhs550
  268. M=D
  269. @8
  270. D=A
  271. @mulrhs551
  272. M=D
  273. // Set multctr548.
  274. @mulrhs551
  275. D=M
  276. @multctr548
  277. M=D
  278. // Set mulsum549.
  279. @0
  280. D=A
  281. @mulsum549
  282. M=D
  283. // Top of whiletop552
  284. (whiletop552)
  285. // Test; jump to whileend553 if zero.
  286. // Leave LHS in D; ends at bool-done558.
  287. @multctr548
  288. D=M
  289. // Move to lhs554
  290. @lhs554
  291. M=D
  292. // Leave RHS in D.
  293. @0
  294. D=A
  295. @rhs555
  296. M=D
  297. // Subtract LHS from RHS
  298. @lhs554
  299. D=M
  300. @rhs555
  301. // These instructions are prescient ... 20130308
  302. A=M
  303. D=A-D
  304. @one557
  305. // Jump and leave 1 in D if true.
  306. D;JLT
  307. @0
  308. D=A
  309. @bool-done558
  310. 0;JMP
  311. (one557)
  312. @1
  313. D=A
  314. // Done with boolean op.
  315. (bool-done558)
  316. @whileend553
  317. D;JEQ
  318. // Run body of whiletop552.
  319. // Set mulsum549.
  320. @mulsum549
  321. D=M
  322. @lhs559
  323. M=D
  324. @mullhs550
  325. D=M
  326. @rhs560
  327. M=D
  328. // Stick LHS result lhs559 in D
  329. @lhs559
  330. D=M
  331. // Stick RHS result rhs560 in A
  332. @rhs560
  333. A=M
  334. D=D+A
  335. @mulsum549
  336. M=D
  337. // Set multctr548.
  338. @multctr548
  339. D=M
  340. @lhs561
  341. M=D
  342. @1
  343. D=A
  344. @rhs562
  345. M=D
  346. // Stick LHS result lhs561 in D
  347. @lhs561
  348. D=M
  349. // Stick RHS result rhs562 in A
  350. @rhs562
  351. A=M
  352. D=D-A
  353. @multctr548
  354. M=D
  355. // Go to top of loop.
  356. @whiletop552
  357. 0;JMP
  358. // End of whiletop552.
  359. (whileend553)
  360. @mulsum549
  361. D=M
  362. @rhs547
  363. M=D
  364. // Stick LHS result lhs546 in D
  365. @lhs546
  366. D=M
  367. // Stick RHS result rhs547 in A
  368. @rhs547
  369. A=M
  370. D=D+A
  371. @lhs544
  372. M=D
  373. @1
  374. D=A
  375. @rhs545
  376. M=D
  377. // Stick LHS result lhs544 in D
  378. @lhs544
  379. D=M
  380. // Stick RHS result rhs545 in A
  381. @rhs545
  382. A=M
  383. D=D+A
  384. // Move to lhs539
  385. @lhs539
  386. M=D
  387. // Leave RHS in D.
  388. @5
  389. D=A
  390. @x44
  391. M=D
  392. @x44
  393. D=M
  394. @rhs540
  395. M=D
  396. // Subtract LHS from RHS
  397. @lhs539
  398. D=M
  399. @rhs540
  400. // These instructions are prescient ... 20130308
  401. A=M
  402. D=A-D
  403. @one542
  404. // Jump and leave 1 in D if true.
  405. D;JGT
  406. @0
  407. D=A
  408. @bool-done543
  409. 0;JMP
  410. (one542)
  411. @1
  412. D=A
  413. // Done with boolean op.
  414. (bool-done543)
  415. // If the result was zero, we jump to iffalse537
  416. @iffalse537
  417. D;JEQ
  418. // Do test, leave result in D
  419. // Leave LHS in D; ends at bool-done570.
  420. @6
  421. D=A
  422. // Move to lhs566
  423. @lhs566
  424. M=D
  425. // Leave RHS in D.
  426. @9
  427. D=A
  428. @x45
  429. M=D
  430. @x45
  431. D=M
  432. @rhs567
  433. M=D
  434. // Subtract LHS from RHS
  435. @lhs566
  436. D=M
  437. @rhs567
  438. // These instructions are prescient ... 20130308
  439. A=M
  440. D=A-D
  441. @one569
  442. // Jump and leave 1 in D if true.
  443. D;JLT
  444. @0
  445. D=A
  446. @bool-done570
  447. 0;JMP
  448. (one569)
  449. @1
  450. D=A
  451. // Done with boolean op.
  452. (bool-done570)
  453. // If the result was zero, we jump to iffalse564
  454. @iffalse564
  455. D;JEQ
  456. @1
  457. D=A
  458. @x46
  459. M=D
  460. @x46
  461. D=M
  462. @lhs571
  463. M=D
  464. // Do test, leave result in D
  465. // Leave LHS in D; ends at bool-done580.
  466. @7
  467. D=A
  468. // Move to lhs576
  469. @lhs576
  470. M=D
  471. // Leave RHS in D.
  472. @4
  473. D=A
  474. @rhs577
  475. M=D
  476. // Subtract LHS from RHS
  477. @lhs576
  478. D=M
  479. @rhs577
  480. // These instructions are prescient ... 20130308
  481. A=M
  482. D=A-D
  483. @one579
  484. // Jump and leave 1 in D if true.
  485. D;JLT
  486. @0
  487. D=A
  488. @bool-done580
  489. 0;JMP
  490. (one579)
  491. @1
  492. D=A
  493. // Done with boolean op.
  494. (bool-done580)
  495. // If the result was zero, we jump to iffalse574
  496. @iffalse574
  497. D;JEQ
  498. @4
  499. D=A
  500. // Jump to the ifend575 when done with the true case.
  501. @ifend575
  502. 0;JMP
  503. (iffalse574)
  504. @7
  505. D=A
  506. (ifend575)
  507. @rhs572
  508. M=D
  509. // Stick LHS result lhs571 in D
  510. @lhs571
  511. D=M
  512. // Stick RHS result rhs572 in A
  513. @rhs572
  514. A=M
  515. D=D+A
  516. // Jump to the ifend565 when done with the true case.
  517. @ifend565
  518. 0;JMP
  519. (iffalse564)
  520. @5
  521. D=A
  522. (ifend565)
  523. // Jump to the ifend538 when done with the true case.
  524. @ifend538
  525. 0;JMP
  526. (iffalse537)
  527. @4
  528. D=A
  529. @x47
  530. M=D
  531. @x47
  532. D=M
  533. @mullhs583
  534. M=D
  535. @3
  536. D=A
  537. @lhs587
  538. M=D
  539. @7
  540. D=A
  541. @rhs588
  542. M=D
  543. // Stick LHS result lhs587 in D
  544. @lhs587
  545. D=M
  546. // Stick RHS result rhs588 in A
  547. @rhs588
  548. A=M
  549. D=D+A
  550. @lhs585
  551. M=D
  552. // Do test, leave result in D
  553. // Leave LHS in D; ends at bool-done596.
  554. @4
  555. D=A
  556. // Move to lhs592
  557. @lhs592
  558. M=D
  559. // Leave RHS in D.
  560. @7
  561. D=A
  562. @rhs593
  563. M=D
  564. // Subtract LHS from RHS
  565. @lhs592
  566. D=M
  567. @rhs593
  568. // These instructions are prescient ... 20130308
  569. A=M
  570. D=A-D
  571. @one595
  572. // Jump and leave 1 in D if true.
  573. D;JLT
  574. @0
  575. D=A
  576. @bool-done596
  577. 0;JMP
  578. (one595)
  579. @1
  580. D=A
  581. // Done with boolean op.
  582. (bool-done596)
  583. // If the result was zero, we jump to iffalse590
  584. @iffalse590
  585. D;JEQ
  586. @1
  587. D=A
  588. // Jump to the ifend591 when done with the true case.
  589. @ifend591
  590. 0;JMP
  591. (iffalse590)
  592. @7
  593. D=A
  594. (ifend591)
  595. @rhs586
  596. M=D
  597. // Stick LHS result lhs585 in D
  598. @lhs585
  599. D=M
  600. // Stick RHS result rhs586 in A
  601. @rhs586
  602. A=M
  603. D=D+A
  604. @mulrhs584
  605. M=D
  606. // Set multctr581.
  607. @mulrhs584
  608. D=M
  609. @multctr581
  610. M=D
  611. // Set mulsum582.
  612. @0
  613. D=A
  614. @mulsum582
  615. M=D
  616. // Top of whiletop597
  617. (whiletop597)
  618. // Test; jump to whileend598 if zero.
  619. // Leave LHS in D; ends at bool-done603.
  620. @multctr581
  621. D=M
  622. // Move to lhs599
  623. @lhs599
  624. M=D
  625. // Leave RHS in D.
  626. @0
  627. D=A
  628. @rhs600
  629. M=D
  630. // Subtract LHS from RHS
  631. @lhs599
  632. D=M
  633. @rhs600
  634. // These instructions are prescient ... 20130308
  635. A=M
  636. D=A-D
  637. @one602
  638. // Jump and leave 1 in D if true.
  639. D;JLT
  640. @0
  641. D=A
  642. @bool-done603
  643. 0;JMP
  644. (one602)
  645. @1
  646. D=A
  647. // Done with boolean op.
  648. (bool-done603)
  649. @whileend598
  650. D;JEQ
  651. // Run body of whiletop597.
  652. // Set mulsum582.
  653. @mulsum582
  654. D=M
  655. @lhs604
  656. M=D
  657. @mullhs583
  658. D=M
  659. @rhs605
  660. M=D
  661. // Stick LHS result lhs604 in D
  662. @lhs604
  663. D=M
  664. // Stick RHS result rhs605 in A
  665. @rhs605
  666. A=M
  667. D=D+A
  668. @mulsum582
  669. M=D
  670. // Set multctr581.
  671. @multctr581
  672. D=M
  673. @lhs606
  674. M=D
  675. @1
  676. D=A
  677. @rhs607
  678. M=D
  679. // Stick LHS result lhs606 in D
  680. @lhs606
  681. D=M
  682. // Stick RHS result rhs607 in A
  683. @rhs607
  684. A=M
  685. D=D-A
  686. @multctr581
  687. M=D
  688. // Go to top of loop.
  689. @whiletop597
  690. 0;JMP
  691. // End of whiletop597.
  692. (whileend598)
  693. @mulsum582
  694. D=M
  695. (ifend538)
  696. // Jump to the ifend499 when done with the true case.
  697. @ifend499
  698. 0;JMP
  699. (iffalse498)
  700. @1
  701. D=A
  702. @x48
  703. M=D
  704. @1
  705. D=A
  706. @mullhs620
  707. M=D
  708. @9
  709. D=A
  710. @mulrhs621
  711. M=D
  712. // Set multctr618.
  713. @mulrhs621
  714. D=M
  715. @multctr618
  716. M=D
  717. // Set mulsum619.
  718. @0
  719. D=A
  720. @mulsum619
  721. M=D
  722. // Top of whiletop622
  723. (whiletop622)
  724. // Test; jump to whileend623 if zero.
  725. // Leave LHS in D; ends at bool-done628.
  726. @multctr618
  727. D=M
  728. // Move to lhs624
  729. @lhs624
  730. M=D
  731. // Leave RHS in D.
  732. @0
  733. D=A
  734. @rhs625
  735. M=D
  736. // Subtract LHS from RHS
  737. @lhs624
  738. D=M
  739. @rhs625
  740. // These instructions are prescient ... 20130308
  741. A=M
  742. D=A-D
  743. @one627
  744. // Jump and leave 1 in D if true.
  745. D;JLT
  746. @0
  747. D=A
  748. @bool-done628
  749. 0;JMP
  750. (one627)
  751. @1
  752. D=A
  753. // Done with boolean op.
  754. (bool-done628)
  755. @whileend623
  756. D;JEQ
  757. // Run body of whiletop622.
  758. // Set mulsum619.
  759. @mulsum619
  760. D=M
  761. @lhs629
  762. M=D
  763. @mullhs620
  764. D=M
  765. @rhs630
  766. M=D
  767. // Stick LHS result lhs629 in D
  768. @lhs629
  769. D=M
  770. // Stick RHS result rhs630 in A
  771. @rhs630
  772. A=M
  773. D=D+A
  774. @mulsum619
  775. M=D
  776. // Set multctr618.
  777. @multctr618
  778. D=M
  779. @lhs631
  780. M=D
  781. @1
  782. D=A
  783. @rhs632
  784. M=D
  785. // Stick LHS result lhs631 in D
  786. @lhs631
  787. D=M
  788. // Stick RHS result rhs632 in A
  789. @rhs632
  790. A=M
  791. D=D-A
  792. @multctr618
  793. M=D
  794. // Go to top of loop.
  795. @whiletop622
  796. 0;JMP
  797. // End of whiletop622.
  798. (whileend623)
  799. @mulsum619
  800. D=M
  801. @mullhs616
  802. M=D
  803. @0
  804. D=A
  805. @lhs633
  806. M=D
  807. @x48
  808. D=M
  809. @rhs634
  810. M=D
  811. // Stick LHS result lhs633 in D
  812. @lhs633
  813. D=M
  814. // Stick RHS result rhs634 in A
  815. @rhs634
  816. A=M
  817. D=D-A
  818. @mulrhs617
  819. M=D
  820. // Set multctr614.
  821. @mulrhs617
  822. D=M
  823. @multctr614
  824. M=D
  825. // Set mulsum615.
  826. @0
  827. D=A
  828. @mulsum615
  829. M=D
  830. // Top of whiletop635
  831. (whiletop635)
  832. // Test; jump to whileend636 if zero.
  833. // Leave LHS in D; ends at bool-done641.
  834. @multctr614
  835. D=M
  836. // Move to lhs637
  837. @lhs637
  838. M=D
  839. // Leave RHS in D.
  840. @0
  841. D=A
  842. @rhs638
  843. M=D
  844. // Subtract LHS from RHS
  845. @lhs637
  846. D=M
  847. @rhs638
  848. // These instructions are prescient ... 20130308
  849. A=M
  850. D=A-D
  851. @one640
  852. // Jump and leave 1 in D if true.
  853. D;JLT
  854. @0
  855. D=A
  856. @bool-done641
  857. 0;JMP
  858. (one640)
  859. @1
  860. D=A
  861. // Done with boolean op.
  862. (bool-done641)
  863. @whileend636
  864. D;JEQ
  865. // Run body of whiletop635.
  866. // Set mulsum615.
  867. @mulsum615
  868. D=M
  869. @lhs642
  870. M=D
  871. @mullhs616
  872. D=M
  873. @rhs643
  874. M=D
  875. // Stick LHS result lhs642 in D
  876. @lhs642
  877. D=M
  878. // Stick RHS result rhs643 in A
  879. @rhs643
  880. A=M
  881. D=D+A
  882. @mulsum615
  883. M=D
  884. // Set multctr614.
  885. @multctr614
  886. D=M
  887. @lhs644
  888. M=D
  889. @1
  890. D=A
  891. @rhs645
  892. M=D
  893. // Stick LHS result lhs644 in D
  894. @lhs644
  895. D=M
  896. // Stick RHS result rhs645 in A
  897. @rhs645
  898. A=M
  899. D=D-A
  900. @multctr614
  901. M=D
  902. // Go to top of loop.
  903. @whiletop635
  904. 0;JMP
  905. // End of whiletop635.
  906. (whileend636)
  907. @mulsum615
  908. D=M
  909. @mullhs612
  910. M=D
  911. @1
  912. D=A
  913. @x49
  914. M=D
  915. @9
  916. D=A
  917. @x50
  918. M=D
  919. @5
  920. D=A
  921. @x51
  922. M=D
  923. @3
  924. D=A
  925. @mulrhs613
  926. M=D
  927. // Set multctr610.
  928. @mulrhs613
  929. D=M
  930. @multctr610
  931. M=D
  932. // Set mulsum611.
  933. @0
  934. D=A
  935. @mulsum611
  936. M=D
  937. // Top of whiletop646
  938. (whiletop646)
  939. // Test; jump to whileend647 if zero.
  940. // Leave LHS in D; ends at bool-done652.
  941. @multctr610
  942. D=M
  943. // Move to lhs648
  944. @lhs648
  945. M=D
  946. // Leave RHS in D.
  947. @0
  948. D=A
  949. @rhs649
  950. M=D
  951. // Subtract LHS from RHS
  952. @lhs648
  953. D=M
  954. @rhs649
  955. // These instructions are prescient ... 20130308
  956. A=M
  957. D=A-D
  958. @one651
  959. // Jump and leave 1 in D if true.
  960. D;JLT
  961. @0
  962. D=A
  963. @bool-done652
  964. 0;JMP
  965. (one651)
  966. @1
  967. D=A
  968. // Done with boolean op.
  969. (bool-done652)
  970. @whileend647
  971. D;JEQ
  972. // Run body of whiletop646.
  973. // Set mulsum611.
  974. @mulsum611
  975. D=M
  976. @lhs653
  977. M=D
  978. @mullhs612
  979. D=M
  980. @rhs654
  981. M=D
  982. // Stick LHS result lhs653 in D
  983. @lhs653
  984. D=M
  985. // Stick RHS result rhs654 in A
  986. @rhs654
  987. A=M
  988. D=D+A
  989. @mulsum611
  990. M=D
  991. // Set multctr610.
  992. @multctr610
  993. D=M
  994. @lhs655
  995. M=D
  996. @1
  997. D=A
  998. @rhs656
  999. M=D
  1000. // Stick LHS result lhs655 in D
  1001. @lhs655
  1002. D=M
  1003. // Stick RHS result rhs656 in A
  1004. @rhs656
  1005. A=M
  1006. D=D-A
  1007. @multctr610
  1008. M=D
  1009. // Go to top of loop.
  1010. @whiletop646
  1011. 0;JMP
  1012. // End of whiletop646.
  1013. (whileend647)
  1014. @mulsum611
  1015. D=M
  1016. @lhs608
  1017. M=D
  1018. @0
  1019. D=A
  1020. @x52
  1021. M=D
  1022. @7
  1023. D=A
  1024. @x53
  1025. M=D
  1026. @x48
  1027. D=M
  1028. @rhs609
  1029. M=D
  1030. // Stick LHS result lhs608 in D
  1031. @lhs608
  1032. D=M
  1033. // Stick RHS result rhs609 in A
  1034. @rhs609
  1035. A=M
  1036. D=D-A
  1037. (ifend499)
  1038. // Move D register to RAM[0] for final result.
  1039. @0
  1040. M=D
  1041. (ENDOFLINE)
  1042. @ENDOFLINE
  1043. 0;JMP