(index ("make-processor" 0) ("processor?" 688) ("processor-memory" 850) ("processor-memory-set!" 850) ("processor-registers" 850) ("processor-registers-set!" 850) ("reset!" 1193) ("execute!" 1484) ("interrupt!" 1799))
(def (sig (procedure "(make-processor #!key memory registers)" (id make-processor))) (p "Returns a record structure representing a single 6502 processor. " (tt "memory") " should be an u8vector that is used as RAM, usually of length 65546. " (tt "registers") " should be an 7 element u8vector, where the elements hold the values of the registers, according to the following table:") (table (tr (th "Index") (th "Register")) "\n" (tr (td "0") (td (tt "A"))) "\n" (tr (td "1") (td (tt "X"))) "\n" (tr (td "2") (td (tt "Y"))) "\n" (tr (td "3") (td (tt "P"))) "\n" (tr (td "4") (td (tt "S"))) "\n" (tr (td "5") (td (tt "PC") " (low byte)")) "\n" (tr (td "6") (td (tt "PC") " (high byte)"))))
(def (sig (procedure "(processor? X)" (id processor?))) (p "Returns " (tt "#t") " if " (tt "X") " is a " (tt "processor") " record or " (tt "#f") " otherwise."))
(def (sig (procedure "(processor-memory P)" (id processor-memory)) (procedure "(processor-memory-set! P U8VECTOR)" (id processor-memory-set!)) (procedure "(processor-registers P)" (id processor-registers)) (procedure "(processor-registers-set! P U8VECTOR)" (id processor-registers-set!))) (p "Accessors for the " (tt "processor") " record."))
(def (sig (procedure "(reset! P)" (id reset!))) (p "Resets the CPU represented by P by setting " (tt "A") ", " (tt "X") ", " (tt "Y") " to zero, " (tt "P") " to " (tt "#x20") ", " (tt "S") " to " (tt "#xff") " and " (tt "PC") " to the 16-bit address stored at location " (tt "#xfffc") "."))
(def (sig (procedure "(execute! P #!key cycles)" (id execute!))) (p "Executes instructions for processor " (tt "P") " with the state currently active in the processor record. Execution continues endlessly or after at least " (tt "cycles") " CPU cycles have been consumed (instructions always run to completion)."))
(def (sig (procedure "(interrupt! P VEC)" (id interrupt!))) (p "Triggers an interrupt for processor " (tt "P") " by pushing the " (tt "PC") " and " (tt "P") " registers, setting the interrupt flag and continuing execution at the address stored at the memory location given in " (tt "VEC") "."))
