Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

emu6502.c File Reference


Detailed Description

Main framework of the emu6502 applictaion, contains window and plugin management.

Definition in file emu6502.c.#include <windows.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <commdlg.h>
#include <commctrl.h>
#include <stdio.h>
#include "emu6502.h"

Go to the source code of this file.

Defines

#define WIN32_LEAN_AND_MEAN
#define MAX_LOADSTRING   512
#define CR   13
#define LF   10

Functions

int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
 Entry point of this app.

ATOM MyRegisterClass (HINSTANCE hInstance)
 Registers the main window class.

BOOL InitInstance (HINSTANCE hInstance, int nCmdShow)
 Inits & shows the main window.

HWND CreateToolBar (HWND hParentWnd)
 Creates the main toolbar.

LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 Main message handling routine.

LRESULT CALLBACK About (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 About dialog's DialogProc.

BOOL LoadMemFile (HWND hWnd)
 Loads memory image.

void error (HWND hWnd, UINT uID, TCHAR *name)
 Error reporting proc.

BOOL ForwardDllMessage (UINT message, WPARAM wParam, LPARAM lParam, DllMsgList *actlist)
 Forwards message to registered plugin OnMessage functions.

void LoadPlugins (DllMsgList **list, PtrList **InstList)
 Loads plugins named in plugins.txt.

BOOL LoadPlugin (TCHAR *name, DllMsgList **list, PtrList **InstList)
 Loads plugin of given name.

void AddDllMsg (DllMsgList **list, UINT message, pForwardDllMsgProc FDMProc)
 Adds message catching dll function to a dll message list.

void UnloadPlugins (PtrList *list)
void AddToPtrList (void *ptr, PtrList **list)
 Allocates and adds new member to existing or NULL list.

TCHAR * GetNextStrToken (TCHAR **buf)
 Helper function for LoadPlugins.


Variables

HINSTANCE hInst
 Handle to instance of this app.

HWND hMainWnd
 Handle to the main window.

HWND hToolBar
 Handle to the toolbar.

DllMsgListDMList = NULL
 List of messages and theirs catching dll functions.

PtrListDHInstList = NULL
 List of dll handles.

TCHAR szTitle [MAX_LOADSTRING]
TCHAR szWindowClass [MAX_LOADSTRING]


Function Documentation

LRESULT CALLBACK About HWND   ,
UINT   ,
WPARAM   ,
LPARAM   
 

About dialog's DialogProc.

Definition at line 198 of file emu6502.c.

void AddDllMsg DllMsgList **    list,
UINT    message,
pForwardDllMsgProc    FDMProc
 

Adds message catching dll function to a dll message list.

Parameters:
list  pointer to a DllMsgList list
message  ID of message to be catched
FDMProc  Function, to which should be the message forwarded Mostly function from plugin-dll.
See also:
ForwardDllMsgProc , DllMsgList

Definition at line 399 of file emu6502.c.

void AddToPtrList void *    node,
PtrList **    list
 

Allocates and adds new member to existing or NULL list.

Definition at line 446 of file emu6502.c.

HWND CreateToolBar HWND    hParentWnd
 

Creates the main toolbar.

Creates main toolbar and adds one Open button to it

Parameters:
hParentWnd  Handle to parent window
Returns :
Hanlde to the toolbar

Definition at line 127 of file emu6502.c.

void error HWND    hWnd,
UINT    uID,
TCHAR *    name
 

Error reporting proc.

Shows a messagebox with given error mesage (from resources). This message can also contain s in this case the parameter name becomes effective and prints on the position of s.

Parameters:
hWnd  Handle of the parent window
uID  Resource ID of the error message
name  Informations to be printed on the s position

Definition at line 268 of file emu6502.c.

BOOL ForwardDllMessage UINT    message,
WPARAM    wParam,
LPARAM    lParam,
DllMsgList   list
 

Forwards message to registered plugin OnMessage functions.

Parameters:
message  ID of forwarded message
wParam  wParam parameter of this message
lParam  lParam parameter of this message
list  List of messages and its catching functions. See DllMsgList
Returns :
TRUE if relevant function found, FALSE otherwise

Definition at line 277 of file emu6502.c.

TCHAR* GetNextStrToken TCHAR **    buf
 

Helper function for LoadPlugins.

Sideeffect - makes buf to point to the next item

Parameters:
buf  TCHAR buffer containing list of items separated by CRLF and ended with \0.
Returns :
first item of the list or NULL if there isn't any more
See also:
LoadPlugins

Definition at line 454 of file emu6502.c.

BOOL InitInstance HINSTANCE   ,
int   
 

Inits & shows the main window.

Creates the main window, sizes it to fit the 256x256 canvas, creates toolbar by calling @CreateToolbar, and then loads plugins by calling LoadPlugins.

See also:
CreateToolbar, LoadPlugins

Definition at line 91 of file emu6502.c.

BOOL LoadMemFile HWND    hWnd
 

Loads memory image.

Stops execution of the CPU, loads memory image, also controls it's length

Definition at line 216 of file emu6502.c.

BOOL LoadPlugin TCHAR *    name,
DllMsgList **    list,
PtrList **    InstList
 

Loads plugin of given name.

Executes his InitDll functions, receives list of messages to be catched in this plugin and attaches it to the DllMsgList list.

Parameters:
name  Name of plugin dll to be loaded.
list  Pointer to a DllMsgList list in which will be message IDs and theirs catching procedures stored.
InstList  List of handles to plugin-dlls loaded
See also:
LoadPlugins, ForwardDllMessage

Definition at line 334 of file emu6502.c.

void LoadPlugins DllMsgList **    list,
PtrList **    InstList
 

Loads plugins named in plugins.txt.

Goes through the plugins.txt file and loads named plugins by calling LoadPlugin procedure.

Parameters:
list  Pointer to a DllMsgList list in which will be message IDs and theirs catching procedures stored.
InstList  List of handles to plugin-dlls loaded
See also:
LoadPlugin, ForwardDllMessage

Definition at line 303 of file emu6502.c.

ATOM MyRegisterClass HINSTANCE    hInstance
 

Registers the main window class.

Definition at line 69 of file emu6502.c.

int APIENTRY WinMain HINSTANCE    hInstance,
HINSTANCE    hPrevInstance,
LPSTR    lpCmdLine,
int    nCmdShow
 

Entry point of this app.

Definition at line 41 of file emu6502.c.

LRESULT CALLBACK WndProc HWND    hWnd,
UINT    message,
WPARAM    wParam,
LPARAM    lParam
 

Main message handling routine.

Todo:
add TBSTYLE_TOOLTIPS

Definition at line 155 of file emu6502.c.


Variable Documentation

PtrList* DHInstList = NULL
 

List of dll handles.

Definition at line 34 of file emu6502.c.

DllMsgList* DMList = NULL
 

List of messages and theirs catching dll functions.

Definition at line 32 of file emu6502.c.

HINSTANCE hInst
 

Handle to instance of this app.

Definition at line 25 of file emu6502.c.

HWND hMainWnd
 

Handle to the main window.

Definition at line 27 of file emu6502.c.

HWND hToolBar
 

Handle to the toolbar.

Definition at line 29 of file emu6502.c.


Generated on Fri Sep 6 18:32:15 2002 for Emu6502 by doxygen1.2.17