ORG operator

Bug #579325 reported by Onkar Shinde
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gnusim8085
In Progress
Wishlist
Aanjhan Ranganathan

Bug Description

We need an ORG operator for Gnusim. Often, different parts of a program need to be loaded at different addresses: for example an interrupt handler would be loaded at a different address from the main program. Currently this is not possible.

 This directive should be quite easy to implement - since it is already implemented as an interactive command.

 Thanks
      Dinesh

Tags: assembler
Revision history for this message
Bug Importer (bug-importer) wrote :

Logged In: NO

agreed, this would be useful

Revision history for this message
Bug Importer (bug-importer) wrote :

Logged In: NO

Also, the current "load me at" textbox doesn't really have to occupy so much space, it could easily do with 1/4th of it.

The "ORG" directive is also generally considered to be among the most essential directives to be supported in assemblers:
http://www.retroarchive.org/cpm/cdrom/SIMTEL/SIGM/VOLS100/VOL173/8080.HLP

:Assembler Directives.

An assembler needs additional information, beyond labels and instructions. At
the least, an indication of where the program begins and ends is needed. Data
is part of most programs, both numerical and textual. There could be cosmetic
instructions: start on a new page or suppress part of the program listing.

The most essential directives are:

  org define initial program address
  end no more source code follows
  equ assign a value to a symbol
  db one or more bytes of ASCII text
  dc ASCII text terminated by a flagged byte
  ds reserve space, perhaps label first byte
  dw one or more addresses or two-byte data

Beyond bare essentials, assemblers can grow to have considerable complexity.
For example, "include" can incorporate supplementary files in the text, while
"link" can allow the program to be written on a series of independent files.
Conditional assemblies, macros, or conditional macros are other possibilities.

Revision history for this message
Bug Importer (bug-importer) wrote :

Logged In: NO

Unlike the current implementation, which only accounts for the complete program being loaded to a specific address, what is being requested and suggested here would also mean to allow individual code parts (functions or procedures) to be loaded at configurable addresses, which basically means that there needs to be some way to tell the assembler to put the generated opcodes at a specific address.

Revision history for this message
Bug Importer (bug-importer) wrote :

Logged In: NO

I think the current implementation will only allow the whole program to be loaded at a configurable offset, but not individual code segments.

Revision history for this message
Bug Importer (bug-importer) wrote :

folks, this is really needed - all real assemblers support an "ORG" directive for individual code/data segments, so please do consider setting up the priority for this item!

Revision history for this message
Bug Importer (bug-importer) wrote :

I would agree, I think this is one of the few really important features missing, many other things (UI) are mainly cosmetical and don't negatively effect the simulator. However, having ORG support or not may very well be important for gnusim8085 to be used in educational settings. And I think this should be a declared goal of the project: becoming as attractive as possible for educational settings!

Revision history for this message
Bug Importer (bug-importer) wrote :

the ORG directive is really necessary for all interrupt/vector programming.

Revision history for this message
Bug Importer (bug-importer) wrote :

this belongs to #1877050 so that it could also be addressed by using a separate/standalone assembler implementation.

Revision history for this message
ramz (ramanathan-nit) wrote :

Attaching the patch for the ORG assembler directive. I have tested with the nqueen.asm file by putting different function in different position. Let me know your feedbacks.

One limitation is successive section has to be in the increasing order.

Revision history for this message
The Escapist (wisd00m) wrote :

Personally, my own suggestion would be to completely remove the "Load me at" feature from the GUI - it is a potential UI issue, especially once this is being used in examples: source code should always be self-contained, and it shouldn't require "configuration" whenever possible:

Just imagine for a second a program that is related to ISR programming or other code that makes use of custom start addresses (offsets), for such examples to work properly with this GUI element, the user would need to be asked to set up the "Load me at" field properly. Possibly by adding corresponding comments to the code.

That's tedious, at best....

It would be MUCH cleaner to support the "ORG" directive and then add these statements to all samples accordingly.

If a program needs to be loaded at a certain address, this really shouldn't be set up externally, but directly within the source code.

This is the cleanest solution, just consider the possible pitfalls for other efforts like this one: https://bugs.launchpad.net/gnusim8085/+bug/579362

Revision history for this message
The Escapist (wisd00m) wrote :

I am currently reviewing the 1.3.7 prerelease that Onkar has provided, where the "Load me at" field is still available.
Given that this defaults to "4200", it would be more intuitive to directly add and show this default in the input box.

Revision history for this message
Onkar Shinde (onkarshinde) wrote :

Aanjhan,

Can you please review the attached patch?

Changed in gnusim8085:
assignee: nobody → Aanjhan Ranganathan (aanjhan)
Revision history for this message
Aanjhan Ranganathan (aanjhan) wrote :

Reviewing attached patch.

Changed in gnusim8085:
status: New → In Progress
Changed in gnusim8085:
milestone: none → 1.3.8
Revision history for this message
A. Denton (aquina) wrote :

I agree with most of the previous comments. Software like "Sim8085" for Windows has ORG since the beginning, for a good reason. At the university ORG was mandatory (among other things) and therefore I was not able to use GNUSim.

Revision history for this message
The Escapist (wisd00m) wrote :

What is the status here?
Did anybody review the patch?
Is it acceptable, can it be included in the next release?
Otherwise, if something's missing please tell us, so that we can fix the patch.

The ORG directive is one of the most essential features and fairly trivial to implement actually, so there should no reason for gnusim8085 not to have it.

Thanks

Revision history for this message
The Escapist (wisd00m) wrote :

FWIW, there's a full 8085 assembler available at: http://sf.net/projects/sasm85

It's open source and could be easily integrated apparently: http://sasm85.cvs.sourceforge.net/viewvc/sasm85/sasm85/

It seems, we would only need to link it into gnusim8085 and call two functions: pass1() and pass2() to assemble a source file, that would get rid of most limitations in the gnusim8085 assembler, see the main function here:

http://sasm85.cvs.sourceforge.net/viewvc/sasm85/sasm85/sasm85.c?revision=1.1.1.1&view=markup

Maybe this should be added as an alternative to the existing assembler?

It also comes with documentation and additional examples

Revision history for this message
Raphaël Leroux (indri-apollo) wrote :

Hi people,

I'm an 17old IT student and I'm currently learning assembler. We use a proprietary simulator to make our exercices.
I would love to use gnusim but the lack of the ORG directive prevents me from using it.
Is the next release approaching ? just asking :)

However great job devs !

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.