From 10fa7e205334b6ed787f18342ec27ccdbded7df2 Mon Sep 17 00:00:00 2001 From: Denis Defreyne Date: Fri, 12 Aug 2016 16:19:07 +0200 Subject: [PATCH] Upgrade assembler to newer Crystal version --- shard.yml | 3 +-- src/assemble/main.cr | 20 ++++++++++---------- src/emulate/cpu.cr | 2 +- src/emulate/video.cr | 4 ++-- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/shard.yml b/shard.yml index cdc8550..2e8d2a0 100644 --- a/shard.yml +++ b/shard.yml @@ -3,7 +3,6 @@ version: 0.1.0 dependencies: sdl2: - github: ddfreyne/crystal-sdl2 - branch: crystal-0-15-compat + github: weskinner/crystal-sdl2 license: MIT diff --git a/src/assemble/main.cr b/src/assemble/main.cr index a2090dc..90301fd 100644 --- a/src/assemble/main.cr +++ b/src/assemble/main.cr @@ -34,7 +34,7 @@ class RegArg < Arg getter :name - def initialize(name) + def initialize(name : String) @name = name end @@ -58,7 +58,7 @@ end class ImmArg < Arg getter :value - def initialize(value) + def initialize(value : Int32) @value = value end @@ -88,7 +88,7 @@ end class LabelArg < Arg getter :name - def initialize(name) + def initialize(name : String) @name = name end @@ -125,7 +125,7 @@ class Instruction getter :opcode_mnemonic getter :args - def initialize(opcode_mnemonic, args) + def initialize(opcode_mnemonic : String, args : Array(Arg)) @opcode_mnemonic = opcode_mnemonic @args = args end @@ -150,7 +150,7 @@ end class Label getter :name - def initialize(name) + def initialize(name : String) @name = name end @@ -175,7 +175,7 @@ class DataDirective getter :length getter :arg - def initialize(length, arg) + def initialize(length : Int32, arg : Arg) @length = length @arg = arg end @@ -236,7 +236,7 @@ end class Lexer getter tokens - def initialize(@input) + def initialize(@input : String) @index = 0 @tokens = [] of Token @current_token = Token.new @@ -404,7 +404,7 @@ end class Parser getter statements - def initialize(@input) + def initialize(@input : Array(Token)) @index = 0 @statements = [] of Instruction | Label | DataDirective end @@ -599,7 +599,7 @@ end ################################################################################ class Assembler - def initialize(@input) + def initialize(@input : String) end def assemble @@ -647,7 +647,7 @@ class Assembler getter :opcode getter :args - def initialize(opcode : UInt8, args) + def initialize(opcode : UInt8, args : Array(Symbol)) @opcode = opcode @args = args end diff --git a/src/emulate/cpu.cr b/src/emulate/cpu.cr index 7f3dcb2..748e06a 100644 --- a/src/emulate/cpu.cr +++ b/src/emulate/cpu.cr @@ -65,7 +65,7 @@ class CPU class InvalidOpcodeException < Exception end - def initialize(mem) + def initialize(mem : Mem) @reg = Reg.new @mem = mem @running = true diff --git a/src/emulate/video.cr b/src/emulate/video.cr index c8ecc1e..f5bc451 100644 --- a/src/emulate/video.cr +++ b/src/emulate/video.cr @@ -10,7 +10,7 @@ end class Graphics property render - def initialize(title, width, height) + def initialize(title : String, width : Int32, height : Int32) @render_changed = false # Create window @@ -96,7 +96,7 @@ RED = 0xFF4B59F2_u32 class Video PADDING = 16 - def initialize(mem) + def initialize(mem : Mem) @mem = mem end