diff --git a/examples/pulse_chord.asm b/examples/pulse_chord.asm index 6ebf17d..dcaabc6 100644 --- a/examples/pulse_chord.asm +++ b/examples/pulse_chord.asm @@ -37,7 +37,7 @@ sei ; SEt Interrupt (Disables them) cld ; CLear Decimal Mode - ldx #$ff + ldx #$ff txs ; Set the stack pointer ldx #$00 diff --git a/lib/n65/instruction.rb b/lib/n65/instruction.rb index 58f80b1..18ca5dd 100644 --- a/lib/n65/instruction.rb +++ b/lib/n65/instruction.rb @@ -171,10 +171,10 @@ module N65 ## OpCodes contains the definitions of each OpCode def initialize(op, arg, mode, byte_selector = nil) - ## Lookup the definition of this opcode, otherwise it is an invalid instruction @byte_selector = byte_selector.nil? ? nil : byte_selector.to_sym fail(InvalidInstruction, "Bad Byte selector: #{byte_selector}") unless [:>, :<, nil].include?(@byte_selector) + ## Lookup the definition of this opcode, otherwise it is an invalid instruction @op = op.downcase.to_sym definition = OpCodes[@op] fail(InvalidInstruction, op) if definition.nil? @@ -195,7 +195,7 @@ module N65 #### - ## Return if this instruction is a zero page instruction + ## Is this instruction a zero page instruction? def zero_page_instruction? [:zero_page, :zero_page_x, :zero_page_y].include?(@mode) end @@ -224,8 +224,7 @@ module N65 assembler.write_memory(emit_bytes) when String begin - ## This is a bug, I don't believe it will ever get here. - ## I think it always resolves every symbol later. + ## This works correctly now :) promise.call rescue SymbolTable::UndefinedSymbol placeholder = [@hex, 0xDE, 0xAD][0...@length] @@ -270,18 +269,6 @@ module N65 end - #### - ## Pretty Print - def to_s - #display = AddressingModes[@mode][:display] - #if @arg.kind_of?(String) - #sprintf("#{display} (#{@mode}, #{@arg})", @op, 0x0) - #else - #sprintf("#{display} (#{@mode})", @op, @arg) - #end - end - - private #### ## Break an integer into two 8-bit parts diff --git a/lib/n65/memory_space.rb b/lib/n65/memory_space.rb index a3f59de..fb260ca 100644 --- a/lib/n65/memory_space.rb +++ b/lib/n65/memory_space.rb @@ -117,9 +117,9 @@ module N65 unless address_inside_char_rom?(address) fail(AccessOutsideCharRom, sprintf("Address $%.4X is outside CHAR ROM", address)) end - address + return address else - address + return address end end diff --git a/nes_lib/nes.sym b/nes_lib/nes.sym index 1588ce4..6d209b3 100644 --- a/nes_lib/nes.sym +++ b/nes_lib/nes.sym @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Let's start a little library for naming parts of memory in the NES -; +; ; Including this file will not emit any instructions or data into your binary ; It only defines symbols in the symbol table to name memory addresses ; @@ -75,7 +75,7 @@ .space controller2 1 ; $4017 .scope mapper .org $8000 - .space unrom 1 + .space unrom 1 .org $8000 .space cnrom 1 .org $8000