
import sys
import assembler6502_tokenizer as tokenizer
import assembler6502_parser as parser

def output_byte(hexcode):
    sys.stdout.write(hexcode)
    #sys.stdout.write(chr(int(hexcode, 16)))

def main():
    code = """
; sample code
beginning:
    sty $44,X
    """
    for line in code.split("\n"):
        hexcodes = parser.parse_line(line)
        for hexcode in hexcodes:
            output_byte(hexcode)
    print

if __name__ == "__main__":
    main()



import sys
import assembler6502_tokenizer as tokenizer
import assembler6502_parser as parser

def output_byte(hexcode):
    sys.stdout.write(hexcode + "\n")
    #sys.stdout.write(chr(int(hexcode, 16)))

def main():
    code = sys.stdin.read()
    for line in code.split("\n"):
        hexcodes = parser.parse_line(line)
        for hexcode in hexcodes:
            output_byte(hexcode)

if __name__ == "__main__":
    main()


Use stdin for assembler input
Use stdin for assembler input

  
  import sys
  import assembler6502_tokenizer as tokenizer
  import assembler6502_parser as parser
  
  def output_byte(hexcode):
-     sys.stdout.write(hexcode)
+     sys.stdout.write(hexcode + "\n")
      #sys.stdout.write(chr(int(hexcode, 16)))
  
  def main():
+     code = sys.stdin.read()
-     code = """
- ; sample code
- beginning:
-     sty $44,X
-     """
      for line in code.split("\n"):
          hexcodes = parser.parse_line(line)
          for hexcode in hexcodes:
              output_byte(hexcode)
-     print
  
  if __name__ == "__main__":
      main()
  
  
Use stdin for assembler input
## Code Before:

import sys
import assembler6502_tokenizer as tokenizer
import assembler6502_parser as parser

def output_byte(hexcode):
    sys.stdout.write(hexcode)
    #sys.stdout.write(chr(int(hexcode, 16)))

def main():
    code = """
; sample code
beginning:
    sty $44,X
    """
    for line in code.split("\n"):
        hexcodes = parser.parse_line(line)
        for hexcode in hexcodes:
            output_byte(hexcode)
    print

if __name__ == "__main__":
    main()


## Instruction:
Use stdin for assembler input
## Code After:

import sys
import assembler6502_tokenizer as tokenizer
import assembler6502_parser as parser

def output_byte(hexcode):
    sys.stdout.write(hexcode + "\n")
    #sys.stdout.write(chr(int(hexcode, 16)))

def main():
    code = sys.stdin.read()
    for line in code.split("\n"):
        hexcodes = parser.parse_line(line)
        for hexcode in hexcodes:
            output_byte(hexcode)

if __name__ == "__main__":
    main()

