comparison clojure/com/aurellem/assembly.clj @ 136:ffeeabae7dcd

minor tweaking; incremental results: 91 -> 58
author Dylan Holmes <ocsenave@gmail.com>
date Sun, 18 Mar 2012 05:53:25 -0500
parents eb6ba88088d3
children 1c58fa3cfc68
comparison
equal deleted inserted replaced
135:eb6ba88088d3 136:ffeeabae7dcd
490 490
491 491
492 492
493 493
494 494
495 (defn write-memory-assembly* [] 495 (defn write-memory-assembly*
496 "Currently, grabs input from the user each frame."
497 []
496 [ 498 [
497 ;; --------- FRAME METRONOME 499 ;; --------- FRAME METRONOME
498 500 0x00 ;; v-blank-prev D31D
499 0x18 ;; D31D
500 0x01
501 0x00 ;; v-blank-prev D31F
502 501
503 0xFA ;; load modes into A 502 0xFA ;; load modes into A
504 0x41 503 0x41
505 0xFF 504 0xFF
506 505
511 510
512 0xA0 511 0xA0
513 0x47 ;; now B_0 contains (VB==1) 512 0x47 ;; now B_0 contains (VB==1)
514 513
515 0xFA ;; load v-blank-prev 514 0xFA ;; load v-blank-prev
516 0x1F 515 0x1D
517 0xD3 516 0xD3
518 517
519 0x2F ;; complement v-blank-prev 518 0x2F ;; complement v-blank-prev
520 519
521 0xA0 ;; A & B --> A 520 0xA0 ;; A & B --> A
523 522
524 523
525 0x78 ;; B->A 524 0x78 ;; B->A
526 525
527 0xEA ;; spit A --> vbprev 526 0xEA ;; spit A --> vbprev
528 0x1F 527 0x1D
529 0xD3 528 0xD3
530 529
531 0x41 ;test C_0 530 0xCB ;test C_0
532 0x20 ; nonzero jump 531 0x41
533 0x04 532 0x20 ; JUMP ahead to button input if nonzero
534 533 0x03
535 0xC3 ; ; go back to beginning 534 0x18 ; JUMP back to beginning
536 0x1D ; 535 0xE7
537 0xD3 ;
538 536
539 ;; -------- GET BUTTON INPUT 537 ;; -------- GET BUTTON INPUT
540 0x00 ;; var: which-input D339 538 0x00 ;; var: which-input D336
541 ;; prepare to select bits 539 ;; prepare to select bits
542 540
543 0x01 ;; load 0x0000 into BC 541 0x01 ;; load 0x0000 into BC
544 0x00 542 0x00
545 0x00 543 0x00
546 544
547 0x3E ;; load 0x20 into A 545 0x3E ;; load 0x20 into A
548 0x20 546 0x20
549 547
550 548
551 0xEA ;; load A into [FF00] ;; D33F (not D33C) 549 0xEA ;; load A into [FF00] ;; D33D
552 0x00 550 0x00
553 0xFF 551 0xFF
554 552
555 0xFA ;; load A from [FF00] 553 0xFA ;; load A from [FF00]
556 0x00 554 0x00
561 559
562 0xB0 ;; A or B --> A 560 0xB0 ;; A or B --> A
563 561
564 0xCB 562 0xCB
565 0x41 ;; test bit 0 of C 563 0x41 ;; test bit 0 of C
566 0x20 ;; jump forward if 1 564 0x20 ;; JUMP forward if 1
567 0x08 565 0x08
568 566
569 0x47 ;; A -> B 567 0x47 ;; A -> B
570 0xCB ;; swap B nybbles 568 0xCB ;; swap B nybbles
571 0x30 569 0x30
574 0x10 572 0x10
575 0x18 ;; JUMP back to "load A into [FF00]" [20 steps?] 573 0x18 ;; JUMP back to "load A into [FF00]" [20 steps?]
576 0xEB 574 0xEB
577 575
578 ;; now A contains the pressed keys 576 ;; now A contains the pressed keys
579 0xEA ;; copy keys to input-number [D339] 577 0xEA ;; copy keys to input-number [D336]
580 0x39 578 0x39
581 0xD3 579 0xD3
582 0x18 ;; 580 0x18 ;;JUMP back to "beginning" [D31E]
583 0xEB 581 0xC7
584 582
585 583
586 ] 584 ]
587 ) 585 )
588 586
607 (tick) 605 (tick)
608 (tick) 606 (tick)
609 (tick) 607 (tick)
610 (tick) 608 (tick)
611 (tick) 609 (tick)
612 (tick) 610 (tick) ;; first loop
613 (tick) 611
614 (tick) 612
615 (tick) 613 (tick)
616 (tick) 614 (tick)
617 (tick) 615 (tick)
618 (tick) 616 (tick)
619 (tick) 617 (tick)
620 (tick) 618 (tick)
621 (tick) 619 (tick)
622 (tick) 620 (tick)
623 (tick) 621 (tick)
624 (tick) 622 (tick)
625 (tick) 623 (tick)
626 624 (tick)
627 625 (tick) ;; dpad bits
626
627 (tick)
628 (tick)
629 (tick)
630 (tick)
631 (tick)
632 (tick)
633 (tick)
634 (tick)
628 (d-tick) 635 (d-tick)
636
629 637
630 638
631 (view-register "A" A) 639 (view-register "A" A)
632 (view-register "B" B) 640 (view-register "B" B)
633 (view-register "C" C) 641 (view-register "C" C)