comparison clojure/com/aurellem/gb/assembly.clj @ 242:2e751984b42d

making interesting data insights.
author Dylan Holmes <ocsenave@gmail.com>
date Sun, 25 Mar 2012 02:53:29 -0500
parents 19fd38fe376e
children
comparison
equal deleted inserted replaced
241:7984a084aa07 242:2e751984b42d
413 413
414 (defn write-memory-assembly* 414 (defn write-memory-assembly*
415 "A program for altering in-game memory by pressing buttons." 415 "A program for altering in-game memory by pressing buttons."
416 [] 416 []
417 [ 417 [
418 0xF3 ; stop interrupts 418 ;; 0xF3 ; stop interrupts
419 ;; --------- CLEANUP 419 ;; --------- CLEANUP
420 0xAF ; zero A [D31E] 420 0xAF ; zero A [D31E]
421 0x57 ; A->D; makes D=0. 421 0x57 ; A->D; makes D=0.
422 422
423 ;; --------- FRAME METRONOME 423 ;; --------- FRAME METRONOME
435 0xA0 ;; A & B --> A 435 0xA0 ;; A & B --> A
436 436
437 0xF5 ;; push AF (vbprev) 437 0xF5 ;; push AF (vbprev)
438 438
439 0xA1 ;; A & C --> A. Now A_0 contains "increment?" 439 0xA1 ;; A & C --> A. Now A_0 contains "increment?"
440 440
441 0xCB ;; test A_0. this result will be used twice. 441 0x4F
442 0x47 442 0xCB ;; test bit 0 of C. sadly, this result can't be reused below.
443 0x41
443 444
444 0x28 ;; end frame (JUMP) if A_0 = 0. 445 0x28 ;; end frame (JUMP) if A_0 = 0.
445 0xF3 ;; TODO: set jump length 446 0xF3 ;; TODO: set jump length
446 447
447 ;; -------- GET BUTTON INPUT 448 ;; -------- GET BUTTON INPUT
448 449
449 ;; btw, Z bit is now 1
450 ;; prepare to select bits 450 ;; prepare to select bits
451 451
452 0x3E ;; load 0x20 into A, to measure dpad 452 0x3E ;; load 0x20 into A, to measure dpad
453 0x20 453 0x20
454 454
464 0xE6 ;; bitmask 00001111 464 0xE6 ;; bitmask 00001111
465 0x0F 465 0x0F
466 466
467 0xB0 ;; A or B --> A 467 0xB0 ;; A or B --> A
468 468
469 0xCB ;; check bit 0 of C
470 0x41
471
469 0x28 ;; JUMP forward if Z=0 472 0x28 ;; JUMP forward if Z=0
470 0x08 473 0x08
471 474
472 0x47 ;; A -> B 475 0x47 ;; A -> B
473 0xCB ;; swap B nybbles 476 0xCB ;; swap B nybbles
474 0x30 477 0x30
475 478
476 0x3E ;; load 0x10 into A, to measure btns 479 0x3E ;; load 0x10 into A, to measure btns
477 0x10 480 0x10
478
479 0xBF ;; compare(A,A) sets Z=0
480 481
481 0x18 ;; JUMP back to "load A into [FF00]" 482 0x18 ;; JUMP back to "load A into [FF00]"
482 0xEF 483 0xF0
483 484
484 485
485 ;; ------ TAKE ACTION BASED ON USER INPUT 486 ;; ------ TAKE ACTION BASED ON USER INPUT
486 487
487 ;; "input mode" 488 ;; "input mode"
540 541
541 0x3E ;; load the constant 57 into A. [D369] 542 0x3E ;; load the constant 57 into A. [D369]
542 0x57 543 0x57
543 0x82 ;; add the mode to A 544 0x82 ;; add the mode to A
544 0xEA ;; store A into "thing to execute" 545 0xEA ;; store A into "thing to execute"
545 0x74 546 0x74 ;; ABSOLUTE LOCATION
546 0xD3 547 0xD3 ;; ABSOLUTE LOCATION
547 548
548 0x3E ;; load the constant 8 into A 549 0x3E ;; load the constant 8 into A
549 0x08 550 0x08
550 0x82 ;; add the mode to A 551 0x82 ;; add the mode to A
551 552