| |
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 |
|
... 70 posts hidden. Click here to view all posts.... |
| |
Krill
Registered: Apr 2002 Posts: 2855 |
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: 1728 |
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: 1728 |
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: 2855 |
Fresh 64tass syntax code to test against: Transwarp V0.64 =) |
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 - Next |