comparison clojure/com/aurellem/assembly.clj @ 131:7f7cc8858d2e

added rival-name letter-map
author Robert McIntyre <rlm@mit.edu>
date Sat, 17 Mar 2012 21:29:08 -0500
parents 69f241de436d
children eb6ba88088d3
comparison
equal deleted inserted replaced
130:69f241de436d 131:7f7cc8858d2e
462 "Input freestyle buttons and observe the effects at the repl." 462 "Input freestyle buttons and observe the effects at the repl."
463 [] 463 []
464 (set-state! (input-number)) 464 (set-state! (input-number))
465 (dotimes [_ 90000] (step (view-memory @current-state 0xD352)))) 465 (dotimes [_ 90000] (step (view-memory @current-state 0xD352))))
466 466
467
468
469
470 (defn write-memory-assembly* []
471 [
472 0x18 ;; D31D
473 0x02
474 0x00 ;; frame-count D31F
475 0x00 ;; v-blank-prev D320
476
477 0xFA ;; load modes into A
478 0x41
479 0xFF
480
481 0x47
482
483 0xCB
484 0x2F
485 0x2F
486
487 0xA0
488 0xE6
489 0x01
490 0x47 ;; now B contains (VB==1)
491
492 0xFA ;; load v-blank-prev
493 0x20
494 0xD3
495
496 0x2F
497
498 0xA0
499 0x4F ;; now C contains increment?
500
501 0xFA ;; load frame count
502 0x1F
503 0xD3
504
505 0x81 ;; add A+C->A
506 0xEA ;; spit A --> fc
507 0x1F
508 0xD3
509
510 0x78 ;; B->A
511
512 0xEA ;; spit A --> vbprev
513 0x20
514 0xD3
515
516 0xC3 ;D40F ; go back to beginning
517 0x1D ;D410
518 0xD3 ;D411
519 ]
520 )
521
522 (defn write-mem-dyl []
523 (-> (tick (mid-game))
524 (IE! 0)
525 (inject-item-assembly (write-memory-assembly*))))
526
527
467 (defn d2 [] 528 (defn d2 []
468 (-> 529 (->
469 (write-mem-dyl) 530 (write-mem-dyl)
470 (view-memory 0xD31F) 531 (view-memory 0xD31F)
471 step step step step step 532 step step step step step
499 (view-register "C" C) 560 (view-register "C" C)
500 561
501 )) 562 ))
502 563
503 564
504
505
506 (defn write-memory-assembly* []
507 [
508 0x18 ;; D31D
509 0x02
510 0x00 ;; frame-count D31F
511 0x00 ;; v-blank-prev D320
512
513 0xFA ;; load modes into A
514 0x41
515 0xFF
516
517 0x47
518
519 0xCB
520 0x2F
521 0x2F
522
523 0xA0
524 0xE6
525 0x01
526 0x47 ;; now B contains (VB==1)
527
528 0xFA ;; load v-blank-prev
529 0x20
530 0xD3
531
532 0x2F
533
534 0xA0
535 0x4F ;; now C contains increment?
536
537 0xFA ;; load frame count
538 0x1F
539 0xD3
540
541 0x81 ;; add A+C->A
542 0xEA ;; spit A --> fc
543 0x1F
544 0xD3
545
546 0x78 ;; B->A
547
548 0xEA ;; spit A --> vbprev
549 0x20
550 0xD3
551
552 0xC3 ;D40F ; go back to beginning
553 0x1D ;D410
554 0xD3 ;D411
555 ]
556 )
557
558 (defn write-mem-dyl []
559 (-> (tick (mid-game))
560 (IE! 0)
561 (inject-item-assembly (write-memory-assembly*))))
562
563 565
564 566
565 (defn write-memory-assembly [] 567 (defn write-memory-assembly []
566 [ 568 [
567 ;; Main Timing Loop 569 ;; Main Timing Loop