Skip to content

Commit

Permalink
Initialized allocate in assembler
Browse files Browse the repository at this point in the history
  • Loading branch information
redfast00 committed Jan 24, 2018
1 parent 217f989 commit 790f695
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion RCPU/assembler/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def parse_resource(line):
size = int(parts[2])
if size < 1:
raise utils.AssemblerException("Size of allocated memory too small: {}".format(line))
return parts[0], '_' * (size - 1)
return parts[0], '\0' * (size - 1)
else:
raise utils.AssemblerException("Unknown resource type in .data: {}".format(line))

Expand Down
2 changes: 1 addition & 1 deletion docs/assembly_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The `.data` section contains data like strings and constants. There are three
- Allocations look like `.alloc allocate 5`: `.alloc` is the name of the label and
`5` is the size of the buffer that will be allocated when the binary is assembled.
Memory will only be allocated if the label is used in the `.text` section.
The allocated memory will be "dirty", so you can't count on it having a certain value.
The allocated memory will be initialized with zeroes.

### .text section
The `.text` section contains an entrypoint, instructions and labels:
Expand Down

0 comments on commit 790f695

Please sign in to comment.