Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2020-10-31 05:03:41

Koop the Koopa
New member
Registered: 2020-10-31
Posts: 6
Website

WARNING: Possibly wrote twice at addr xxxx (xx->xx)

Hello, I am new here!
I am making a Game Boy Game that used GBT Player for music.
So I was making music, converting the music with mod2gbt and
then used ROM Banks for the music but it game me this:

WARNING: possibly wrote twice at addr 4000 (A5->12)
WARNING: possibly wrote twice at addr 4001 (D7->11)
WARNING: possibly wrote twice at addr 4002 (C9->DC)
WARNING: possibly wrote twice at addr 4003 (E1->C7)
WARNING: possibly wrote twice at addr 4004 (BC->3E)
WARNING: possibly wrote twice at addr 4006 (76->12)
WARNING: possibly wrote twice at addr 4007 (31->11)
WARNING: possibly wrote twice at addr 4008 (0C->DD)
WARNING: possibly wrote twice at addr 4009 (BA->C7)
WARNING: possibly wrote twice at addr 400a (DE->3E)
WARNING: possibly wrote twice at addr 400c (1B->12)
WARNING: possibly wrote twice at addr 400d (CA->11)
WARNING: possibly wrote twice at addr 400e (03->DE)
WARNING: possibly wrote twice at addr 400f (93->C7)
WARNING: possibly wrote twice at addr 4010 (F0->3E)
WARNING: possibly wrote twice at addr 4012 (D2->12)
WARNING: possibly wrote twice at addr 4013 (C3->11)
WARNING: possibly wrote twice at addr 4014 (B4->DF)
WARNING: possibly wrote twice at addr 4015 (A5->C7)
WARNING: possibly wrote twice at addr 4016 (96->3E)
WARNING: possibly wrote twice at addr 4018 (78->12)
WARNING: possibly wrote twice at addr 4019 (69->11)
WARNING: possibly wrote twice at addr 401a (5A->E0)
WARNING: possibly wrote twice at addr 401b (4B->C7)
WARNING: possibly wrote twice at addr 401c (3C->3E)
WARNING: possibly wrote twice at addr 401d (2D->F0)
WARNING: possibly wrote twice at addr 401e (1E->12)
WARNING: possibly wrote twice at addr 401f (0F->11)
WARNING: possibly wrote twice at addr 4020 (FD->E1)
WARNING: possibly wrote twice at addr 4021 (EC->C7)
WARNING: possibly wrote twice at addr 4022 (DB->3E)
WARNING: possibly wrote twice at addr 4023 (CA->F0)
WARNING: possibly wrote twice at addr 4024 (B9->12)
WARNING: possibly wrote twice at addr 4025 (A8->11)
WARNING: possibly wrote twice at addr 4026 (97->E2)
WARNING: possibly wrote twice at addr 4027 (86->C7)
WARNING: possibly wrote twice at addr 4028 (79->3E)
WARNING: possibly wrote twice at addr 4029 (68->F0)
WARNING: possibly wrote twice at addr 402a (57->12)
WARNING: possibly wrote twice at addr 402b (46->11)
WARNING: possibly wrote twice at addr 402c (35->E3)
WARNING: possibly wrote twice at addr 402d (24->C7)
WARNING: possibly wrote twice at addr 402e (13->3E)
WARNING: possibly wrote twice at addr 402f (02->F0)
WARNING: possibly wrote twice at addr 4030 (DE->12)
WARNING: possibly wrote twice at addr 4031 (FE->11)
WARNING: possibly wrote twice at addr 4032 (DC->E4)
WARNING: possibly wrote twice at addr 4033 (BA->C7)
WARNING: possibly wrote twice at addr 4034 (9A->3E)
WARNING: possibly wrote twice at addr 4035 (A9->E0)
WARNING: possibly wrote twice at addr 4036 (87->12)
WARNING: possibly wrote twice at addr 4037 (77->11)
WARNING: possibly wrote twice at addr 4038 (88->E5)
WARNING: possibly wrote twice at addr 4039 (87->C7)
WARNING: possibly wrote twice at addr 403a (65->3E)
WARNING: possibly wrote twice at addr 403b (56->F0)
WARNING: possibly wrote twice at addr 403c (54->12)
WARNING: possibly wrote twice at addr 403d (32->11)
WARNING: possibly wrote twice at addr 403e (10->E6)
WARNING: possibly wrote twice at addr 403f (12->C7)
WARNING: possibly wrote twice at addr 4040 (AB->3E)
WARNING: possibly wrote twice at addr 4041 (CD->E0)
WARNING: possibly wrote twice at addr 4042 (EF->12)
WARNING: possibly wrote twice at addr 4043 (ED->11)
WARNING: possibly wrote twice at addr 4044 (CB->E7)
WARNING: possibly wrote twice at addr 4045 (A0->C7)
WARNING: possibly wrote twice at addr 4046 (12->3E)
WARNING: possibly wrote twice at addr 4047 (3E->E0)
WARNING: possibly wrote twice at addr 4048 (DC->12)
WARNING: possibly wrote twice at addr 4049 (BA->11)
WARNING: possibly wrote twice at addr 404a (BC->E8)
WARNING: possibly wrote twice at addr 404b (DE->C7)
WARNING: possibly wrote twice at addr 404c (FE->3E)
WARNING: possibly wrote twice at addr 404d (DC->C0)
WARNING: possibly wrote twice at addr 404e (32->12)
WARNING: possibly wrote twice at addr 404f (10->11)
WARNING: possibly wrote twice at addr 4050 (FF->E9)
WARNING: possibly wrote twice at addr 4051 (EE->C7)
WARNING: possibly wrote twice at addr 4052 (DD->3E)
WARNING: possibly wrote twice at addr 4053 (CC->E0)
WARNING: possibly wrote twice at addr 4054 (BB->12)
WARNING: possibly wrote twice at addr 4055 (AA->11)
WARNING: possibly wrote twice at addr 4056 (99->EA)
WARNING: possibly wrote twice at addr 4057 (88->C7)
WARNING: possibly wrote twice at addr 4058 (77->3E)
WARNING: possibly wrote twice at addr 4059 (66->C0)
WARNING: possibly wrote twice at addr 405a (55->12)
WARNING: possibly wrote twice at addr 405b (44->11)
WARNING: possibly wrote twice at addr 405c (33->EB)
WARNING: possibly wrote twice at addr 405d (22->C7)
WARNING: possibly wrote twice at addr 405e (11->3E)
WARNING: possibly wrote twice at addr 405f (00->C0)
WARNING: possibly wrote twice at addr 4060 (FF->12)
WARNING: possibly wrote twice at addr 4061 (FF->11)
WARNING: possibly wrote twice at addr 4062 (FF->EC)
WARNING: possibly wrote twice at addr 4063 (FF->C7)
WARNING: possibly wrote twice at addr 4064 (FF->3E)
WARNING: possibly wrote twice at addr 4065 (FF->80)
WARNING: possibly wrote twice at addr 4066 (FF->12)
WARNING: possibly wrote twice at addr 4067 (FF->11)
WARNING: possibly wrote twice at addr 4068 (00->ED)
WARNING: possibly wrote twice at addr 4069 (00->C7)
WARNING: possibly wrote twice at addr 406a (00->3E)
WARNING: possibly wrote twice at addr 406b (00->C0)
WARNING: possibly wrote twice at addr 41fe (28->12)...


I even used extern variables in the game.

Am I doing something wrong here?


This is the make.bat file:

path=C:\GBDK\BIN
@echo off
cls
if exist *.o del *.o
if exist *.map del *.map
if exist *.sym del *.sym
if exist *.lst del *.lst
if exist *.gb del *.gb
echo Compiling... Main.c
lcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -c -o main.o main.c
echo Compiling... gbt_player.s
lcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -c -o gbt_player.o music/gbt_player.s
echo Compiling... gbt_player_bank1.s
lcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -c -o gbt_player_bank1.o music/gbt_player_bank1.s
echo Compiling... music/TitleMusic.c
lcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -c -o TitleMusic.o music/TitleMusic.c
echo Linking...
lcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -Wl-yt26 -Wl-yo16 -Wl-ya4 -o OCLand.gb main.o TitleMusic.o gbt_player.o gbt_player_bank1.o
pause

Last edited by Koop the Koopa (2020-10-31 05:09:42)

Offline

 

#2 2020-10-31 05:54:22

toxa
Member
Registered: 2020-02-13
Posts: 305

Re: WARNING: Possibly wrote twice at addr xxxx (xx->xx)

You have too much code in bank0 that overgrows into bank1, and it gets overwritten with something you put there.

You also using outdated version of gbdk - better try gbdk-2020, but first solve your issue, because the new gbdk-2020 toolchain does not give those errors, you just silently get a broken rom.

Last edited by toxa (2020-10-31 05:58:32)

Offline

 

#3 2020-11-02 10:18:57

Koop the Koopa
New member
Registered: 2020-10-31
Posts: 6
Website

Re: WARNING: Possibly wrote twice at addr xxxx (xx->xx)

Ok, all I have to do is switch to GBDK-2020 And it works! Thanks alot!
Sorry for the late reply, I was not bothered doing it until now tongue

Offline

 

#4 2020-11-02 14:03:53

toxa
Member
Registered: 2020-02-13
Posts: 305

Re: WARNING: Possibly wrote twice at addr xxxx (xx->xx)

no. smile you just get broken code. read carefully what i said above.

Offline

 

#5 2020-11-03 02:22:50

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: WARNING: Possibly wrote twice at addr xxxx (xx->xx)

Hey Toxa
I didn't know the new linker doesn't warn you about this... maybe we should open a bug because that message it's very useful
How else do you know if a bank is overflowing?

Offline

 

#6 2020-11-03 14:50:24

toxa
Member
Registered: 2020-02-13
Posts: 305

Re: WARNING: Possibly wrote twice at addr xxxx (xx->xx)

well, i'm not sure, we should look into it, but if linker produces ihx that has overlapping paragrahps, then it is very easily checked after the linking stage, but before makebin stage.

Offline

 

#7 2020-11-03 15:47:37

toxa
Member
Registered: 2020-02-13
Posts: 305

Re: WARNING: Possibly wrote twice at addr xxxx (xx->xx)

yes, it can be easily checked before makebin:

Code:

#!/usr/bin/env python3
import sys
from intelhex import IntelHex

def checkhex(fname):
    ih = IntelHex(fname)

if __name__=='__main__':
    checkhex(sys.argv[1])

gives this error:

Code:

Traceback (most recent call last):
  File "check.py", line 11, in <module>
    checkhex(sys.argv[1])
  File "check.py", line 7, in checkhex
    ih = IntelHex(fname)
  File "C:\Python\lib\site-packages\intelhex\__init__.py", line 90, in __init__
    self.loadhex(source)
  File "C:\Python\lib\site-packages\intelhex\__init__.py", line 212, in loadhex
    decode(s, line)
  File "C:\Python\lib\site-packages\intelhex\__init__.py", line 145, in _decode_record
    raise AddressOverlapError(address=addr, line=line)
intelhex.AddressOverlapError: Hex file has data overlap at address 0x4000 on line 601

which is absolutely correct, i intentionally made code overlap.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson