Skip to content

Instantly share code, notes, and snippets.

@aron-bordin
Last active January 21, 2016 14:32
Show Gist options
  • Save aron-bordin/339b9e529e6e419a477f to your computer and use it in GitHub Desktop.
Save aron-bordin/339b9e529e6e419a477f to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <list>
#include <windows.h>
using namespace std;
#include <conio.h>
typedef void _stdcall (*oupfuncPtr)(short portaddr, short datum);
// Variáveis globais para carregar a DLL e as duas
// rotinas para entrada (inp32) e saída (oup32).
HINSTANCE hLib;
oupfuncPtr out;
int carregaDLL(){
// Carrega a inpout32.dll
hLib = LoadLibrary("inpout32.dll");
if (hLib == NULL) {
printf("falha");
return -1;
}
// Extrai as funções da DLL.
out = (oupfuncPtr) GetProcAddress(hLib, "Out32");
if (out == NULL){
printf("Erro ao carregar rotinas.");
return -2;
}
return 0;
}
int main() {
int Matriz[7][96];
if(carregaDLL())
return -1;
while(1){
// ... logica aqui
...
// pra mostrar uma matriz
short int valor;
for(i = 0; i < 7; i++){
for(k = 0; k < 96; k++){
valor = 16 + Matriz[i][k]*8 + 7;
out(0x378, valor);
valor -= 16;
out(0x378, valor);
}
valor = 16 + i ;
out(0x378, valor);
Sleep(1);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment