MCPcopy Create free account
hub / github.com/TheScienceElf/UNIVAC-1219 / encode

Function encode

common/src/assembler.rs:357–375  ·  view source on GitHub ↗
(
    program_layout: Vec<Vec<(u18, Code)>>,
    symbols: &BTreeMap<String, u18>,
    program: &Program,
)

Source from the content-addressed store, hash-verified

355}
356
357pub fn encode(
358 program_layout: Vec<Vec<(u18, Code)>>,
359 symbols: &BTreeMap<String, u18>,
360 program: &Program,
361) -> memory::Layout {
362 memory::Layout {
363 start_address: program.start_address.evaluate(u18::new(0), &symbols),
364 segments: program_layout
365 .iter()
366 .map(|block| memory::LayoutSegment {
367 start_addr: block[0].0,
368 data: block
369 .iter()
370 .flat_map(|(address, code)| code.encode(*address, symbols))
371 .collect(),
372 })
373 .collect(),
374 }
375}
376
377pub fn assemble(lines: &Vec<&str>, verbose: bool) -> tape::Tape {
378 let program = parse(lines);

Callers 1

assembleFunction · 0.85

Calls 3

newFunction · 0.85
evaluateMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected