Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for "EQU" in assembler #61

Open
jtauber opened this issue Apr 8, 2012 · 12 comments
Open

support for "EQU" in assembler #61

jtauber opened this issue Apr 8, 2012 · 12 comments

Comments

@jtauber
Copy link
Owner

jtauber commented Apr 8, 2012

Just like we have DAT (similar to the DFB in old 8-bit CPU assemblers) I think we need something like an EQU instruction in our assemblers for setting constants.

Has anyone seen an EQU equivalent in any of Notch's work (or in any other assemblers)?

@andre-d
Copy link
Contributor

andre-d commented Apr 8, 2012

What would it do?

@jtauber
Copy link
Owner Author

jtauber commented Apr 8, 2012

It would set a label to the given value (rather than the memory location of the label)

So for example, you could set vidmem to be 0x8000 once so your assembly code could just use vidmem instead of 0x8000.

@jtauber
Copy link
Owner Author

jtauber commented Apr 8, 2012

basically, to avoid magic numbers in assembly code

@jtauber
Copy link
Owner Author

jtauber commented Apr 8, 2012

for example, say I use 0x1000 to store the cursor. I'd rather write:

SET [cursor], vidmem than SET [0x1000], 0x8000

@andre-d
Copy link
Contributor

andre-d commented Apr 8, 2012

Oh, assembler time definition, yeah, right. I have been working around it by using labels and dat allover the place (not fun over time, and slower)

@jtauber
Copy link
Owner Author

jtauber commented Apr 8, 2012

yeah, labels + dat works but it adds a level of indirection

@enkore
Copy link
Contributor

enkore commented Apr 9, 2012

I looked trough most stuff that Notch put out and never notices anything like that, but I guess it will be added, as its nothing the CPU must do but rather the assembler.

@andre-d
Copy link
Contributor

andre-d commented Apr 9, 2012

Correct, it is an assembler feature common to many assemblers. I don't know if any DCPU-16 assemblers have it yet though.

@enkore
Copy link
Contributor

enkore commented Apr 9, 2012

We could add this with a prepended dot to make clear, that this is assembler specific:

.equ label value

Nearly every assembler uses this style to create his own extensions... btw. we can also add inclusion functionality; I guess that's something useful, too:

.include "file.asm"

@jtauber
Copy link
Owner Author

jtauber commented Apr 9, 2012

another one to consider would be .org to indicate where to put the code

@enkore
Copy link
Contributor

enkore commented Apr 9, 2012

Ah you mean some way of setting the base address? That would be sweet, yea.

btw, I just wrote a short proposal for the Standards Comittee about equ, let's see what they say: 0x10cStandardsCommittee/0x10c-Standards#27

(edit)
As .org is something entirely different I created another proposal for this: 0x10cStandardsCommittee/0x10c-Standards#29

@enkore
Copy link
Contributor

enkore commented Apr 12, 2012

Update: Jarvix is, as far as I know, currently working on a RFCX about exactly this and some other stuff (conditional compilation and stuff like that)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants