From: "Henri Ossi" Newsgroups: comp.os.msdos.djgpp Subject: Blitting chars Date: Sun, 17 May 1998 14:06:00 +0300 Organization: Telecom Finland News Service Lines: 141 Message-ID: <6jmgi6$imc$1@hiisi.inet.fi> NNTP-Posting-Host: pc2022.public.htk.fi To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk God, I hate outlook Express, sorry if this message already came..... Hi. I've been trying to make a char drawer in asm (using NASM) But i'm still quite confused about some things: 1) if I use a double buffer, it is sized 320x200, so its 64k, right? so my program crashes, if i use .com files 2) i have no idea, how to make .exe files ( well, i've read about it from the tutorials, but still...) 3) i dont know, which registers i can globber and which i cant (beginners problem =) 4) can i even do this kind of stuff to a com file? 5) my program doesnt work at all But, heres the code in C (djgpp) and in asm, look for stupid things that I've made in the asm version. ( like the fact that if it works, it still doesn't draw a visible character to the screen...) void char_blt(int x, int y, int color, unsigned char c) { int offset, x2, y2; char *work_char; unsigned char bit_mask = 0x80; rom_char_set=(char*)ROM_START_POINT+__djgpp_conventional_base; work_char = rom_char_set + c * CHAR_HEIGHT; offset = (y*320) + x; for(y2=0; y2> 1); } offset += 320; work_char++; } } --------------- BITS 16 ORG 0x100 screen_ram EQU 0A000h CHAR_WIDTH EQU 8 CHAR_HEIGHT EQU 8 CHAR_START1 EQU 0xf000 CHAR_START2 EQU 0xfa6e ;============== Mainprogram: ;============== CALL SetVGAMode CALL FillScreen_black CALL DrawChar CALL WaitForKey CALL EndProgram ;============== DrawChar: ;============== PUSH AX ;counting PUSH BX ;bitmask PUSH CX ;CH xcount, CL ycount PUSH ES ;screen ram PUSH DI ;offset PUSH DS ;char rom PUSH SI ;work_char ;es:di is screen ram MOV AX, screen_ram MOV ES,AX XOR DI,DI ;ds:si is the char rom MOV AX, CHAR_START1 MOV DS,AX MOV SI, CHAR_START2 .YLOOP MOV CL, 0h MOV BL, 80h ;bitmask reset .XLOOP MOV CH, 0h MOV AL, [DS:SI] AND AL,BL ;mask MOV [ES:DI], byte al ;write to screen SHR BX,1 ;move mask CMP CH,CHAR_WIDTH JNZ .XLOOP ADD DI, 320 ;offset+=320 ADD SI, 1 ;work_Char++ CMP CL,CHAR_HEIGHT JNZ .YLOOP POP SI POP DS POP DI POP ES POP CX POP BX POP AX RET ----------- If you have any source code about anything like this, please send it to me. I'd really appreciate it. Thanks for your time -Henri Ossi