Module: Badline::InstructionSet
- Included in:
- CPU
- Defined in:
- lib/badline/instruction_set.rb,
lib/badline/instruction_set/flag.rb,
lib/badline/instruction_set/stack.rb,
lib/badline/instruction_set/branch.rb,
lib/badline/instruction_set/bitwise.rb,
lib/badline/instruction_set/illegal.rb,
lib/badline/instruction_set/inc_dec.rb,
lib/badline/instruction_set/transfer.rb,
lib/badline/instruction_set/arithmetic.rb
Overview
Defined Under Namespace
Modules: Arithmetic, Bitwise, Branch, Flag, Illegal, IncDec, Stack, Transfer
Instance Method Summary collapse
-
#brk(_addr, _value) ⇒ Object
Forces a software interrupt (break).
-
#nop(_addr, _value) ⇒ Object
No operation.
Methods included from Transfer
#lda, #ldx, #ldy, #sta, #stx, #sty, #tax, #tay, #tsx, #txa, #txs, #tya
Methods included from Stack
#jmp, #jsr, #pha, #php, #pla, #plp, #rti, #rts
Methods included from Illegal
#alr, #anc, #ane, #arr, #dcp, #isc, #jam, #las, #lax, #lxa, #nop_nocycle, #rla, #rra, #sax, #sbx, #sha, #shx, #shy, #slo, #sre, #tas
Methods included from Flag
#clc, #cld, #cli, #clv, #sec, #sed, #sei
Methods included from IncDec
#dec, #dex, #dey, #inc, #inx, #iny
Methods included from Branch
#bcc, #bcs, #beq, #bmi, #bne, #bpl, #bvc, #bvs
Methods included from Bitwise
#and, #asl, #bit, #eor, #lsr, #ora, #rol, #ror
Methods included from Arithmetic
Instance Method Details
#brk(_addr, _value) ⇒ Object
Forces a software interrupt (break). Pushes PC+2 and status to stack, sets break flag, and jumps via IRQ vector.
Opcodes:
$00 - implied - 7 cycles
30 31 32 33 34 |
# File 'lib/badline/instruction_set.rb', line 30 def brk(_addr, _value) status.break = true handle_interrupt(0xfffe, brk: true, pre_cycles: 1) status.break = false end |
#nop(_addr, _value) ⇒ Object
No operation. Does nothing but consume a clock cycle.
Opcodes:
$EA - implied - 2 cycles
$04, $44, $64 - zeropage - 3 cycles (illegal)
$14, $34, $54, $74, $D4, $F4 - zeropage_x - 4 cycles (illegal)
$0C - absolute - 4 cycles (illegal)
$1C, $3C, $5C, $7C, $DC, $FC - absolute_x - 4+ cycles (illegal)
$1A, $3A, $5A, $7A, $DA, $FA - implied - 2 cycles (illegal)
45 46 47 |
# File 'lib/badline/instruction_set.rb', line 45 def nop(_addr, _value) cycle end |