Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * This file is part of COMP3000 high-level assembly language.
- *
- * Copyright (C) 2021 Kym Haines, Macquarie University.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
- package org.mq.hasm
- /**
- * The top level object of the application.
- */
- object Main {
- import Instr._
- import scala.io.Source
- import scala.collection.mutable.ListBuffer
- /**
- * Main entry point of the application.
- *
- * @param args the array of options and parameters passed on
- * the command line.
- */
- def main(args: Array[String]) {
- // open file to read lines
- val lines = Source.fromFile("main.hlal")
- var srcBuf = new ListBuffer[Txt]()
- // read each line and append to the list
- for(line <- lines.getLines())
- srcBuf += Txt(line)
- // close file and finalise lines
- lines.close()
- val src = srcBuf.toList
- setHeapSize(100)
- setStackSize(100)
- displayQuadInstr(assignAddresses(src))
- if(symbolsNotFound.size > 0)
- {
- println("Symbols not found:")
- symbolsNotFound foreach println
- return
- }
- if(!loadMemory()) return
- trace = false // set to true for tracing information
- displayMemory
- exec(1000) // allow at most 1000 instructions to be executed
- displayRegisters
- displayMemory
- }
- }
Add Comment
Please, Sign In to add comment