mirror of
https://github.com/colby-swandale/waterfoul
synced 2024-12-26 21:58:54 +01:00
Add a method to read directly the memory
This commit is contained in:
parent
d4c2f76bc1
commit
e774ff97be
3 changed files with 6 additions and 2 deletions
|
@ -78,7 +78,7 @@ module Waterfoul
|
|||
end
|
||||
|
||||
def check_halt
|
||||
@halt = false if @pre_halt_interrupt != $mmu.read_byte(0xFF0F)
|
||||
@halt = false if @pre_halt_interrupt != $mmu.read_memory_byte(0xFF0F)
|
||||
end
|
||||
|
||||
def halted?
|
||||
|
|
|
@ -81,6 +81,10 @@ module Waterfoul
|
|||
alias_method :write_byte, :[]=
|
||||
alias_method :read_byte, :[]
|
||||
|
||||
def read_memory_byte(i)
|
||||
@memory[i]
|
||||
end
|
||||
|
||||
# read 2 bytes from memory
|
||||
def read_word(addr)
|
||||
self[addr] | (self[addr + 1] << 8)
|
||||
|
|
|
@ -304,7 +304,7 @@ module Waterfoul
|
|||
pixel = (byte_1 & (0x1 << (7 - pixelx)) > 0) ? 1 : 0
|
||||
pixel |= (byte_2 & (0x1 << (7 - pixelx)) > 0) ? 2 : 0
|
||||
position = line_width + buffer_addr
|
||||
palette = $mmu.read_byte 0xFF47
|
||||
palette = $mmu.read_memory_byte 0xFF47
|
||||
color = (palette >> (pixel * 2)) & 0x3
|
||||
|
||||
@framebuffer[position] = rgb(color)
|
||||
|
|
Loading…
Reference in a new issue