NESASM lowbyte and highbyte tables?

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

Post Reply
User avatar
gravelstudios
Posts: 89
Joined: Mon Mar 13, 2017 5:21 pm
Contact:

NESASM lowbyte and highbyte tables?

Post by gravelstudios » Sat Jul 29, 2017 2:07 pm

I'm sorry if this has already been answered somewhere, but I really looked and couldn't find it.
I'd like to create pointer tables where the low bytes and high bytes are separated out like this example from the wiki:

Code: Select all

PointerTableL
  .db <Pointer1, <Pointer2

PointerTableH
  .db >Pointer1, >Pointer2
I'm trying to do this in NESASM and it gives a Syntax error. Is it possible to do this in NESASM? if not, I may finally have to switch to another assembler.

Pokun
Posts: 1759
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: NESASM lowbyte and highbyte tables?

Post by Pokun » Sat Jul 29, 2017 3:26 pm

Nesasm is using LOW(label) and HIGH(label) functions instead of <label and >label. And BTW doing <label in an instruction means zero page addressing.

User avatar
gravelstudios
Posts: 89
Joined: Mon Mar 13, 2017 5:21 pm
Contact:

Re: NESASM lowbyte and highbyte tables?

Post by gravelstudios » Sat Jul 29, 2017 4:00 pm

Thank you for the answer. I thought that I had already tried the functions that way and they didn't work, but I tried them again just now and they did, so I must have been doing something wrong before. I was already aware of using < for zero page. I programmed my entire first game without knowing that though, so I'm sure the code was running a lot slower than it should have been :) fortunately it was a pretty simple game.

Pokun
Posts: 1759
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: NESASM lowbyte and highbyte tables?

Post by Pokun » Sun Jul 30, 2017 4:05 am

Nesasm is very poorly documented, the readme doesn't explain all features of the assembler.

Apparently it's made from an old 6502 assembler and modified to make NES and PC Engine specific programs. Then at one point it was split up into two assemblers: PCEas and NESASM. PCEas has since been forked with lots of features including <, > and ^ as aliases for the LOW(), HIGH() and BANK() functions and removal of the mandatory 8k bank segments. But I don't think NESASM have gotten all these upgrades.

zzo38
Posts: 1077
Joined: Mon Feb 07, 2011 12:46 pm

Re: NESASM lowbyte and highbyte tables?

Post by zzo38 » Sun Jul 30, 2017 7:39 pm

I have made "Unofficial-MagicKit" which does have various upgrades (although not the < and > like that; it uses < for zero-page addressing), although it is probably even more confusing than PCEas and other assemblers. But it does mean that you can write a macro to write the tables for you so that you need not write them all by hand (you can even postprocess the tables if you need to).
[url=gopher://zzo38computer.org/].[/url]

Pokun
Posts: 1759
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: NESASM lowbyte and highbyte tables?

Post by Pokun » Mon Jul 31, 2017 3:30 am

Ah yes this one right? Lots of new features! But you never removed the 8k banks did you? That is what I think most people dislike the most about Magickit/PCEas/NESASM.

I'm pretty sure Elmer's fork of PCEas still uses < for zero page addressing while using <, > and ^ aliases for the mentioned functions. I don't know if he had to do something special to make sure it doesn't conflict.

Actullay the use of < for zero page addressing is one thing I like about Magickit/PCEas/NESASM. It makes it clear that you are using zero page addressing (if I remember to use it that is), and it makes it possible to choose which addressing mode you want (if you need it for timing or whatever). ASM6 always assumes zero page addressing when using zero page registers.

zzo38
Posts: 1077
Joined: Mon Feb 07, 2011 12:46 pm

Re: NESASM lowbyte and highbyte tables?

Post by zzo38 » Mon Jul 31, 2017 9:11 am

Pokun wrote:Ah yes this one right? Lots of new features! But you never removed the 8k banks did you? That is what I think most people dislike the most about Magickit/PCEas/NESASM.
True, but it can be mitigated by "bank chaining", where you declare the chained 8K banks ahead of time with the same name, and it will automatically go to the next 8K bank if it is already defined with the same name as the current bank.
I'm pretty sure Elmer's fork of PCEas still uses < for zero page addressing while using <, > and ^ aliases for the mentioned functions. I don't know if he had to do something special to make sure it doesn't conflict.
It doesn't seem difficult to me, since using < for zero page already implies the low 8-bits (although perhaps sometimes it can make it more difficult to detect errors).
Actullay the use of < for zero page addressing is one thing I like about Magickit/PCEas/NESASM. It makes it clear that you are using zero page addressing (if I remember to use it that is), and it makes it possible to choose which addressing mode you want (if you need it for timing or whatever).
Yes, it is one of the things I like about it too.
[url=gopher://zzo38computer.org/].[/url]

Post Reply