ca65 .charmap range error

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
Cyneprepou4uk
Posts: 24
Joined: Fri Jun 21, 2019 12:20 am
Location: Belarus

ca65 .charmap range error

Post by Cyneprepou4uk »

Hi. I'm disassembling Castlevania 3, and I need to write "My name is Grant." phrase in my assembly file the same way as in original ROM. I'm using .charmap control command to redefine bytes for symbols.

The problem I'm dealing with is I can't neither redefine byte $00 nor define something to byte $00.

Code: Select all

.charmap $00, $DB   ; .
.charmap $20, $00   ; space

; any of these 2 lines will throw "range error" when compiling
So instead of

Code: Select all

.byte "My name is Grant."
I have to write it like this

Code: Select all

.byte "My", $00, "name", $00, "is", $00, "Grant", $DB
Is there a way to get rid of that error? Here is an example archive with relevant stuff only, if you need to test something.
Attachments
test.zip
(130.54 KiB) Downloaded 86 times
Last edited by Cyneprepou4uk on Fri Feb 12, 2021 9:30 am, edited 1 time in total.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: ca65 .charmap range error

Post by rainwarrior »

cc65 has:

Code: Select all

#pragma warn (remap-zero, push, off)
I'm not sure if there's something equivalent for assembly... if you can't find something suitable, you might be able to just eliminate range checks with:

Code: Select all

.feature force_range
yaros
Posts: 47
Joined: Tue Aug 28, 2018 8:54 am

Re: ca65 .charmap range error

Post by yaros »

Which is weird, because error check to include 0 in ca65 was removed in 2005 according to blame.
https://github.com/cc65/cc65/blob/3cace ... udo.c#L625
But still exists in cc65
https://github.com/cc65/cc65/blob/2646c ... gma.c#L603


edit: ah!
That's because you use ca65 from 2003.

Code: Select all

d:\Temp\c65>ca65 --version
ca65 V2.10.0 - (C) Copyright 1998-2003 Ullrich von Bassewitz
Download new version here https://cc65.github.io/

https://www.cc65.org/ is NOT correct site and no longer supported (been there done that).
Post Reply