1 // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
2 // Copyright (C) 1999-2003 Forgotten
3 // Copyright (C) 2004 Forgotten and the VBA development team
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2, or(at your option)
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #define debuggerWriteHalfWord(addr, value) \
27 WRITE16LE((u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask], (value))
29 #define debuggerReadHalfWord(addr) \
30 READ16LE(((u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask]))
32 static bool agbPrintEnabled
= false;
33 static bool agbPrintProtect
= false;
35 bool agbPrintWrite(u32 address
, u16 value
)
38 if(address
== 0x9fe2ffe) { // protect
39 agbPrintProtect
= (value
!= 0);
40 debuggerWriteHalfWord(address
, value
);
44 ((address
>= 0x9fe20f8 && address
<= 0x9fe20ff) // control structure
45 || (address
>= 0x8fd0000 && address
<= 0x8fdffff)
46 || (address
>= 0x9fd0000 && address
<= 0x9fdffff))) {
47 debuggerWriteHalfWord(address
, value
);
57 agbPrintProtect
= false;
60 void agbPrintEnable(bool enable
)
62 agbPrintEnabled
= enable
;
65 bool agbPrintIsEnabled()
67 return agbPrintEnabled
;
70 extern void (*dbgOutput
)(char *, u32
);
74 u16 get
= debuggerReadHalfWord(0x9fe20fc);
75 u16 put
= debuggerReadHalfWord(0x9fe20fe);
77 u32 address
= (debuggerReadHalfWord(0x9fe20fa) << 16);
78 if(address
!= 0xfd0000 && address
!= 0x1fd0000) {
79 dbgOutput("Did you forget to call AGBPrintInit?\n", 0);
80 // get rid of the text otherwise we will continue to be called
81 debuggerWriteHalfWord(0x9fe20fc, put
);
85 u8
*data
= &rom
[address
];
93 if(systemVerbose
& VERBOSE_AGBPRINT
)
98 debuggerWriteHalfWord(0x9fe20fc, get
);