comparison clojure/com/aurellem/assembly.clj @ 137:1c58fa3cfc68

Checkpoint: about to include the state machine in the assembly* code.
author Dylan Holmes <ocsenave@gmail.com>
date Sun, 18 Mar 2012 20:49:40 -0500
parents ffeeabae7dcd
children 2b69cbe8a5b9
comparison
equal deleted inserted replaced
136:ffeeabae7dcd 137:1c58fa3cfc68
529 529
530 0xCB ;test C_0 530 0xCB ;test C_0
531 0x41 531 0x41
532 0x20 ; JUMP ahead to button input if nonzero 532 0x20 ; JUMP ahead to button input if nonzero
533 0x03 533 0x03
534 0x18 ; JUMP back to beginning 534 0x18 ; JUMP back to frame metronome (D31E)
535 0xE7 535 0xE7
536 536
537 ;; -------- GET BUTTON INPUT 537 ;; -------- GET BUTTON INPUT
538 0x00 ;; var: which-input D336 538
539 ;; btw, C_0 is now 1
540 0x00 ;; var: which-input D337
539 ;; prepare to select bits 541 ;; prepare to select bits
540 542
541 0x01 ;; load 0x0000 into BC 543 0x06 ;; load 0x00 into B
542 0x00
543 0x00 544 0x00
544 545
545 0x3E ;; load 0x20 into A 546 0x3E ;; load 0x20 into A, to measure dpad
546 0x20 547 0x20
547 548
548 549
549 0xEA ;; load A into [FF00] ;; D33D 550 0xE0 ;; load A into [FF00] ;; D33C
550 0x00 551 0x00
551 0xFF 552
552 553 0xF0 ;; load A from [FF00]
553 0xFA ;; load A from [FF00]
554 0x00 554 0x00
555 0xFF
556 555
557 0xE6 ;; bitmask 00001111 556 0xE6 ;; bitmask 00001111
558 0x0F 557 0x0F
559 558
560 0xB0 ;; A or B --> A 559 0xB0 ;; A or B --> A
561
562 0xCB 560 0xCB
563 0x41 ;; test bit 0 of C 561 0x41 ;; test bit 0 of C
564 0x20 ;; JUMP forward if 1 562 0x28 ;; JUMP forward if 0
565 0x08 563 0x08
566 564
567 0x47 ;; A -> B 565 0x47 ;; A -> B
568 0xCB ;; swap B nybbles 566 0xCB ;; swap B nybbles
569 0x30 567 0x30
570 0x0C ;; increment C 568 0x0C ;; increment C
571 0x3E ;; load 0x10 into A 569 0x3E ;; load 0x10 into A, to measure btns
572 0x10 570 0x10
573 0x18 ;; JUMP back to "load A into [FF00]" [20 steps?] 571 0x18 ;; JUMP back to "load A into [FF00]" [20 steps?]
574 0xEB 572 0xED
575 573
576 ;; now A contains the pressed keys 574 ;; now A contains the pressed keys
577 0xEA ;; copy keys to input-number [D336] 575
578 0x39 576
577
578
579
580
581
582
583 0xC3 ;; todo replace with relative jump
584 0x1E
579 0xD3 585 0xD3
580 0x18 ;;JUMP back to "beginning" [D31E] 586 ;;0x18 ;;JUMP back to "metronome" in one hop [D31E]
581 0xC7 587 ;;0xCA ;; E1
582
583 588
584 ] 589 ]
585 ) 590 )
586 591
587 (defn write-mem-dyl [] 592 (defn write-mem-dyl []