Search found 6 matches

by reesey-spoon
Sun Sep 26, 2021 11:01 pm
Forum: Newbies
Topic: ca65 range error when calculating address
Replies: 6
Views: 1323

Re: ca65 range error when calculating address



Indeed - so say for example, the target address is $8000, then >$8000 is $80 and <$8000 is $00, but by just taking 1 from the low byte you get: >$8000 = $80 and <$7FFF = $FF, so the resulting address is $80FF which isn't what you want, so >$7FFF = $7F and <$7FFF is $FF which is what you want.

So ...
by reesey-spoon
Sun Sep 26, 2021 6:25 pm
Forum: Newbies
Topic: ca65 range error when calculating address
Replies: 6
Views: 1323

Re: ca65 range error when calculating address


Try this:

addressTableH
.byte >(address00-1), etc
addressTableL
.byte <(address00-1), etc



I'm guessing the -1 NEEDS to be on both the High and Low address. I have been hunting down a bug for the past few days and I think its because, after reading your advice, I only but it on the low byte ...
by reesey-spoon
Sun Sep 12, 2021 9:28 pm
Forum: Newbies
Topic: scopes, modules, and symbols in ca65
Replies: 3
Views: 1191

Re: scopes, modules, and symbols in ca65



In C, I would make a header file and declare these before I defined them so they can be used in other modules (right?) and include the header file whenever I needed it. I am not sure what is the """"right way"""" to do this in assembly, but I have a vested interest in doing this per-industry ...
by reesey-spoon
Sat Sep 11, 2021 11:30 pm
Forum: Newbies
Topic: scopes, modules, and symbols in ca65
Replies: 3
Views: 1191

scopes, modules, and symbols in ca65

My project is getting quite large, and it can no longer fit in a main.s file with everything at global scope. I have started moving every module into its own scope, and it has made my code much more readable


jsr player::move
jsr player::bullets::move
jsr player::shoot
jsr enemies::move


however ...
by reesey-spoon
Wed Sep 01, 2021 6:10 pm
Forum: Newbies
Topic: ca65 range error when calculating address
Replies: 6
Views: 1323

Re: ca65 range error when calculating address

hoglet wrote:
Try this:

Code: Select all

addressTableH
    .byte >(address00-1), etc
addressTableL
    .byte <(address00-1), etc
Thank you! I'll try it tonight
by reesey-spoon
Wed Sep 01, 2021 5:57 pm
Forum: Newbies
Topic: ca65 range error when calculating address
Replies: 6
Views: 1323

ca65 range error when calculating address

I am using calculated addresses to push onto the stack and return from, but when I use


addressTableH
.byte >address00, etc
addressTableL
.byte <address00-1, etc


I get a range error (not within 255) whenever the lowbyte of an address is 0 and causes an underflow. I am sure there is a simple ...