General ASM6 Questions

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

frantik
Posts: 370
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik »

got it to compile with VC studio.

I wanted to implement the {} syntax allowing multilines, but unfortunately I see that the program operates fundamentally on a line by line basis.. i was able to hack in something in the processfile function so that processline was passed multiple lines but it doesn''t work right at all of course.. the best error i got was "extra characters on line"

i think the best i can hope for now is to see if i can do something with a preprocessor
frantik
Posts: 370
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik »

what is the difference between these two ways of defining variables?

Code: Select all

xyz = $00
and

Code: Select all

enum $000
xyz	.byte 0
ende
it seems like LDA xyz would work the same either way
User avatar
loopy
Posts: 403
Joined: Sun Sep 19, 2004 10:52 pm
Location: UT

Post by loopy »

frantik wrote:what is the difference between these two ways of defining variables?
The first way takes 1 line of code, the second way takes 3 lines.
:P

They both do the same thing.
frantik
Posts: 370
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik »

lol ok :D so there's no difference at all?

this should work the same way in either case then?

Code: Select all

LDA #>xyz
LDA #<xyz
User avatar
loopy
Posts: 403
Joined: Sun Sep 19, 2004 10:52 pm
Location: UT

Post by loopy »

Yes.
frantik
Posts: 370
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik »

thanks :)
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

frantik wrote:what is the difference between these two ways of defining variables?
The second way is just more flexible. It might not make much of a difference if you have few variables, but what if you have dozens of them after xyz and you decide to make xyz a 16-bit variable instead of 8-bit? If you declared the variables the first way, you'll have to manually modify each one in order to make room for the extra byte of xyz. If you did it the second way, you could just change that ".byte 0" to ".byte 0, 0", ".dsb 2", or anything else that reserves 2 bytes, and all the other variables would automatically move 1 byte forward.

The second way is THE way to go if you plan on moving your variables around. I do that a lot, because as my programs grow I always feel the need to rearrange the variables in ways that make more sense (grouping similar variables and things like that).
frantik
Posts: 370
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik »

yeah i can see why you would use each one, I just wasn't 100% sure if there was a technical difference. I mostly was asking because I want to set up certain variables in a header file to always be in the same location regardless of the program and it seemed like using = might be better than enum for a handful of variables
frantik
Posts: 370
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik »

Labels defined inside macros are local (visible only to that macro).
is it possible to add a second macro type which allows labels defined inside of macro to be visible?

kind of like an advanced multiline EQU?

Code: Select all

replace function @functionName, @x
   @functionName:
      @x = 1
endreplace

function foo, bar 
   lda bar
   rts
would convert to

Code: Select all

foo:
   bar = 1
   lda bar
   rts
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

I just found a bug in ASM6 that's bothering me a lot. If the labels start with the letter "a", I can't use them with instructions such as ASL and LSR (the error is "Extra characters on line").

It's probably because of the alternate syntax where you specify the accumulator as an operand even though it's implied, so the rest of the label's name is seen as "extra characters". This was driving me nuts, because I simply couldn't tell what was wrong with this specific variable.

Loopy, do you think you can fix this? For now I put "0+" before the label, but that's ugly as shit. And even though I could change the variable's name, it sucks that there's a letter we simply can't use as the first character.
User avatar
Hamtaro126
Posts: 783
Joined: Thu Jan 19, 2006 5:08 pm

Post by Hamtaro126 »

tokumaru wrote:I just found a bug in ASM6 that's bothering me a lot. If the labels start with the letter "a", I can't use them with instructions such as ASL and LSR (the error is "Extra characters on line").

It's probably because of the alternate syntax where you specify the accumulator as an operand even though it's implied, so the rest of the label's name is seen as "extra characters". This was driving me nuts, because I simply couldn't tell what was wrong with this specific variable.

Loopy, do you think you can fix this? For now I put "0+" before the label, but that's ugly as shit. And even though I could change the variable's name, it sucks that there's a letter we simply can't use as the first character.
The C(++) source is included in ASM6.ZIP, So anyone can fix it!

If you already know C(++), then you already know how to fix bugs/glitches in ASM6,
AKA SmilyMZX/AtariHacker.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Yeah, I have the source, but I hate to mess with other people's programs. Even if I can find the exact location of the bug, I can't be sure I won't break something else by accident since I don't have a good understanding of the whole program.
User avatar
loopy
Posts: 403
Joined: Sun Sep 19, 2004 10:52 pm
Location: UT

Post by loopy »

tokumaru wrote:Loopy, do you think you can fix this? For now I put "0+" before the label, but that's ugly as shit. And even though I could change the variable's name, it sucks that there's a letter we simply can't use as the first character.
Fixed.
User avatar
Hamtaro126
Posts: 783
Joined: Thu Jan 19, 2006 5:08 pm

Post by Hamtaro126 »

And for a additional command, I would like to see:

Code: Select all

.ASCIITBL

;Letters

"0"..."9" = $00
"A"..."Z" = $0A

;Times symbol

"x" = $29

;Space

$32 = $24

;Copyright

"c" = $df
.end

.org $8000

;Text (Data)

Hello:
.asc "HELLO WORLD"

like x816 and WLADX. Can you add it in the next version?
AKA SmilyMZX/AtariHacker.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

loopy wrote:Fixed.
Cool! BTW, nice going with the local labels, that is a very welcomed feature.
Post Reply