Skip to content

Absolute / zeropage addressing not working as expected #8

@phillipeaton

Description

@phillipeaton

Following on from the forceaddr off issue, I had a problem with as65 not assembling and that's why I was attempting workarounds with forceaddr:

image

A bit of research shows that the 6809-style >z009d isn't used for 6502 assembly. Here are some assembler manual links that describe how they deal with absolute and zeropage addressing.

This in the best description: ACME Assembler

This is also good: KickAssembler

And this one: DASM (PDF page 61/62, manual page 52/53)

And one more that shows it in action:
image

Generally it seems, there are two ways of managing absolute/zero page addressing:

  1. The old way where the assembler decides by the number of characters in the number, $nn = zero page, $nnnn = absolute.
  2. The modern way where you append a .z or .a to the lda.

It seems to me that all the assemblers I looked at recognize 1. and newer assemblers recognize 1. & 2. There appear to be other forcing parameters also that some assemblers recognize, but I'm not sure they're really necessary, Kick Assembler has specifically deprecated them all, apart from .z/.a.

The as65 assembler specifically complains about the jsr >z009d, probably because jsr is always uses a 16 bit address. I get four jsr errors in my listing, but there are many other instructions with this address mode e.g. asl >m0000 that do not throw an error. It would appear '>' is valid for addresses, but, from what I can tell, it's for manipulating the address data at assemble time, not selecting address mode. I still have a lot of non-matching code between the original binary and the dissassembled/reassembled binary, so I will look into this a bit more and report back.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions