First draft of AppleSoft BASIC tokenizer for 'ac'. #23.

This commit is contained in:
Rob Greene
2018-05-08 21:40:47 -05:00
parent 275a0b8b68
commit f3cecfd415
11 changed files with 683 additions and 1 deletions

View File

@ -0,0 +1,26 @@
package com.webcodepro.applecommander.util.applesoft;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
/** A Program is a series of lines. */
public class Program {
public final List<Line> lines = new ArrayList<>();
public void prettyPrint(PrintStream ps) {
for (Line line : lines) {
line.prettyPrint(ps);
}
}
public byte[] toBytes(int address) throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
for (Line line : lines) address = line.toBytes(address, os);
os.write(0x00);
os.write(0x00);
return os.toByteArray();
}
}