mirror of
https://github.com/safiire/n65.git
synced 2024-05-28 02:48:25 +00:00
Some cleanup, minor clarifications, removed some commented code.
This commit is contained in:
parent
7ffd2dc8ac
commit
927023d048
|
@ -37,7 +37,7 @@
|
||||||
sei ; SEt Interrupt (Disables them)
|
sei ; SEt Interrupt (Disables them)
|
||||||
cld ; CLear Decimal Mode
|
cld ; CLear Decimal Mode
|
||||||
|
|
||||||
ldx #$ff
|
ldx #$ff
|
||||||
txs ; Set the stack pointer
|
txs ; Set the stack pointer
|
||||||
|
|
||||||
ldx #$00
|
ldx #$00
|
||||||
|
|
|
@ -171,10 +171,10 @@ module N65
|
||||||
## OpCodes contains the definitions of each OpCode
|
## OpCodes contains the definitions of each OpCode
|
||||||
def initialize(op, arg, mode, byte_selector = nil)
|
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
|
@byte_selector = byte_selector.nil? ? nil : byte_selector.to_sym
|
||||||
fail(InvalidInstruction, "Bad Byte selector: #{byte_selector}") unless [:>, :<, nil].include?(@byte_selector)
|
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
|
@op = op.downcase.to_sym
|
||||||
definition = OpCodes[@op]
|
definition = OpCodes[@op]
|
||||||
fail(InvalidInstruction, op) if definition.nil?
|
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?
|
def zero_page_instruction?
|
||||||
[:zero_page, :zero_page_x, :zero_page_y].include?(@mode)
|
[:zero_page, :zero_page_x, :zero_page_y].include?(@mode)
|
||||||
end
|
end
|
||||||
|
@ -224,8 +224,7 @@ module N65
|
||||||
assembler.write_memory(emit_bytes)
|
assembler.write_memory(emit_bytes)
|
||||||
when String
|
when String
|
||||||
begin
|
begin
|
||||||
## This is a bug, I don't believe it will ever get here.
|
## This works correctly now :)
|
||||||
## I think it always resolves every symbol later.
|
|
||||||
promise.call
|
promise.call
|
||||||
rescue SymbolTable::UndefinedSymbol
|
rescue SymbolTable::UndefinedSymbol
|
||||||
placeholder = [@hex, 0xDE, 0xAD][0...@length]
|
placeholder = [@hex, 0xDE, 0xAD][0...@length]
|
||||||
|
@ -270,18 +269,6 @@ module N65
|
||||||
end
|
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
|
private
|
||||||
####
|
####
|
||||||
## Break an integer into two 8-bit parts
|
## Break an integer into two 8-bit parts
|
||||||
|
|
|
@ -117,9 +117,9 @@ module N65
|
||||||
unless address_inside_char_rom?(address)
|
unless address_inside_char_rom?(address)
|
||||||
fail(AccessOutsideCharRom, sprintf("Address $%.4X is outside CHAR ROM", address))
|
fail(AccessOutsideCharRom, sprintf("Address $%.4X is outside CHAR ROM", address))
|
||||||
end
|
end
|
||||||
address
|
return address
|
||||||
else
|
else
|
||||||
address
|
return address
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; Let's start a little library for naming parts of memory in the NES
|
; 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
|
; 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
|
; It only defines symbols in the symbol table to name memory addresses
|
||||||
;
|
;
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
.space controller2 1 ; $4017
|
.space controller2 1 ; $4017
|
||||||
.scope mapper
|
.scope mapper
|
||||||
.org $8000
|
.org $8000
|
||||||
.space unrom 1
|
.space unrom 1
|
||||||
.org $8000
|
.org $8000
|
||||||
.space cnrom 1
|
.space cnrom 1
|
||||||
.org $8000
|
.org $8000
|
||||||
|
|
Loading…
Reference in New Issue
Block a user