Some cleanup, minor clarifications, removed some commented code.

This commit is contained in:
Safiire 2015-04-17 02:04:05 -07:00
parent 7ffd2dc8ac
commit 927023d048
4 changed files with 8 additions and 21 deletions

View File

@ -37,7 +37,7 @@
sei ; SEt Interrupt (Disables them)
cld ; CLear Decimal Mode
ldx #$ff
ldx #$ff
txs ; Set the stack pointer
ldx #$00

View File

@ -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

View File

@ -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

View File

@ -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