flat assembler
Message board for the users of flat assembler.

Index > DOS > problem with double buffering

Author
Thread Post new topic Reply to topic
rain_storm



Joined: 05 Apr 2007
Posts: 67
Location: Ireland
rain_storm 07 May 2008, 16:41
Can anyone explain why this is not double buffering i am using segment 0B000h as the drawing buffer and 0A000h as the display buffer. this example should simply cycle trough a pallet filling the screen with a single colour. but its only giving black is it wrong to use segment 0B000h for this purpose. I cant see why cos theres nothing stored in there except 0's. I really dont want to define my own buffer cos that would require 64kb.

Code:

 ORG 100h

 PALLET = 003C8h ; PALLET INDEX REGISTER
 VTRACE = 003DAh ; VERTICAL RETRACE STATUS PORT ADDRESS
 KEYBRD = 00060h ; KEYBOARD INPUT PORT ADDRESS
 VIDMEM = 0A000h ; VIDEO SEGMENT ADDRESS
 BUFFER = 0B000h ; DOUBLE BUFFER ADDRESS
 VIDSIZ = 0FA00h ; SIZE OF SCREEN IN BYTES

 INIT:MOV   AX,13h
      INT   10h
      PUSH  VIDMEM
      POP   ES
      PUSH  BUFFER
      POP   DS

 COLR:MOV   DX,PALLET
      XOR   AX,AX
      OUT   DX,AL
      INC   DX

 GREY:OUT   DX,AL
      OUT   DX,AL
      OUT   DX,AL
      INC   AL
      TEST  AL,64
      JZ    GREY

 MAIN:XOR   DI,DI
      XOR   SI,SI
      MOV   CX,VIDSIZ/4
      MOV   DX,VTRACE

 SYNC:IN    AL,DX
      TEST  AL,08h
      JZ    SYNC
      REP   MOVSD

      XOR   SI,SI
      MOV   CX,VIDSIZ/2
 DRAW:MOV   AX,[DS:SI]
      INC   AL
      INC   AH
      MOV   [DS:SI],AX
      ADD   SI,2
      LOOP  DRAW

 EXIT:IN    AL,KEYBRD
      DEC   AL
      JNZ   MAIN
      ;RET
      INT   20h 
    
Post 07 May 2008, 16:41
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 07 May 2008, 16:48
Does your video card support placing it's memory at 0xb0000? Or do you have some of the main SDRAM there? Remember there is a 'hole' in the 0xa0000-0xfffff memory area that is generally filled by external devices like video cards and network cards etc.

If you are running something like EMM386 then you might have some of your SDRAM mapped there but from what your results would indicate I think you don't have that turned on.
Post 07 May 2008, 16:48
View user's profile Send private message Visit poster's website Reply with quote
rain_storm



Joined: 05 Apr 2007
Posts: 67
Location: Ireland
rain_storm 07 May 2008, 16:57
Well that buggers that idea I would prefer that others could run it, Unless there is another 64k segment that I could use btw this is intended for a 256 byte demo so thats why I dont want to include the buffer in the com file. I'll have a poke around and see what I can do about it. Thanks for the quick reply revolution.

Edit:
yup using segment 7100h works perfectly since its shares with the 64k reserved for the com file but leaves me 1000h bytes for the executable which is more than enough for a 256 byte demo thanks again revolution
Post 07 May 2008, 16:57
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 07 May 2008, 17:11
I think it might be safer to just take the value of CS at entry and add 0x100 (i.e. 0x1000 bytes) and use that for your buffer.
Code:
mov ax,cs
add ax,0x100
mov ds,ax    
Post 07 May 2008, 17:11
View user's profile Send private message Visit poster's website Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 07 May 2008, 17:45
Hello Here there is a little example of Double buffer Smile
Post 07 May 2008, 17:45
View user's profile Send private message Reply with quote
rain_storm



Joined: 05 Apr 2007
Posts: 67
Location: Ireland
rain_storm 07 May 2008, 17:59
Thanks DJ thats a preatty good example looking through it now
Post 07 May 2008, 17:59
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.