comparison clojure/com/aurellem/assembly.clj @ 120:d6f2a06cb128

finished Mode 1 of bootstrapping program
author Robert McIntyre <rlm@mit.edu>
date Fri, 16 Mar 2012 20:31:53 -0500
parents 6cbea8ab65b6
children 744de3427c05
comparison
equal deleted inserted replaced
119:6cbea8ab65b6 120:d6f2a06cb128
607 0x00 ;D385 ; unused 607 0x00 ;D385 ; unused
608 0x00 ;D386 ; unused 608 0x00 ;D386 ; unused
609 609
610 610
611 ;; banch on current mode 611 ;; banch on current mode
612 ;; mode 0 -- input-mode mode
613 ;; means that we are waiting for a mode, so set the mode to
614 ;; whatever is currently in input number. If nothing is
615 ;; entered, then the program stays in input-mode mode
616
617 0xFA ;D387 ; load current-mode (0xD382) 612 0xFA ;D387 ; load current-mode (0xD382)
618 0x82 ;D388 ; into A 613 0x82 ;D388 ; into A
619 0xD3 ;D389 614 0xD3 ;D389
620
621 0x00 ;D38A 615 0x00 ;D38A
622 616
617
618 ;; GOTO Mode 0 (input-mode) if current-mode is 0
623 0xFE ;D38B 619 0xFE ;D38B
624 0x00 ;D38C ; compare A with 0x00 620 0x00 ;D38C ; compare A with 0x00
625 621
626 ;; TODO make this jump non-absolute 622 0xCA ;D38D ; goto Mode 0 if A == 0
627
628 0xCA ;D38D ; GOTO Mode 0 if current-mode is 0
629 0xA8 ;D38E 623 0xA8 ;D38E
630 0xD3 ;D38F 624 0xD3 ;D38F
631 625
632 0x00 ;D390 626
633 0x00 ;D391 627 ;; GOTO Mode 1 (set-bytes) if current-mode is 1
634 0x00 ;D392 628 0xFE ;D390
635 0x00 ;D393 629 0x01 ;D391 ; compare A with 0x01
636 0x00 ;D394 630
631 0xCA ;D392
632 0xB1 ;D393
633 0xD3 ;D394 ; goto Mode 1 if A == 1
634
637 0x00 ;D395 635 0x00 ;D395
638 0x00 ;D396 636 0x00 ;D396
639 0x00 ;D397 637 0x00 ;D397
640 0x00 ;D398 638 0x00 ;D398
641 0x00 ;D399 639 0x00 ;D399
652 0x00 ;D3A4 650 0x00 ;D3A4
653 ;; End of Mode checking, goto beginning 651 ;; End of Mode checking, goto beginning
654 0xC3 ;D3A5 652 0xC3 ;D3A5
655 0x1D ;D3A6 653 0x1D ;D3A6
656 0xD3 ;D3A7 654 0xD3 ;D3A7
657 ;; Mode 0 655
656
657 ;; Mode 0 -- input-mode mode
658 ;; means that we are waiting for a mode, so set the mode to
659 ;; whatever is currently in input-number. If nothing is
660 ;; entered, then the program stays in input-mode mode
661
658 ;; set current-mode to input-number 662 ;; set current-mode to input-number
659 0xFA ;D3A8 ; load input-number (0xD352) 663 0xFA ;D3A8 ; load input-number (0xD352)
660 0x52 ;D3A9 ; into A 664 0x52 ;D3A9 ; into A
661 0xD3 ;D3AA 665 0xD3 ;D3AA
662 666
665 0xD3 ;D3AD 669 0xD3 ;D3AD
666 670
667 0xC3 ;D3AE ; go back to beginning 671 0xC3 ;D3AE ; go back to beginning
668 0x1D ;D3AF 672 0x1D ;D3AF
669 0xD3 ;D3B0 673 0xD3 ;D3B0
670 674 ;; End Mode 0
671 0x00 ;D3B1 675
672 0x00 ;D3B2 676
673 0x00 ;D3B3 677 ;; Mode 1 -- input bytes mode
674 0x00 ;D3B4 678 ;; This is the header for writing things to memory
675 0x00 ;D3B5 679 ;; specifies the number of bytes to write.
676 0x00 ;D3B6 680 ;; Mode is auto advanced to Mode 2 after this mode
677 0x00 ;D3B7 681 ;; completes.
678 0x00 ;D3B8 682
679 0x00 ;D3B9 683 ;; set bytes left to write to input-number,
680 0x00 ;D3BA 684 ;; set current-mode to 0x02.
681 0x00 ;D3BB 685 0xFA ;D3B1 ; load input-number (0xD352)
682 0x00 ;D3BC 686 0x52 ;D3B2 ; into A
683 0x00 ;D3BD 687 0xD3 ;D3B3
684 0x00 ;D3BE 688
689 0xEA ;D3B4 ; load A into bytes-left-to-write
690 0x83 ;D3B5 ; (0xD383)
691 0xD3 ;D3B6
692
693 0x3E ;D3B7 ; load 0x02 to A
694 0x02 ;D3B8
695
696 0xEA ;D3B9 ; load A to current-mode
697 0x82 ;D3BA ; advancing from Mode 1 to
698 0xD3 ;D3BB ; Mode 2
699
700 0xC3 ;D3BC ; go back to beginning
701 0x1D ;D3BD
702 0xD3 ;D3BE
703 ;; End Mode 1
704
685 0x00 ;D3BF 705 0x00 ;D3BF
686 0x00 ;D3C0 706 0x00 ;D3C0
687 0x00 ;D3C1 707 0x00 ;D3C1
688 0x00 ;D3C2 708 0x00 ;D3C2
689 0x00 ;D3C3 709 0x00 ;D3C3