Thread: Should the 6502 core file be plain-text or binary.

  1. #1
    C lover
    Join Date
    Oct 2007
    Location
    Virginia
    Posts
    266

    Should the 6502 core file be plain-text or binary.

    So I'm writing my first 6502 chip emu and I have yet to write the assembler. But my question is: Should the assembler produce a machine code file in plain-text format or a binary file?

  2. #2
    Registered User
    Join Date
    Sep 2007
    Posts
    1,012
    Binary. Text mode is mainly used to translate a newline (\n) to a platform-specific newline sequence, such as \r\n. As I understand it, Windows also stops reading from a text file when it hits a particular byte, which it won't do in binary mode; but don't quote me on that one.

    Basically, if you want the file contain exactly the bytes you write to it, use binary mode. Text mode can, if the system differentiates between the two, mangle output.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    How complex is your assembler?

    At the simple end of things, it would emit pure binary data located to a particular address. Once loaded onto the machine, it was good to go.

    A complex relocatable assembler would output instructions and relocation information. Such programs allow you to build libraries of modules, and multi-module programs without too much effort. But you also need an additional "link" program to resolve all the relocation information down to a pure binary form.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    C lover
    Join Date
    Oct 2007
    Location
    Virginia
    Posts
    266
    I still have a little bit to do with the core. I've never written an assembler so this one may be moderately simple but I'm looking forward to it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can you help me about tolower() in file
    By nctar in forum C Programming
    Replies: 7
    Last Post: 05-12-2010, 10:04 AM
  2. Text file versus Binary file
    By sherwi in forum C Programming
    Replies: 6
    Last Post: 04-15-2006, 02:41 PM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Removing text between /* */ in a file
    By 0rion in forum C Programming
    Replies: 2
    Last Post: 04-05-2004, 08:54 AM
  5. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM