debugging binaries, initial jump issues

This commit is contained in:
Torsten Ruger
2018-04-30 13:28:55 +03:00
parent d84d208192
commit 1acd231a33
7 changed files with 37 additions and 14 deletions

View File

@ -9,9 +9,9 @@ module Risc
class TextWriter
include Logging
log_level :info
log_level :debug
MARKER = 0xA51AF00D
MARKER = 0xBAD4C0DE
def initialize( machine)
@machine = machine
@ -25,7 +25,7 @@ module Risc
# - all BinaryCode
def write_as_string
@stream = StringIO.new
write_any(@machine.binary_init)
write_init(@machine.binary_init)
write_debug
write_objects
write_code
@ -146,6 +146,18 @@ module Risc
log.debug "Data4 witten stream 0x#{@stream.length.to_s(16)}"
end
# first jump, treated as a binary code, but this one needs
# the actual jump as the first
def write_init( code )
code.each_word do |word|
@stream.write_unsigned_int_32( word || 0 )
end
write_ref_for( code.next )
write_ref_for( code.get_type )
@stream.write_signed_int_32( MARKER )
log.debug "Code16 witten stream 0x#{@stream.length.to_s(16)}"
end
def write_BinaryCode( code )
@stream.write_signed_int_32( MARKER )
write_ref_for( code.get_type )