| |
Sasq
Registered: Apr 2004 Posts: 155 |
Wanted: Source codes (for badass)
In order to improve my assembler it would be great to try it on existing projects.
So if you have sources for demos/intros/games that you don't mind sharing it would be kind if you could send them my way, and I'll try to get them working in bass.
They need to be buildable the normal way (Kickass, Acme or whatever) so I can compare the output binaries...
(this also means that if your type of demos requires special tools there is a greater chance I will include such functionality in bass).
-- sasq64@gmail.com |
|
... 65 posts hidden. Click here to view all posts.... |
| |
tlr
Registered: Sep 2003 Posts: 1732 |
Quote: Quoting tlrwhat about the parent scope, or an absolute reference, i.e from the global scope? Just a quick shot without thinking much about it, but what about a ".." prefix to go up/out one scope, similar to traversing folder structures? Would be something like "..outer.inner" to reach a same-level scope's inner symbol. Could be enhanced for "..." to go up two scopes, etc.
A fully qualified path starting from the global scope could be prefixed with ":", e.g., ":scope.child.grandchild".
@p.* and @g.* sure are not pretty. :)
I've thought about '..' as well. Somewhat analogous to file system paths but I'm not fully happy with that either. In 64tass '..' is the string concatenation operator, and that's quite nice.
':' would be similar to Amiga OS path specifiers I guess. An alternative would be a '/' analogous to a *nix path. I prefer ':' though.
I couldn't find a good comparison on how this works in different languages. |
| |
Krill
Registered: Apr 2002 Posts: 2857 |
Quoting tlrI couldn't find a good comparison on how this works in different languages. ":" is more "languagy" compared to "/". :) See https://en.wikipedia.org/wiki/Scope_resolution_operator and maybe also https://erlang.org/doc/reference_manual/expressions.html#functi.. or https://www.w3.org/TR/1999/REC-xml-names-19990114/#ns-qualnames.
".." for string concatenation... hmm, does "+" not work due to ambiguities or so? :) |
| |
tlr
Registered: Sep 2003 Posts: 1732 |
Quote: Quoting tlrI couldn't find a good comparison on how this works in different languages. ":" is more "languagy" compared to "/". :) See https://en.wikipedia.org/wiki/Scope_resolution_operator and maybe also https://erlang.org/doc/reference_manual/expressions.html#functi.. or https://www.w3.org/TR/1999/REC-xml-names-19990114/#ns-qualnames.
".." for string concatenation... hmm, does "+" not work due to ambiguities or so? :)
Thanks for the links!
Do you mean languagy (<- is that even a word :) as in computer languagy? I've never seen '..' used for this purpose. Feels a bit messy syntax-wise to me as the scope separator uses the same descriptor as the reference to the parent scope, especially if referencing to parents higher up, e.g '....scope1.scope2.label', etc...
I guess that could be relieved with something like '(..).scope1' or similar. Maybe (/).scope1 would work for global?
I believe '+' does not work for that purpose in 64tass because constants may be (always?) 'bit strings'. This means concatenation is a valid operation and is different from addition.
Soci might be able to elaborate on this. |
| |
soci
Registered: Sep 2003 Posts: 474 |
"+" is for numerical sum only because calculations may be performed with strings. For example 1 - 'a' + 'z' is 26 (if letters are encoded in a sequence). Therefore concatenation must have a different operator.
As for means of access to a specific parent scope (without using it's name) I see little value in that. It's a good idea to name labels meant for cross-scope access unique while stacking up scopes. That way there's no confusion over which label or scope in which parent scope is referenced in a child.
If there's an "lp2" two levels up which needs access but there's another "lp2" in the current or the immediate parent and writing "something.lp2" isn't an option either (as "something" was reused too) then adding an unnamed parent access on top of that won't really improve the situation in my opinion. |
| |
tlr
Registered: Sep 2003 Posts: 1732 |
Quoting sociAs for means of access to a specific parent scope (without using it's name) I see little value in that. It's a good idea to name labels meant for cross-scope access unique while stacking up scopes. That way there's no confusion over which label or scope in which parent scope is referenced in a child.
I'm thinking this might be useful for exporting a label beyond something akin to your .block or .proc scope, e.g having an entry point different than the first byte in the block.
But having said that, how to you access a named parent scope in 64tass? |
| |
Krill
Registered: Apr 2002 Posts: 2857 |
Quoting soci"+" is for numerical sum only because calculations may be performed with strings. For example 1 - 'a' + 'z' is 26 (if letters are encoded in a sequence). Therefore concatenation must have a different operator. I thought single quotes would denote chars (which allow arithmetics) and double quotes strings. This would neatly allow + for string concatenation, as it does in C++ and other languages. |
| |
tlr
Registered: Sep 2003 Posts: 1732 |
Quoting KrillI thought single quotes would denote chars (which allow arithmetics) and double quotes strings. This would neatly allow + for string concatenation, as it does in C++ and other languages.
Me too, although "c" is quite common in this context as well. It starts to get a bit tricky once you add multiple data types.
Btw, another use for parent is to break out of relocated origin addresses. For instance finding out the "parent" pc of a relocated part of the code. This may be done in more than one level.
Maybe not be entierly related though as .logical/.here or .rorg/.rend and friends needn't be scopes per se. It could be entierly orthogonal but I'm not sure what to call it except "parent". |
| |
soci
Registered: Sep 2003 Posts: 474 |
Label of a block is always at its start. However it does not have to be used as an entry point. Usually for such special functions I write something like below:
*=$1000
.1000 20 06 10 jsr $1006 jsr stuff
=$1006 stuff = (+).entry
.1003 + .proc
.1003 9d 00 04 sta $0400,x lp sta $400,x
.1006 entry
.1006 e8 inx inx
.1007 d0 fa bne $1003 bne lp
.1009 60 rts rts
.pend
An anonymous symbol was used as it's only used in the expression above to get the entry point.
Named parent scope access is exactly what it sounds:
b1 .block
label1
b2a .block
label2
.bend
b2b .block
c1 .block
jsr b1.label1
jmp b1.b2a.label2
jmp b2a.label2
.bend
.bend
.bend
After all labels of parent scopes are visible for children.
It's not like I had much choice as the C64 TASM uses double quotes for both literals and strings. Therefore there's no special casing for character literals. Single quotes can be used for easy enclosing of text containing double quotes.
.1000 a9 93 lda #$93 lda #"{clr}"
.1002 20 d2 ff jsr $ffd2 jsr $ffd2
.al
.1005 a9 49 44 lda #$4449 lda #"id"
.1008 8d 00 04 sta $0400 sta $400
Yes it may take a while to remember the concatenation operator but it's not impossible to get used to it.
As for "parent" PC I usually just put a label in front:
*=$1000
.1000 label .logical $800
>1000 0800 00 10 .word label
.here
Such a label is more useful for the installer code than the relocated one. As a .logical/.here block is just a relocation and so there's no label scoping.
But I see the point. If an assembler insists to scope every block then tough luck. |
| |
tlr
Registered: Sep 2003 Posts: 1732 |
Quoting sociLabel of a block is always at its start. However it does not have to be used as an entry point. Usually for such special functions I write something like below:
*=$1000
.1000 20 06 10 jsr $1006 jsr stuff
=$1006 stuff = (+).entry
.1003 + .proc
.1003 9d 00 04 sta $0400,x lp sta $400,x
.1006 entry
.1006 e8 inx inx
.1007 d0 fa bne $1003 bne lp
.1009 60 rts rts
.pend
An anonymous symbol was used as it's only used in the expression above to get the entry point.
That's quite good. I wasn't sure if the constant assignment itself would trigger generation of the .proc contents.
Quoting sociNamed parent scope access is exactly what it sounds:
b1 .block
label1
b2a .block
label2
.bend
b2b .block
c1 .block
jsr b1.label1
jmp b1.b2a.label2
jmp b2a.label2
.bend
.bend
.bend
After all labels of parent scopes are visible for children.
So scope lookup works the same as symbol lookup in 64tass? I.e search all scopes towards the global scope until it matches?
This isn't an entierly obvious behaviour to me, but perhaps it makes sense.
Being able to put stuff in the global scope is useful for implementing stateful behaviour of macros perhaps. The "start" macro could push stuff to a global stack and the "end" macro could pop it back, effectively implementing scope like behaviour.
Using your search method there is automatically a way to address the global scope, assuming it has a unique name and was already defined. But would it be reasonable to be able to _define_ stuff outside the local scope?
Quoting sociAs for "parent" PC I usually just put a label in front:
*=$1000
.1000 label .logical $800
>1000 0800 00 10 .word label
.here
Such a label is more useful for the installer code than the relocated one. As a .logical/.here block is just a relocation and so there's no label scoping.
As an example in the freezer of superfluid I generate a depacking stub by copying it into place and then updating a couple of key variables at that location. The stub itself contains parts that are relocated so I have stacked relocations going on. Currently this is assembled in stages and there are separate calculations to find out the address of the various modification points.
Quoting sociBut I see the point. If an assembler insists to scope every block then tough luck.
I personally avoid an explicit scope for relocated origin too. Again in superfluid I even enter and exit the relocated scope within macros ENTER_ULTIMAX and EXIT_ULTIMAX which moves execution from $8000 space to $e000 space and vice versa. This would be impossible if this relocation was a scope.
I guess the struggle is to define (in a comprehendable way) at what stage different things get translated. |
| |
Krill
Registered: Apr 2002 Posts: 2857 |
Fresh 64tass syntax code to test against: Transwarp V0.64 =) |
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 - Next |