mirror of
https://github.com/colby-swandale/waterfoul
synced 2024-12-25 21:58:55 +01:00
small cleanup
This commit is contained in:
parent
212406677b
commit
6f18f30f38
4 changed files with 5 additions and 10 deletions
|
@ -100,7 +100,7 @@ module Waterfoul
|
|||
# counter (except under particular circumstances, see interrupts)
|
||||
def fetch_instruction(no_increment_pc = false)
|
||||
instruction_byte = $mmu.read_byte @pc
|
||||
@pc = (@pc + 1) & 0xFFFF unless increment_pc
|
||||
@pc = (@pc + 1) & 0xFFFF unless no_increment_pc
|
||||
instruction_byte
|
||||
end
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ module Waterfoul
|
|||
# read the given file as binary and break it down into an array of bytes
|
||||
rom = File.binread(rom_filename).bytes
|
||||
# initialize emulated CPU, GPU & Scren components
|
||||
cartridge = Cartridge.new rom
|
||||
$mmu = MMU.new
|
||||
@cartridge = Cartridge.new rom
|
||||
@cpu = CPU.new
|
||||
@cpu = SkipBoot.set_state(@cpu) if options.has_key?('skip_boot')
|
||||
@gpu = GPU.new
|
||||
|
@ -15,6 +15,7 @@ module Waterfoul
|
|||
end
|
||||
|
||||
def run
|
||||
$mmu.cartridge = @cartridge
|
||||
loop do
|
||||
@cpu.step
|
||||
@gpu.step @cpu.m
|
||||
|
|
|
@ -9,7 +9,7 @@ module Waterfoul
|
|||
@buffer = FFI::MemoryPointer.new :uint32, SCREEN_WIDTH * SCREEN_HEIGHT
|
||||
@window = SDL.CreateWindow 'waterfoul', 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0
|
||||
@renderer = SDL.CreateRenderer @window, -1, 0
|
||||
@texture = SDL.CreateTexture @renderer, SDL::SDL_PIXELFORMAT_ARGB8888, 1, SCREEN_WIDTH, SCREEN_HEIGHT
|
||||
@texture = SDL.CreateTexture @renderer, SDL::PIXELFORMAT_ARGB8888, 1, SCREEN_WIDTH, SCREEN_HEIGHT
|
||||
end
|
||||
|
||||
def render(framebuffer)
|
||||
|
|
|
@ -9,14 +9,8 @@ module Waterfoul
|
|||
INIT_VIDEO = 0x20
|
||||
INIT_KEYBOARD = 0x200
|
||||
WINDOW_RESIZABLE = 0x20
|
||||
PIXELFORMAT_ARGB8888 = 0x16362004
|
||||
|
||||
SDL_PIXELFORMAT_ARGB8888 =
|
||||
(1 << 28) |
|
||||
(6 << 24) |
|
||||
(3 << 20) |
|
||||
(6 << 16) |
|
||||
(32 << 8) |
|
||||
(4 << 0)
|
||||
# keyboard key maps
|
||||
SDL_SCANCODE_RETURN = 40 # start
|
||||
SDL_SCANCODE_RSHIFT = 229 # select
|
||||
|
|
Loading…
Reference in a new issue