Compiling Handy 0.95 for Windows

Quick run-through to get the Handy sources to compile for Windows using Microsoft Visual Studio 2010 (or Microsoft Visual C++ 2010 Express, which is a free download).

handylogo_69FF22D3

Download these first:

Install Visual C++ and the DirectX SDK. Unpack the sources of Handy.

Open the folder of the Handy sources and find the Handy.dsp file. Doubleclick to the open it in Visual C++. It will prompt you to convert the project. Choose Yes in the dialog.

image_1D2B3670

Save the solution. You must specify the location of the .sln solution file. The root of the project will be an appropriate location.

image_48EB6492

Right-click the Handy project and open the Properties dialog. Go to the C/C++ section and enter a new entry under “Additional Include Directories”. This should be “C:\Program Files (x86)\Microsoft DirectX 9.0 SDK (August 2005)\Include” if you installed the DirectX 9 SDK to the default installation directory.

image_16FBC1D7

Next, go to the Linker section and add “C:\Program Files (x86)\Microsoft DirectX 9.0 SDK (August 2005)\Lib\x86” to the “Additional Libraries Directories”.

image_06CBE5DF

When you first try to compile the sources you will get a number of errors. Fix each of these, bullet by bullet and recompile in between:

  • 22 errors: error C1083: Cannot open include file: ‘strstrea.h’: No such file or directory
    Apply fix 1.
  • 96 errors: related to endl, ostream&, ostrstream and ostrstream& references and declarations in error.h
    Apply fix 2.
  • 43 errors:

    error C4430: missing type specifier – int assumed. Note: C++ does not support default-int
    error C2664: ‘CWnd::OnActivateApp’ : cannot convert parameter 2 from ‘HTASK’ to ‘DWORD’
    error C2440: ‘static_cast’ : cannot convert from ‘void (__thiscall CLynxWindow::* )(WPARAM,LPARAM)’ to ‘LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)’
    error C2065: ‘loop’ : undeclared identifier
    error C2065: ‘endl’ : undeclared identifier

    Apply fixes 2 to 6

This is the list of fixes you will need to make to get the sources to compile.

  1. Replace #include “strstrea.h” in error.h with these two lines:
    #include <iostream>
    #include <strstream>
  2. Prefix endl, ostream&, ostrstream and ostrstream& declarations with:
    std::
  3. Change line 1192 in Lynxwin.cpp to
    static bool firsttime=0;
  4. Change HTASK hTask in line 2365 of Lynxwin.cpp and line 325 of Lynxwin.h to
    DWORD hTask
  5. Comment out the lines 868 and 869 of Lynxwin.cpp. I do not know how to really fix these errors yet.
  6. Add a new line at 1552 in Lynxwin.cpp with:
    ULONG loop=0;
  7. Change line 195 of Debuggerwin.cpp to:
    for(int loop=0;loop<mWinHeight;loop++) LineOutput("");
  8. Change line 550 of Debuggerwin.cpp to these two:
    int loop;
    for(loop=0;loop<mLineInput-1;loop++)
  9. Change line 487 of codewin.cpp to these two:
    int loop;
    for(loop=0;loop<MAX_CPU_BREAKPOINTS;loop++)

After that you should have a Handy C++ project that compiles, links and runs correctly.

For the developer version of Handy you should add a preprocessor definition _LYNXDBG to the project:

image_0D0EA86E

The developer version gives you a Code, Debugger and Graphics dump window and ability to debug/step-through the 65SC02 code. You do not have to change this if you switch to another configuration “Debug Dbg” or “Release Dbg”. You will have to go through the process of setting the Include and Library directories again.

You will also get new compile errors. To fix these, apply fix 7 to 9 to get rid of those.

Run the Handy emulator, find yourself LYNXBOOT.IMG if you have got the boot image and some rom images for (homebrew) games.

image_19F5105A

For your convenience, you can download the revised sources here:

To be determined

Advertisements
This entry was posted in Tutorial. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s