comparison clojure/com/aurellem/assembly.clj @ 129:5e4feb77f2d8

removed literal 0xFFs from assembly code since they interfere with the item-list.
author Robert McIntyre <rlm@mit.edu>
date Sat, 17 Mar 2012 19:25:38 -0500
parents 203d64e16156
children 69f241de436d
comparison
equal deleted inserted replaced
128:203d64e16156 129:5e4feb77f2d8
561 (inject-item-assembly (write-memory-assembly*)))) 561 (inject-item-assembly (write-memory-assembly*))))
562 562
563 563
564 564
565 (defn write-memory-assembly [] 565 (defn write-memory-assembly []
566 [ 566 [
567 ;; Main Timing Loop 567 ;; Main Timing Loop
568 ;; Constantly check for v-blank and Trigger main state machine on 568 ;; Constantly check for v-blank and Trigger main state machine on
569 ;; every transtion from v-blank to non-v-blank. 569 ;; every transtion from v-blank to non-v-blank.
570 570
571 0x18 ; D31D ; Variable declaration 571 0x18 ; D31D ; Variable declaration
572 0x02 ; D31E 572 0x02 ; D31E
573 0x00 ; D31F ; frame-count 573 0x00 ; D31F ; frame-count
574 0x00 ; D320 ; v-blank-prev 574 0x00 ; D320 ; v-blank-prev
575 575
576 0xFA ; D321 ; load v-blank mode flags into A 576 0xF0 ; D321 ; load v-blank mode flags into A
577 0x41 ; D322 577 0x41
578 0xFF ; D323 578 0x00
579
579 580
580 ;; Branch dependent on v-blank. v-blank happens when the last two 581 ;; Branch dependent on v-blank. v-blank happens when the last two
581 ;; bits in A are "01" 582 ;; bits in A are "01"
582 0xCB ; D324 583 0xCB ; D324
583 0x4F ; D325 584 0x4F ; D325
666 667
667 0xFA ;D353 ; load (D350) into A 668 0xFA ;D353 ; load (D350) into A
668 0x50 ;D354 --> 669 0x50 ;D354 -->
669 0xD3 ;D355 --> D350 670 0xD3 ;D355 --> D350
670 671
671 0xEA ;D356 ; load (A), which is 672 0xE0 ;D356 ; load (A), which is
672 0x00 ;D357 --> ; 00010000, into FF00 673 0x00 ;D357 --> ; 00010000, into FF00
673 0xFF ;D358 --> FF00 674 0x00 ;D358 --> FF00 ;; NO-OP
674 675
675 0x06 ;D359 676 0x06 ;D359
676 ;D35A 677 ;D35A
677 (Integer/parseInt "11110000" 2) ; "11110000" -> B 678 (Integer/parseInt "11110000" 2) ; "11110000" -> B
678 0xFA ;D35B ; (FF00) -> A 679 0xF0 ;D35B ; (FF00) -> A
679 0x00 ;D35C 680 0x00 ;D35C
680 0xFF ;D35D 681 0x00 ;D35D ;; NO-OP
681 682
682 0xCB ;D35E ; swap nybbles on A 683 0xCB ;D35E ; swap nybbles on A
683 0x37 ;D35F 684 0x37 ;D35F
684 0xA0 ;D360 ; (AND A B) -> A 685 0xA0 ;D360 ; (AND A B) -> A
685 0x47 ;D361 ; A -> B 686 0x47 ;D361 ; A -> B
688 689
689 0xFA ;D362 ; load (D351) into A 690 0xFA ;D362 ; load (D351) into A
690 0x51 ;D363 --> 691 0x51 ;D363 -->
691 0xD3 ;D364 --> D351 692 0xD3 ;D364 --> D351
692 693
693 0xEA ;D365 ; load (A), which is 694 0xE0 ;D365 ; load (A), which is
694 0x00 ;D366 --> ; 00001000, into FF00 695 0x00 ;D366 --> ; 00001000, into FF00
695 0xFF ;D367 --> FF00 696 0x00 ;D367 --> FF00 ;; NO-OP
696 697
697 0x0E ;D368 698 0x0E ;D368
698 ;D369 699 ;D369
699 (Integer/parseInt "00001111" 2) ; "00001111" -> C 700 (Integer/parseInt "00001111" 2) ; "00001111" -> C
700 701
701 0xFA ;D36A ; (FF00) -> A 702 0xF0 ;D36A ; (FF00) -> A
702 0x00 ;D36B 703 0x00 ;D36B
703 0xFF ;D36C 704 0x00 ;D36C
704 705
705 0xA1 ;D36D ; (AND A C) -> A 706 0xA1 ;D36D ; (AND A C) -> A
706 0x4F ;D36E ; A -> C 707 0x4F ;D36E ; A -> C
707 708
708 ;; combine the B and C registers into the input number 709 ;; combine the B and C registers into the input number