Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

videodll.c File Reference


Detailed Description

A display plugin for emu6502. Reads video part of memory and displays what it contains. Also paints the text mode screen with given charset.

Definition in file videodll.c.#include "../dllkit/dllkit.h"
#include "../usrmsgs.h"
#include "resource.h"
#include <stdio.h>
#include <tchar.h>

Go to the source code of this file.

Data Structures

struct  b4iheader
 DIB header. More...


Timer defs

#define MYTIMER   10001
 ID of local timer.

#define PERIOD   50
 The period between refreshing screen in ms.


Screen defs

#define FWIDTH   8
 Pixels per character.

#define FHEIGHT   8
 Pixels per character.

#define YCOUNT   32
 Characters per screen.

#define XCOUNT   32
 Characters per screen.

#define WIDTH   FWIDTH * XCOUNT
 Width of the screen.

#define HEIGHT   FHEIGHT * YCOUNT
 Height of the screen.


IO adresses

#define GRMODE   IOLO + 0
#define LOADR   IOLO + 1
#define HIADR   IOLO + 2
#define LOCHR   IOLO + 3
#define HICHR   IOLO + 4
#define FGCOLR   IOLO + 5
#define FGCOLG   IOLO + 6
#define FGCOLB   IOLO + 7
#define BKCOLR   IOLO + 8
#define BKCOLG   IOLO + 9
#define BKCOLB   IOLO + 10
#define VIDEOON   IOLO + 14
#define COMMAND   IOLO + 15

IO registers - copied after COMMAND

unsigned char volatile _GrMode = 0
unsigned char volatile _LoAdr = 0x00
unsigned char volatile _HiAdr = 0xA0
unsigned char volatile _LoChr = 0x00
unsigned char volatile _HiChr = 0xC0
unsigned char volatile _BkColR = 0xFF
unsigned char volatile _BkColG = 0xFF
unsigned char volatile _BkColB = 0xFF
unsigned char volatile _FgColR = 0x00
unsigned char volatile _FgColG = 0x00
unsigned char volatile _FgColB = 0x00
unsigned char volatile GrMode = 0
unsigned char volatile LoAdr = 0x00
unsigned char volatile HiAdr = 0xA0
unsigned char volatile LoChr = 0x00
unsigned char volatile HiChr = 0xC0
unsigned char volatile VideoOn = 0

Standard plugin variables

HANDLE hThisModule
MSGLIST VideoMsgs
volatile BOOL Running = FALSE
INITDLLSTRUCT info

Defines

#define ADR(X, Y)   (((X) << 8) + (Y))
#define IOSETGET(GVAR, SVAR)

Functions

void InitGraphics ()
 Inits DIB and logo structures.

