			

		         ---== CBEBoy v0.51 eta ==---
			    --- by David Perez ---
			  CopyRight  1999, 2000, 2K1

 
 ////////////////////////////////////////////////////////////////////////////
 //                               INTRO					   //
 //////////////////////////////////////////////////////////////////////////// 

 Hi everybody, welcome to my Game Boy emulator. The name of this project is 
 CBEBoy, because my nickname is CBeard. CBEBoy is written enterily in C++ 
 using OOP with the gcc compiler, joined with the Allegro libraries.

 CBEBoy is still in beta stage so any images won't run correctly. Moreover, 
 the images of CGB (not MBC-5) will be seen in 4 colors mode.


 
 ////////////////////////////////////////////////////////////////////////////
 //                               FEATURES				   //
 ////////////////////////////////////////////////////////////////////////////
 
 CBEBoy features: 

	- Cartdridge header read.
	- CPU-z80 emulation.
	- Integrated dissassembler and debugger.
	- Support of ROM ONLY, MBC1, MBC2, MBC3, GB CAMERA and Hudson Hu-C1
	  rom types emulation (not RTC coded still for MBC3).
	- LCD emulation.
	- Interrupts of VBlank, LCD and Timer.
	- Virtual joypad (not using GB joypad int.)
	- Pallette effects.
	- Save Battery support.



 ////////////////////////////////////////////////////////////////////////////
 //                               HW NEEDED				   //
 ////////////////////////////////////////////////////////////////////////////

 Nowadays, if I put a frame skip of 3 or 4 the emu runs as the real Game Boy. 
 This is because of some strange bug.If you have a better computer than mine, 
 maybe you can play painting all the frames (fs=0). 

 My computer is: AMD K6-2 400 MHz, 
                 S3 Virge 3D 2MBytes graphics card,
                 64 MBytes of RAM.



 ////////////////////////////////////////////////////////////////////////////
 //                                 KEYS			           //
 ////////////////////////////////////////////////////////////////////////////

 Keys in DEBUG mode:
        - 'T' -> Trace   
        - 'D' -> Actualize Dump to ($value)
        - 'E' -> Execute to ($value) tracing every mnemonic until breakpoint 
                 at X
        - 'V' -> Execute until next VBlank interruption (0x40)
	- 'R' -> See the I/O registers status
        - 'C' -> Change the value of a memory position

	- '1' -> See Tile Info Status (TPT1 & TPT2)
	- '2' -> See VRAM status (256x256)
  	- '3' -> See BACKGROUND status (160x144)
  	- '4' -> See OAM status
  	- '5' -> See WINDOW status
  	- '6' -> See Palettes status of BG & WIN, OBJPAL0, OBJPAL1 

        - 'F1' -> Help 
  
 Keys in RUNNING mode:
	- Arrow Keys -> Up, Down, Left, Right 
	- '1' -> Start
	- '2' -> Select
 	- 'CONTROL' -> Button B
 	- 'ALT' -> Button A
 
 NOTE: Pressing TAB key, you can change between Running or Debug Mode, or
       from Debug to Running Mode.

 

 ////////////////////////////////////////////////////////////////////////////
 //                                HISTORY			           //
 ////////////////////////////////////////////////////////////////////////////

 v0.51 -> xx-xx-xx * At the moment, the most playable release ... *
 * Fixed some crashes in debug mode.
 * Keyboard interrupt installed. Works fine, now sprites can be moved 
   easily and speeder than before.
 * Repaired a failure when pressing two or more keys from the keyboard. 4
   buttons save in zelda now works perfect :D
 * Added a small help in debug mode when pressing F1 key.
 * Now values in RAM can be changed pressing key 'C' in debug mode. 
 * Fixed a bug in switching ROM banks when code wanted to access banks
   greather than 32. Note: Armaggedon Video Trailer ROM has got incorrect
   bad type MBC1 switching!
 * Repaired a big bug: when LY reaches line 0x90 my gfx engine always 
   paint the screen, jumping to the interrupt, inclusive when lcd was off.
   If lcd is off at LY = 0x90 no paint will be allowed.
 * Repaired a bug putting >> (right rotation) instead of << (left rotation)
   when looking for another interrupts different that VBlank.
 * OAM Priorities implemented between BG-WIN and OAM. 
 * OAM Priorities also corrected between sprites (the first on the OAM table 
   is the most prioritary OAM than others).
 * Fixed save file ram name when in the filename was a point before the point
   of the extension.

 v0.014 -> 28-09-00 * FIRST INTERNET RELEASE *
 * LCD int. now works fine but slow. By the moment, I have switched off 
   this option.
 * Thinking in make a new cpu in asm language. Problem: my version of 
   DJGPP is the v2.1 and it works with AT&T asm language. Is similar to
   intel asm but a little strange. Does the newer versions of DJGPP 
   supports intel asm :?
 * Compiled now with Allegro v3.12 and with a newer version of DJGPP
 * Now accepts filenames of more that 12 characters and also saves the ram
   in the correct filename.
 * Code idented, was inidented due to also the new RHIDE interface of DJGPP.

 v0.013 -> 15-09-00
 * Now save state is renamed to "filename.ram" and it is loaded inside 
   game :D. I have tested this with Zelda and works fine.
 * Switchings and copies from memory to memory optimized with memcpy C
   function.
 * Now number of ROM and number of RAM switched can be saw more easy in
   debug mode.
 * Repaired a failure that makes that when LY was into (90x, 99x) the 
   emu dont knows that it was in vblank.
 * GB Camera support, hehehe.
 * Optimizations in CPU: OR, AND and XOR opcodes.
 * Repaired flag h in ADDhlss opcodes.
 * Some other opcodes optimized.
 * LCD interruption semiimplented.
 
 v0.012 -> 11-09-00
 * Opcodes who read a value from PC+1, and this value must be signed have 
   been repaired. The problem was dont make a logic and and then the 
   values will turn crazy: "JR e", "JR z, e", "JR nz, e", "JR c, e" and 
   "JR nc, e".
 * Battery implemented for MBC-1. I have tested that it saves the game 
   correctly. Still no loading of this file.
 * Battery now works with all cartdridge types.
 
 v0.011 -> 08-09-00
 * ROM ONLY + MBC1 emulated :D that means that hundred of games are now 
   compatible. And no more limit of 32 KB ROMs. I have tested ROMs of 
   2 MBytes like as Armaggedon Video Trailer (PD) and they work fine. ROM 
   switching seems to work fine.
 * Big error detected: before I set the IF flag of vblank every time LY 
   reaches 90, but if LCD is off this flag mustn be set -> This means more
   speed for any games.
 * Now the user screen dont waits until pc reaches 0x40 line (because 
   some roms never arrives to this point). Some roms are viewed now 
   without changing between Debug or Running Mode.
 * More cartdridge types supported.
 * Opcodes RLr_RRr repaired.
 
 v0.010 -> 06-09-00
 * Screen centered in the middle of the pc screen.
 * Modified click counters for LY and VBlank. Now are more exact and 
   work together.
 * RSTx opcodes repaired. 
 * CALLpq opcodes repaired.
 * TIMER interruption introduced. This makes more compatibility :D
 
 v0.009 -> 23-08-00
 * Repaired EI opcode into interruption, this makes more games 
   compatibles :). 
 * CCF opcode repaired. 
 * Joined BG & WINDOW painting routines in the same loop, but seeing 
   that this is a little slow because of some boolean comprovations, I 
   turned to the old form. 
 * Added pallettes for Sprites (OBJP0 & OBP1).
 * Sprites now have got transparences. 
 * Fixed a problem in painting procedure who makes put pixels in screen 
   with some strange colors. 
 * If a halt is executed and interrupts are disabled and (IE & IF > 0) 
   cpu won't hang now.
 
 v0.008 -> 21-08-00
 * OOP wasn't the problem, I pass it to simple C and the frame skip is 
   the same. Maybe are the painting functions of Allegro library. I don't 
   know. 
 * The arrays of TPTx wasn't the problem of slow down. 
 * Without painting, the scence of the russian towers in Tetris (appears 
   after 505 vblanks = 8.4 seconds) in my EMU is about 3.5 seconds. So we
   have 8.4-3.5 = 4.9 seconds for painting!!!! That's too much. So the 
   problem must be in the painting procedure. 
 * Support of CGB images (but in 4 colours), futhermore, if this images 
   have got memory mapped they will hang.
 
 v0.007 -> 19-08-00
 * DAA opcode repaired, now no more counters with hexadecimal values. 
 * Corrected the flip from Y and XY in 8x16 pixels sprite mode. 
 * More exact now counting cycles (all work from a general counter). 
 * RES and SET opcodes optimized. 
 * Pallette for BG & WINDOW added. 
 * Now I have calculated that I must put a frameskip of 1/5 to work fine 
   == 12fps. Ummmmhh maybe soon I must pass from OOP to simple C.
 
 v0.006 -> 18-08-00
 * Sprite Flipping works fine now. 
 * Reduced to the maximum (I think) the CPU core. Still it doesn't works 
   completely fine; it must have opcodes bad emulated. 
 * A failure in counters repaired now. 
 * BG Memory is cyclic/scrollable 100% now :D (Space Demo demostrates it). 
 * Window visualization. 
 * Added triple buffering for BG, WIN and OAM at the same time => more 
   speed working with pc VGA and not more flickering.
 
 v0.005 -> 16-08-00
 * FrameSkip command introduced (in my pc skipping 1/4 frames works fine
   = 20fps). I think I must optimize the painting procedure, and forget 
   of save the pixels in arrays. I think that it slows the process. 
 * JoyPad routines introduced ... (see JoyPad Rom) and finally TETRIS is 
   joyable!!!! 
 * More games of 32 KBytes tested and also joyable!!!! 
 * New keys for dissassembler/debugger more easy of remember.
 
 v0.004 -> 09-08-00
 * Displaying sprites of 8x16 corrected. 
 * CPU still most optimized & reduced. 
 * Tetris and a lot of more cartdridges doesn't hangs now, but still no 
   JoyPad rutines coded. 
 * 0xE8 & 0xF8 opcodes <-> SP+e (where e = signed value) repaired now. 
 * SBC opcode repaired. 
 * DIV register introduced.
 
 v0.003 -> 05-08-00
 * OAM Tiles & DMA incorporated. Fe: Tetris (G until 0x6CAD, then "G"
   until 0xFFBA, then O 2 see OAM Table). 
 * Too many games intros runs now directly :), including sprites 
   animation (see Amida or Serpent). 
 * CPU core size reduced :. 
 * ADC opcode repaired.
 
 v0.002 -> 01-08-00
 * Introduced a representative stack in the debugger. 
 * Some changes in the emulation of the CPU (I think that I can 
   optimize it a little more). 
 * EI and DI opcodes now work fine. 
 * HALT opcode also works fine now. 
 * Opcode BIT repaired. 
 * Some other less important opcodes repaired! :D. 
 * Added timing (but still unused) for LCDCStatus. 
 * Yeahhh again! The second screen of Tetris can be saw now tracing 
   until line $6cad, or not entering onto the debugger; that means that 
   interrupts might be right now.
 
 v0.001 -> 24-07-00
 * Yeahhhh! The first screen of Tetris cart can be saw now :D (tracing 
   until line 0x2F0 and pressing "L" key).
 
 23-07-00
 * Compiling now with Allegro of Shawn Hargreaves. 
 * Now I can see VRAM tiles and also the corresponding LCD. 
 * Introduced counters for HBlank & VBlank interruptions (LCDStatus). 
   F.e. in Alleway $193 -> VRAM
 
 20-07-00
 * Added a visual interface for a complete dissasembler and debugger.
 
 17-07-00
 * Portating the code from visual c++ to GNU of DJ DELORIE. 
 * Corrected the "external linkage" error. 
 
 01-06-00
 * New z80 motor with a lot of corrections. 
 * Included new values in opcodes machine cycles.
 
 15-05-00
 * After 5 months I coded the first z80 motor in VC++ using OOP. Docs: 
 "Programacin del z80" by Rodnay Zaks. 
 
 17-12-99
 * The project starts...
 


 ////////////////////////////////////////////////////////////////////////////
 //                              STILL TO DO			           //
 ////////////////////////////////////////////////////////////////////////////

 I know that there are many things to repair, but my priorities are 
 exactly now:
	- Make a lcd buffer to paint on it line by line.
	- Code a serial interruption (2 resolve 2 player hang options)
	- Prorities of sprites.
	- Debugging to fix the last cpu bugs.
 	- C++ -> ASM core cpu

	

 ////////////////////////////////////////////////////////////////////////////
 //                             HOW TO CONTACT			           //
 ////////////////////////////////////////////////////////////////////////////

 Don't ask me where to find rom images, I don't want to know anything 
 about them. Having files with game images is illegal if you havent got 
 the original cartdridge. 

 Only report comments or problems please, my e-mail is:
			
				"cbeboy@terra.es"

 Also you can find me sometimes in EFNET or HipanoIRC (channel #emuladores); 
 my nickname is CBeard.



 ////////////////////////////////////////////////////////////////////////////
 //                             THANKS GOES TO			           //
 ////////////////////////////////////////////////////////////////////////////

 - Principally goes to Cristina Marquez, my girlfriend, I love u :*. You 
   know you are the flame who makes live my soul :
 - Oriol Pujol for your support and helping offered to me.
 - Bukanan, you know I still must pay you a beer ;)
 - Brainiack/HexDump for introduce me in the great world of developing 
   emulators ;) Do you remember still GBShOcK? :D
 - Marat Fayzullin for write "How 2 write a computer emulator".
 - Denzel for the beautiful logo of my homepage and Lemonade for his pics.
 - Augus & Jose bros. Perez for the Rodnay Zaks - Z80 book.
 - Enrique Jose for teach me how 2 repair any problems under OOP.
 - DJ DELORIE for his great GNU GCC compiler.
 - Shawn Hargreaves for the wonderful Allegro library.
 - DP for compile all the info written about GB (written previously by 
   Pan of Anthrox, GABY, Marat Fayzullin, Pascal Felber, Paul Robson, 
   Martin Korth, kOOPa and Bowser) and publish it in "Game BoyTM CPU 
   Manual". 
 - Han & Kray for teach me how to build an EMU.
 - Martin Korth for answering me some questions and for his unique and 
   genuine dissasembler/debugger. 
 - Julien Frelet also for answering me some questions.
 - The Web Master of www.otakunozoku.com for pusblish "The Gameboy Crib 
   Sheet" resuming almost all the GB Stuff.
 - All my friends in IRC Hispano in channel #emuladores (so sorry for my 
   poor english, I'm spanish): Kaerv, LiM, A-Kristo, Debugger, Arkanoid, 
   CopyRight, SuBuRu, Flashy, ZjoyKiler, Rumans, Chrono, Blumer, Rikin, 
   Tolvatar, Koiote, Kreator, PTS, z80User, RooBoo, calb, ... (and some 
   others I forgot now, sorry!).
 - Oscar Perez for helping me searching keyboard handling routines under 
   DJGPP in Internet (there are so rare).
 - Markus F.X.J. Oberhumer & Laszlo Molnar for develope UPX.
 - Judge_ for his ideas about the line by line LCD buffer painting.

 
 ----------------------------------------------------------------------------
 CBEBoy is not endorsed with Nintendo. 
    Game Boy is a Trade Mark of Nintendo.

	 h t t p : / / w w w . e m u m a n i a . c o m / c b e b o y
