From: "F.X.Gruber-Museum-Arnsdorf" Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP/NASM HELP!! Date: Thu, 12 Mar 1998 19:54:26 +0100 Organization: magnet Internet Services Lines: 61 Message-ID: <6e9alg$fag$1@orudios.magnet.at> References: NNTP-Posting-Host: 195.3.67.120 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk you wrote: >Ok, I finally got NASM to avoid using DJGPP's crappy looking unix-style >assembler. It works great. > >Next step, write video routines with NASM and link with DJGPP. Great, >easily done. Got the initialization and exit procs done. > >Now to write to video memory. Obviously I'm using 32-bit pmode and need >to access video memory. Now then, using TASM with DOS32(a 32 bit extender >for asm programmers), i simply access video memory via > >mov eax,0a0000h >mov [eax],15 ;plot a pixel in the upper left hand corner... > >0a0000h as opposed to 16-bit segmentation 0a000h > >this works fine with the flat mode in TASM linked with DOS32! > >however using NASM i keep getting a general protection error when it >reaches the mov eax,0a0000h statement. doesn't make much sense to me >unless NASM or DJGPP is protecting video memory from being written (and >why this would be i don't know). i dont really know how pmode works, but i think the problem lies in the segment registers. To write a pixel to the videoRAM, i used the following (inside a C-program): // i dont know exactly if the djgpp_???_names are correct, would have to look them // up in the documentation int v_address=0xa0000h + _djgpp_conventinal_memory_base; _djgpp_nearptr_enable(); // i dont use NASM, so ASM-operators are somehow swapped ? asm(" mov v_address,%eax // v_address to eax mov $15,[%eax] // 15 to [eax] "); _djgpp_nearptr_disable(); this works perfectly well, even in VESA2.0 linear frame buffer ! i used a ASM-DOS 32bit-extender myself, which had all segment regs (cs,ds,ss...) set to the same address, so you needn't worry about them. Perhaps DOS32 does the same, but DJGPP does not, when addressing memoty you must know what's in the seg-regs. > >anyway, if you can shed some light on this mystery it would help >tremendously. btw, i dont like the assembler i'm currently using inside DJGPP. You seem to use DJGPP, but with a normal, x86-style assembler. could you give me any information about this ? thanx Li