home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 31 / CDASC_31_1996_juillet_aout.iso / vrac_os2 / vgb206b1.zip / VGB.DOC < prev    next >
Text File  |  1996-04-29  |  18KB  |  412 lines

  1.  
  2.  
  3.                    ******* Virtual GameBoy *******
  4.                 The Portable Nintendo GameBoy Emulator
  5.                              version 0.6
  6.  
  7.                          by Marat Fayzullin
  8.                       
  9.                       email: fms@freeflight.com
  10.                             IRC:  RST38h
  11.                  WWW: http://www.freeflight.com/fms/
  12.  
  13.          (*) GameBoy is a registered trademark of Nintendo.
  14.  
  15.  
  16.  
  17.                        * NEW IN THIS VERSION *
  18.  
  19. o Several bugs fixed in CPU emulation
  20. o CPU emulation now accesses memory via pointers which makes it slower, 
  21.   but page switcihing takes much less time
  22. o GameGenie cheats can now be used
  23. o A check for NOP;JP sequence at 0100h is removed
  24. o LCD controller emulation is slightly corrected
  25. o Makefile now contains comments on compiling VGB
  26. o New debugger is added, thanks to Pascal Felber
  27. o Sprite priorities are *not* implemented yet
  28.  
  29.  
  30.  
  31.                           * INTRODUCTION *
  32.  
  33.   Please, *carefully* read this manual. Do not write me email with
  34. questions answered in here, as such letters are going to be ignored: I
  35. have too many other things to do to answer the same questions over and
  36. over again.
  37.   *Windows users* will find a special section downgraded in content for
  38. better comprehension. 
  39.  
  40.   Virtual GameBoy [VGB] is a portable emulator of the Nintendo GameBoy
  41. handheld videogame console written in C. Although many things do not work
  42. quite well yet, it was able to run about 85% of games checked with it. You
  43. can always get the latest VGB source code, binaries, and support files
  44. from
  45.  
  46.                   http://www.freeflight.com/fms/VGB/
  47.  
  48. Another GameBoy-related archive is at
  49.  
  50.                   ftp://altair.komkon.com/pub/GameBoy/
  51.  
  52.   There are versions of VGB for Amiga, Macintosh, and IBM PC [both
  53. MeSsyDOS and Windoze]. Following people are maintaining ports of VGB to
  54. these systems: 
  55.  
  56. MSDOS:      Marcel de Kogel [m.dekogel@student.utwente.nl]
  57. Windows:    Marat Fayzullin [fms@wam.umd.edu]
  58. Macintosh:  John Stiles [jstiles@cello.gina.calstate.edu]
  59.  
  60.   If you would like to port VGB to another system, or make changes in
  61. VGB's code *please*, contact me by email or some other means. Note, that
  62. VGB source code is freely distributable, but it is *not* public domain.
  63. You can not use it in commercial purposes unless you contact me to arrange
  64. the conditions of such usage and get my permission. Feel free to look at
  65. existing drivers as well as at other code. More explanations follow.
  66.  
  67.   This manual covers two different VGB distributions:
  68.  
  69. 1. *** Source Code Distribution ***
  70.   This distribution contains C sources of the emulator, and the
  71. screen/keyboard drivers for Unix/X. Virtual GameBoy has been tested on the
  72. following Unix systems: 
  73.  
  74.   SunOS   Solaris   OSF/1   FreeBSD   HP/UX   Linux   AIX
  75.  
  76. 2. *** VGB-Windows Distribution ***
  77.   Due to the flood of requests from the people who use DOS/Windows running
  78. PCs and are unable to compile the emulator on their own, I have ported VGB
  79. under Microsoft Windows. This distribution contains an executable of a
  80. limited version of VGB-Windows which doesn't allow you to reload a new
  81. game from a menu when emulation is already running, and has an annoying
  82. "Virtual GameBoy DEMO" message across its window. The uncrippled version
  83. of VGB-Windows is available for $35US from
  84.  
  85.   Marat Fayzullin
  86.   6304 Hampton Place
  87.   Elkridge, MD 21227
  88.   USA
  89.  
  90.   VGB-Windows is a 32-bit application which runs under Windows 3.11, 
  91. Windows 95, and Windows NT. It is compiled with Borland C++ and needs 
  92. Microsoft WinG library which can be obtained from
  93.  
  94.   ftp://ftp.microsoft.com/Softlib/MSFILES/WING10.EXE
  95.  
  96.   Windows 3.xx users will also require Win32s library available from
  97.  
  98.   ftp://ftp.microsoft.com/Softlib/MSLFILES/PW1118.EXE
  99.  
  100.  
  101.  
  102.                * SHORT MANUAL FOR THE WINDOWS USERS *
  103.  
  104.   In order to use VGB-Windows, you will first have to install WinG
  105. graphical library which can be obtained from Microsoft [see address
  106. above]. If you have Windows 3.xx, you may also need to install Win32s
  107. extension libraries whose address is also given above. Also, the
  108. VGB-Windows distribution contains a file called BWCC32.DLL which should be
  109. either kept in a directory from which VGB runs, or copied into
  110. \WINDOWS\SYSTEM directory. 
  111.   VGB-Windows runs in a resizable window with the following menus:
  112.  
  113. o File
  114.   o New
  115.     This opton allows to run a new game. If you only have an unregistered
  116.     version of VGB-Windows, it will be disabled so that you will only be
  117.     able to choose a game when emulator starts.
  118.   o Setup
  119.     This option pops up a setup dialog allowing to change all 4 GameBoy's
  120.     colors and some emulation parameters:
  121.     o Palette
  122.       Use this group of controls to select a color and change its RGB
  123.       components. The palette controls may not work very well if you
  124.       run Windows in 256-color mode. Use 16-bit or 24-bit graphical
  125.       mode for best effect. 
  126.     o VBlank Period
  127.       This parameter determines how many CPU commands will be executed
  128.       between vertical blanking interrupts. Setting it lower may speed
  129.       up the emulation, but setting it too low will hang it.
  130.     o Update Period
  131.       This parameter determines how many vertical blanking interrupts
  132.       will pass between window refreshes. It is usually set to 2, but
  133.       you can increase it to make VGB work faster. The sprite
  134.       movements become jerky at high update periods though, and some
  135.       sprites may simply disappear.
  136.     o Delay Line Interrupts
  137.       If you see "dirty" horizontal lines in some games, you may turn
  138.       this option on or off to remove them. There is no some universal
  139.       state of this option which will work for all games though.  
  140.     o Check CRC
  141.       With this switch off, VGB will not check the control sums of
  142.       the loaded cartridges.
  143.     o Save CPU
  144.       With this switch on, VGB will suspend the execution when its
  145.       window is inactive.
  146.     o Autofire A
  147.       Turn this on to make the [A] button generate series of keypresses
  148.       instead of a single keypress.
  149.     o Autofire B
  150.       Turn this on to make the [B] button generate series of keypresses
  151.       instead of a single keypress.
  152.   o Quit
  153.     Quit the emulation. A .SAV file will be saved if the game has a
  154.     battery-backed RAM.
  155. o Size
  156.   o 1:1  These options change the window size to be the same as in real
  157.   o 2:1  GameBoy, or 2/3/4 times bigger. Please, note that you can change
  158.   o 3:1  window size by simple dragging the bottom-right corner of a
  159.   o 4:1  window with the mouse.
  160. o Help
  161.   o About
  162.     This option will display a dialog box with copyright information
  163.     and other legal stuff.
  164.  
  165.  
  166.  
  167.                    * FREQUENTLY ASKED QUESTIONS *
  168.  
  169. 1. What is GameBoy?
  170.   GameBoy is a handheld videogame machine produced by Nintendo. It is
  171. built around a custom CPU similar to Z80, but with some changes. GameBoy
  172. is frequently laughed at because of its reflective green-on-yellow LCD
  173. screen which in fact is its virtue. Due to the low power consumption of
  174. its LCD, GameBoy can work for 35 hours off 4 AA batteries. There is a lot
  175. of good games produced for GameBoy, both classics [Tetris, Pacman,
  176. Asteroids, etc.] and specific ones [Final Fantasy series for GB]. It
  177. excells in RPGs and classic games where gameplay is more important than
  178. graphics. More information about GameBoy is available from
  179.  
  180.            http://www.freeflight.com/fms/GameBoy/
  181.  
  182. 2. Where do I get GameBoy games?
  183.   You buy the cartridges. GameBoy software is copyrighted and still sold. 
  184. Therefore, its distribution is an act of piracy. Nothing prohibits you 
  185. from backing up a cartridge you own and playing it on the emulator though.
  186. To back up a GameBoy cartridge, you can use either SmartCard copier [about
  187. $100 for a standalone version], or a self-built copier designed by Pascal 
  188. Felber, description of which is available at
  189.  
  190.            http://www.freeflight.com/fms/GameBoy/
  191.  
  192. Please, DO NOT SEND ME MAIL ASKING TO SEND YOU THE CARTRIDGE FILES OR TELL
  193. YOU WHERE TO FIND THEM. I ignore such letters. 
  194.  
  195. 3. Where is the complete list of command line options of VGB?
  196.   Use -help option. It will tell VGB to display all options available in 
  197. your version. Following are the currently available options:
  198.  
  199.   -verbose <level>    - Select debugging messages [5]
  200.                         0 - Silent           1 - Startup messages
  201.                         2 - Illegal writes   4 - Illegal CPU ops
  202.                         8 - Bank switching
  203.   -vperiod <period>   - Set VBlank interrupts period [10000ops]
  204.   -uperiod <period>   - Number of interrupts per screen update [2]
  205.   -help               - Print this help page
  206.   -cheat <GG code>    - Activate a GameGenie cheat
  207.   -shm/-noshm         - Use/don't use MIT SHM extensions for X [-shm]
  208.   -trap <address>     - Trap execution when PC reaches address [FFFFh]
  209.   -delay/nodelay      - Delay/don't delay coincidence int-s [-nodelay]
  210.   -saver/-nosaver     - Save/don't save CPU when inactive [-saver]
  211.   -color0 <name>      - Change color#0 [black]
  212.   -color1 <name>      - Change color#1 [#585858]
  213.   -color2 <name>      - Change color#2 [#989898]
  214.   -color3 <name>      - Change color#3 [white]
  215.  
  216. 4. What are the keys used in VGB?
  217.  
  218. SPACE,A,S,D,F,G,H,J,K,L     - [A] button
  219. LALT,CONTROL,Z,X,C,V,B,N,M  - [B] button
  220. TAB                         - [SELECT] button
  221. ENTER                       - [START] button
  222.  
  223. ESC   - Quit emulator
  224. F1    - Turn tracing on/off [DEBUG] (Not implemented in Windows)
  225. F2    - Show LCD controller registers [DEBUG] (Not implemented in Windows)
  226.  
  227. 5. Why is the emulator so slow on my PC?
  228.   Because your PC is too slow to run it. The emulator is written entirely
  229. in C language and therefore is quite slow. Although it works on 486/33 and
  230. even 386/33 PCs, it runs best on a Pentium/90 or a DEC Alpha/150. You can
  231. try to speed it up by increasing -uperiod value controlling the number of
  232. interrupts between screen updates to 3-6, and by decreasing -iperiod value
  233. controlling the number of CPU cycles between interrupts to 2000-5000.
  234.  
  235. 6. Can I compile the emulator with my Borland/Turbo C compiler?
  236.   You can, given that your compiler creates executables using flat 32bit
  237. memory model. Two PC compilers which do that are WATCOM [using DOS4GW DOS
  238. extender] and GCC [using DJPP extender]. The only 32bit Borland/Turbo C  
  239. compiler that I'm aware is for Windows though.
  240.  
  241. 7. Is it legal to spread GameBoy cartridge snapshots?
  242.   NO. Be aware of the fact that by using commercial software you haven't 
  243. bought, you are commencing an act of piracy. Not that I care, anyway...
  244.  
  245. 8. Why some games do not run with VGB?
  246.   As it was said before, VGB emulation is not completely accurate yet.
  247. Also, some games will probably never run on VGB.
  248.  
  249. o If emulator does not even recognize the ROM image, its CRC may be
  250.   wrong. Try turning CRC checking off [if you are Windows user],
  251.   although you really need to find an uncorrupted ROM image.
  252. o Check you ROM image size: it must be a multiple of 8192. If it is
  253.   512 bytes longer, then you may have a SmartCard copier header
  254.   attached to it. In this case, remove first 512 bytes of the file.
  255. o If a game refuses to work, try changing -vperiod value from 2000 to
  256.   15000, or moving a "VBlank Period" knob in the VGB-Windows setup
  257.   window.
  258. o If you see a group of "dirty" lines on VGB screen, or a game behaves
  259.   strangely, try -delay/-nodelay options, or check/clear the "Delay
  260.   Line Interrupts" checkbox in the VGB-Windows setup window. 
  261. o If some sprites blink or do not appear at all, try changing -uperiod
  262.   value from 1 to 10 [1 will give you the best picture, but the slowest
  263.   emulation], or moving an "Update Period" knob in the VGB-Windows
  264.   setup window.
  265.  
  266. 9. Palette controls in VGB-Windows do not work.
  267.   This probably means that you are running Windows in the 256-color mode.
  268. In this mode, not all of 256 possible colors are available, and you will
  269. be able to choose only from the available colors. Switch Windows into
  270. 16-bit or 24-bit graphics and palette will start working. 
  271.  
  272. 10. I start VGB-Windows, but it tells me that WING.DLL is not found.
  273.   This means that you haven't installed WinG library necessary to run VGB.
  274. Check the information in the beginning of this manual on how to obtain
  275. WinG. 
  276.  
  277. 11. I start VGB-Windows, but it tells me that BWCC32.DLL is not found.
  278.   VGB-Windows comes with a file called BWCC32.DLL. This file should be
  279. either kept in the directory from which VGB runs, or put into
  280. \WINDOWS\SYSTEM directory. If you haven't got this file, you are
  281. probably using an illegal distribution of VGB-Windows. 
  282.  
  283. 12. When compiling emulator under Unix, I get "undefined name" errors.
  284.   This means that your linker can not find the libraries necessary for the
  285. emulator [namely, libX11.a and libXext.a] or some additional libraries
  286. [like libsocket.a and libnsl.a] are required. Find these libraries in your
  287. system and modify the Makefile so that the final invocation of the C
  288. compiler has "-L<path_to_libs>" options. If you have no libXext.a library,
  289. try #undefining MITSHM option.
  290.  
  291. 13. When starting emulator under Unix, I get X_ShmAttach error.
  292.   You are probably trying to run the emulator on a remote Xterminal while
  293. it attempts to use shared memory for interfacing with X. Use -noshm option
  294. to tell it not to use shared memory.
  295.  
  296. 14. The emulation starts under Unix, but then I get X_PutImage error.
  297.   Unix/X version of fMSX currently needs 256-color X. Neither 2-color
  298. nor TrueColor Xterminals will work with the drivers included into
  299. "official" VGB distribution.
  300.  
  301. 15. I start the Unix version of the emulator but the window stays black.
  302.   Some other X application took over all available colors so that the
  303. emulation could not allocate any for itself. Check if you run XV,
  304. Netscape, or something similar.
  305.  
  306. 16. How can I get sound in VGB?
  307.   The Unix/X version has no sound yet, although there are some works going
  308. on in this direction. In the "official" DOS version, use -s option. Your
  309. soundcard should be SoundBlasterPro-compatible though, and the sound is
  310. very rudimentary.
  311.  
  312. 17. How can I get joystick to work with VGB?
  313.   Joystick is not supported yet.
  314.  
  315.  
  316.  
  317.  
  318.                          * COMPILATION TIPS *
  319.  
  320.   If you are compiling the emulator under Unix, use Makefile. Notice that
  321. #define UNIX is present in this case.
  322.   The emulation is written in fairly portable C code and may therefore be
  323. compiled with any decent ANSI C compiler. It relies on a flat 32bit memory
  324. model though, so Borland compilers will choke on it. Standard CC or GCC
  325. should do the job under Unix [although beware of GCC code generation
  326. bugs]. If you are working under MeSsyDOS, use WATCOM C which is known to
  327. work. Under [God prohibits] Windows, use Borland C++ which has 32bit
  328. compilation model. On Amiga, use SAS/C. On Macintoshes, use Metrowerks C.
  329.   If you are using an Intel-based computer or any other machine which has
  330. least-significant-byte-first data layout [for example, DEC Alpha], insert
  331.  
  332.                 #define LSB_FIRST
  333.  
  334. in the beginning of Z80.h file. The emulator will not work otherwise.  
  335.   If you put
  336.  
  337.                 #define DEBUG
  338.  
  339. in the beginning of Z80.h, the emulator will print debugging information 
  340. about CPU registers after executing each command. You can turn debugging 
  341. on and off by setting Trace variable to 1 and 0 accordingly. Also, by
  342. setting Trap variable to some address you will make it start tracing when
  343. PC reaches this address [-trap option].
  344.   When you port the program to a new machine, you have to write a set of
  345. drivers for keyboard, sprites, and all the screen modes you want to
  346. emulate.  The emulator comes with a set of drivers for XWindows system.
  347. The common code for these drivers is located in Common.h and can be used
  348. for other systems too. Screen drivers use simple XSIZE*YSIZE array of
  349. bytes to generate image, so in most cases you will only need to adjust   
  350. these drivers to your own needs. Note that the X11 drivers use so-called 
  351. MIT Shared Memory Extension for fast transfers from buffer to a window. If
  352. you do not have MIT SHM extension in your system, remove
  353.  
  354.                 #define MITSHM
  355.  
  356. You can also turn MITSHM off [for example, if you use remote X terminal]
  357. by setting UseSHM variable to 0 before starting the emulation [-noshm   
  358. option].
  359.  
  360.  
  361.  
  362.                           * CODE STRUCTURE *
  363.  
  364.   Several other variables control the behaviour of the emulator. All of
  365. them should be set before starting the emulation in order to take effect:
  366.  
  367. Verbose = 0..31
  368.   Defines amount of debugging information printed by emulator. Default
  369.   value is 1. Each bit of this variable enables printing of some kind
  370.   of debugging info (VDP,CPU,memory,etc.).
  371. VPeriod = 1000..50000
  372.   Defines how many CPU commands should be executed between two interrupts.
  373.   Normal interrupt rate is 60Hz for NTSC systems or 50Hz for PAL systems.
  374.   Default value of VPeriod is 10000.
  375. CPURunning = 0/1
  376.   Set this variable to 0 to stop CPU and exit the emulation.
  377. Trace = 0/1
  378.   Print debugging information about CPU state. Default value is 1.
  379.   #define DEBUG should be present in order to use this option. Tracing
  380.   can be turned on and off during execution [for example, in keyboard
  381.   driver].
  382. Trap = 0x0000..0xFFFF
  383.   Automatically start tracing when PC reaches given address. #define
  384.   DEBUG should be present in order to use this option.
  385. UPeriod = 1..10 
  386.   Defines how many interrupts should pass between two consequent screen
  387.   updates. Default value of UPeriod is 2.
  388. CartName = "cartridge.file"
  389.   Name of a .GB file to load. Default value is "CART.GB". This variable
  390.   is ignored if no file exists.
  391. UseSHM = 0/1
  392.   Use MIT SHM extension in X11 screen drivers. Default value is 1.
  393.   #define MITSHM should be present in order to use this option.
  394.   
  395.   In order to run the emulation:
  396.   
  397.   1. Set all necessary variables.
  398.   2. Initialize screen and keyboard drivers [in the case of X11 drivers,
  399.      it is done by calling InitMachine() implemented in Unix.c and
  400.      returning 1 on success or 0 otherwise]
  401.   3. Call StartGB().
  402.   4. Call TrashGB().
  403.   5. Shut down screen and keyboard [in X11 case, by calling TrashMachine()].
  404.   6. Exit the program.
  405.   
  406.   Take a look at VGB.c to see an example of a sequence explained above.
  407.  
  408.  
  409.  
  410. ---------------
  411. Marat Fayzullin
  412.