VOID CALLBACK TimerProc (HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
 Paints the screen every n ms if needed.

void Repaint ()
 Invalidates whole screen and evokes WM_PAINT.

void PaintScreen (HDC hdc)
 Paints whole screen.

void CopyChar (char *dest, UINT adr, int x, int y, BOOL invert)
 Copies one character to given coordinates.

BOOL APIENTRY DllMain (HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
DLLEXPORT void __cdecl InitDll (INITDLLSTRUCT *ids, INITDLLINFO *idi)
 Inits dll data structures.

DLLEXPORT void __cdecl OnMessage (MESSAGEDLLSTRUCT *mds)
 Recieves registered messages from emu6502 application.

DLLEXPORT void __cdecl IOFunc (UINT adr, unsigned char *data, iomode mode)
 IO function mapped into some adress in memory.


Variables

UINT memStart = 0xA000
 adress of videomem

UINT memChrStart = 0xC000
 adress of charmap

b4iheader bGrInfo
 DIB header.

char * OffScreen
 An off-screen buffer for text mode.

HBITMAP hLogo
 Handle to the logo bitmap.

HDC hOffDC
 A compatible DC used for drawing the logo.


Define Documentation

#define FHEIGHT   8
 

Pixels per character.

Definition at line 31 of file videodll.c.

#define FWIDTH   8
 

Pixels per character.

Definition at line 29 of file videodll.c.

#define HEIGHT   FHEIGHT * YCOUNT
 

Height of the screen.

Definition at line 39 of file videodll.c.

#define IOSETGET GVAR,
SVAR   
 

Value:

if (mode == IOREAD) {   \
                *data = GVAR;   \
        }       \
        else {  \
                SVAR = *data;   \
        }

Definition at line 293 of file videodll.c.

#define MYTIMER   10001
 

ID of local timer.

Definition at line 21 of file videodll.c.

#define PERIOD   50
 

The period between refreshing screen in ms.

Definition at line 23 of file videodll.c.

#define WIDTH   FWIDTH * XCOUNT
 

Width of the screen.

Definition at line 37 of file videodll.c.

#define XCOUNT   32
 

Characters per screen.

Definition at line 35 of file videodll.c.

#define YCOUNT   32
 

Characters per screen.

Definition at line 33 of file videodll.c.


Function Documentation

void CopyChar char *    dest,
UINT    adr,
int    x,
int    y,
BOOL    invert
 

Copies one character to given coordinates.

Uses character map stored in emulators memory

Parameters:
dest  Address of text mode videomem
adr  Address of the character
x  X coordinate to paint the character onto
y  Y coordinate to paint the character onto
invert  Determines if the character bitmap should be inverted. If so, character no. - 128 is used.

Definition at line 396 of file videodll.c.

DLLEXPORT void __cdecl InitDll INITDLLSTRUCT   ids,
INITDLLINFO   idi
 

Inits dll data structures.

Todo:
free VideoMsgs

Definition at line 175 of file videodll.c.

void InitGraphics  
 

Inits DIB and logo structures.

Definition at line 204 of file videodll.c.

DLLEXPORT void __cdecl IOFunc UINT    adr,
unsigned char *    data,
iomode    mode
 

IO function mapped into some adress in memory.

Called directly when accesing adress to which is this function bound. Always write this function.

Parameters:
adr  Adress being accessed
data  Byte being read/written
mode  see iomode

Definition at line 301 of file videodll.c.

DLLEXPORT void __cdecl OnMessage MESSAGEDLLSTRUCT   mds
 

Recieves registered messages from emu6502 application.

This function is called by emu6502 when some message event registered by InitDll occures. Implement this function even when you don't want to catch any messages.

Parameters:
mds  A MESSAGEDLLSTRUCT structure contaning informations about incoming message.
See also:
InitDll , MESSAGEDLLSTRUCT

Definition at line 229 of file videodll.c.

void PaintScreen HDC    hdc
 

Paints whole screen.

Called by WM_PAINT if the window needs repaint or every n ms when emulator is running For creating text mode screen calls CopyChar.

Parameters:
hdc  DC of the canvas
See also:
CopyChar

Definition at line 369 of file videodll.c.

void Repaint  
 

Invalidates whole screen and evokes WM_PAINT.

Definition at line 287 of file videodll.c.

VOID CALLBACK TimerProc HWND    hwnd,
UINT    uMsg,
UINT    idEvent,
DWORD    dwTime
 

Paints the screen every n ms if needed.

Definition at line 275 of file videodll.c.


Variable Documentation

struct b4iheader bGrInfo
 

DIB header.

HBITMAP hLogo
 

Handle to the logo bitmap.

Definition at line 100 of file videodll.c.

HDC hOffDC
 

A compatible DC used for drawing the logo.

Definition at line 102 of file videodll.c.

UINT memChrStart = 0xC000
 

adress of charmap

Definition at line 87 of file videodll.c.

UINT memStart = 0xA000
 

adress of videomem

Definition at line 85 of file videodll.c.

char* OffScreen
 

An off-screen buffer for text mode.

Definition at line 97 of file videodll.c.


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