18 #! Run a single 8080 instruction
19 [ read-instruction ] keep ! n cpu
20 over get-cycles over inc-cycles
21 [ swap instructions nth call( cpu -- ) ] keep
22 [ pc>> 0xFFFF bitand ] keep
26 : test-step ( cpu -- cpu )
27 [ step ] keep dup cpu. ;
31 { 0x0000 "invaders/invaders.h" }
32 { 0x0800 "invaders/invaders.g" }
33 { 0x1000 "invaders/invaders.f" }
34 { 0x1800 "invaders/invaders.e" }
38 <cpu> invaders over load-rom* dup cpu. ;
41 test-cpu swap [ test-step ] times drop ;
43 : run-n ( cpu n -- cpu )
46 : each-8bit ( n quot -- )
47 [ 8 <bits> ] dip each ; inline
49 : >ppm ( cpu filename -- cpu )
50 #! Dump the current screen image to a ppm image file with the given name.
57 over 32 * over + 0x2400 + ! cpu h w addr
58 [ pick ] dip swap ram>> nth [
70 test-cpu [ 1000000 run-n drop ] time ;