home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.msdos.programmer
- Path: sparky!uunet!utcsri!skule.ecf!torn!pulp.cs.laurentian.ca!paul
- From: paul@ramsey.cs.laurentian.ca (Paul Lalonde)
- Subject: Need help with hires bitmapping/storage in C/asm
- Message-ID: <1992Dec28.082618.8705@ramsey.cs.laurentian.ca>
- Organization: Dept. of Computer Science, Laurentian University, Sudbury, ON
- Date: Mon, 28 Dec 1992 08:26:18 GMT
- Lines: 82
-
- I just finished a tiny TSR program in C (activated by ALT-*) that grabs
- the 64K of bitmap data at A000:0000 in hires mode 320x200x256colours.
- It sends this 64k to a file called 'output.bin'. The purpose of this TSR
- is to grab the graphics screen under Deluxe Paint so that I can use my
- screens in my own programs. The TSR works.
-
- However, when I use another program, DISPLAY.C, to read in the binary file
- output.bin and display it back on the 320x200x256 screen, the colours are
- mismatched.
-
- I'm only a neophyte assembly programmer, but I'm assuming this is a result
- of 16->8 bit truncation during register MOVes and fputc()/fgetc() operations.
-
- I'm "enclosing" the code snippet from the TSR that dumps the video screen,
- as well as the display program.
-
- I would appreciate any help in getting both the TSR dumper to dump the
- proper binary image and the displayer to read the proper image.
-
- Thanks for any help!
-
- --TSR 320x200x256colour video screen dumper function--
-
- void dumpvideo(void)
- {
- unsigned int i;
- FILE *fp;
- unsigned char ch;
-
- fp = fopen("\\output.bin", "wb");
- if (fp == NULL) return(0);
-
- asm mov cx, 0A000h;
- asm mov es, cx;
- asm mov di, 0;
-
- for(i=0; i<64000; i++){
- asm mov ax, [byte ptr es:di];
- asm inc di;
- fputc(_AX, fp);
- }
- fclose(fp);
-
- }
-
- --displayer program--
-
- #include <stdio.h>
-
- void main(void)
- {
- FILE *fp;
- unsigned i;
- unsigned char ch;
-
- fp = fopen("output.bin", "rb");
- if(fp==NULL) exit();
-
- asm mov ah, 0;
- asm mov al, 13h;
- asm int 10h;
- asm mov cx, 0A000h;
- asm mov es, cx;
- asm mov di, 0;
-
- for(i=0; i<64000; i++){
- _AX = fgetc(fp);
- asm mov [es:di], ax;
- asm inc di;
- }
- fclose(fp);
- getch();
- asm mov ah, 0;
- asm mov al, 3;
- asm int 10h;
- }
-
- --
- ------------------------------------+-----------------------------------------
- Paul Lalonde, Dept. of CompSci | "C'mon baby, don't fear the Reaper"
- Laurentian University - Sudbury/ONT | -B.O.C.
- ----'83-Mustang-GT-5.0L--&--RUSH----+-----------------------------------------
-