cj7hawk
Veteran Member
Hi All,
I'm just rewriting my z80 assembler in z80 this time ( So it can assemble itself - and will be compatible with the cross-assembler I use under Windows11) - and had some thoughts about whether to change aspects of it and thought I'd throw a couple of questions out to the forum.
First is should a label be possible to reassign mid-assembly? Generally this should cause an exception, but if allowed, would let you cut and past code segments and change constants without changing the source code.
My thinking on this one is fail on the first pass, but are there any assemblers that allow reassignment of constants and is this ever of value?
Second, is how long should a label be allowed to get? 11 characters? 16 characters? 24 characters? 32 characters? 79 characters?
I'm still building the lexical analyzer at the moment, and want to get these things right.
Thirdly, what operators should be allowed on functions?
Add, Subtract, Divide, Multiply, AND, OR, MOD, XOR, Invert, Shift left/right, Neg ( though NEG can also be invert+1 ) - And is there any standard as to what symbols should be used to represent these functions? And with z80 is there any valid reason to calculate a result more than 16 bits in the assembler? - eg, LD HL, 100000 / 5
Forthly, how useful are macros ? Or includes? And how to best use them?
For example, an include could "chain" another assembly file to the current, or could be as simple as reading it during the first pass and picking up labels for jumps. Or they could be two different things... And Macros can be confusing in assembly and promote bad code that is difficult to read, and a good assembler should be able to do everything in the line... Including flipping 8th bit on text strings, etc. What should a Macro do that you can't do in the general assembly file itself?
Fifthly, I'm looking to use . as a "null" character - that except in quotes, is simply ignored by everything... So .ORG and ORG are valid, and it can be used to help with readability - eg, .EQU MASK,%0000.0011.1111.1111
Finally, should a line have length limits or wrap around? or should it just read until EOL is reached, ignoring everything after the comment until the final EOL is found assuming whitespace after the intial command is to be ignored? so that LD HL , 10 would be the same as LD HL,10 without spaces.
Would love to head some thoughts on what a good assemble should support and what it doesn't need to,
Thanks
David
I'm just rewriting my z80 assembler in z80 this time ( So it can assemble itself - and will be compatible with the cross-assembler I use under Windows11) - and had some thoughts about whether to change aspects of it and thought I'd throw a couple of questions out to the forum.
First is should a label be possible to reassign mid-assembly? Generally this should cause an exception, but if allowed, would let you cut and past code segments and change constants without changing the source code.
My thinking on this one is fail on the first pass, but are there any assemblers that allow reassignment of constants and is this ever of value?
Second, is how long should a label be allowed to get? 11 characters? 16 characters? 24 characters? 32 characters? 79 characters?
I'm still building the lexical analyzer at the moment, and want to get these things right.
Thirdly, what operators should be allowed on functions?
Add, Subtract, Divide, Multiply, AND, OR, MOD, XOR, Invert, Shift left/right, Neg ( though NEG can also be invert+1 ) - And is there any standard as to what symbols should be used to represent these functions? And with z80 is there any valid reason to calculate a result more than 16 bits in the assembler? - eg, LD HL, 100000 / 5
Forthly, how useful are macros ? Or includes? And how to best use them?
For example, an include could "chain" another assembly file to the current, or could be as simple as reading it during the first pass and picking up labels for jumps. Or they could be two different things... And Macros can be confusing in assembly and promote bad code that is difficult to read, and a good assembler should be able to do everything in the line... Including flipping 8th bit on text strings, etc. What should a Macro do that you can't do in the general assembly file itself?
Fifthly, I'm looking to use . as a "null" character - that except in quotes, is simply ignored by everything... So .ORG and ORG are valid, and it can be used to help with readability - eg, .EQU MASK,%0000.0011.1111.1111
Finally, should a line have length limits or wrap around? or should it just read until EOL is reached, ignoring everything after the comment until the final EOL is found assuming whitespace after the intial command is to be ignored? so that LD HL , 10 would be the same as LD HL,10 without spaces.
Would love to head some thoughts on what a good assemble should support and what it doesn't need to,
Thanks
David