comparison modules/x86.tp @ 362:7101ad443081

Add null terminator to string literals in x86 module and fix a bug that interfered with use of function name labels in call instructions
author Michael Pavone <pavone@retrodev.com>
date Sat, 25 Apr 2015 13:05:38 -0700
parents 06dceff348ea
children d949fe826e04
comparison
equal deleted inserted replaced
361:06dceff348ea 362:7101ad443081
254 } 254 }
255 } 255 }
256 256
257 data <- :bytes { 257 data <- :bytes {
258 #{ 258 #{
259 length <- { bytes byte_length } 259 length <- { (bytes byte_length) + 1 }
260 flattenTo:at <- :dest :idx { 260 flattenTo:at <- :dest :idx {
261 foreach: (range from: 0 to: length) :_ cidx { 261 foreach: (range from: 0 to: length) :_ cidx {
262 dest set: idx + cidx (bytes byte: cidx) 262 dest set: idx + cidx (bytes byte: cidx)
263 } 263 }
264 //NULL terminator
265 dest set: idx + (bytes byte_length) 0u8
264 idx + length 266 idx + length
265 } 267 }
266 string <- { 268 string <- {
267 "data: " . bytes 269 "data: " . bytes
268 } 270 }
469 _forwardRefs <- #[] 471 _forwardRefs <- #[]
470 #{ 472 #{
471 length <- { 0 } 473 length <- { 0 }
472 hasOffset? <- { _offset >= 0 } 474 hasOffset? <- { _offset >= 0 }
473 offset <- { _offset } 475 offset <- { _offset }
476 isInteger? <- { false }
474 register? <- { false } 477 register? <- { false }
475 label? <- { true } 478 label? <- { true }
476 flattenTo:at <- :dest :idx { 479 flattenTo:at <- :dest :idx {
477 if: (not: hasOffset?) { 480 if: (not: hasOffset?) {
478 _offset <- idx 481 _offset <- idx