For double buffering in SVGA you have to make a virtual array with the size of the screen, no probem. But the memcopy routine which has to blit the whole buffer to the video segment does not work properly. Some things get messed up and only 1/4 part of each bank is filled. Perhaps you could take a look at the code and tell where it's wrong.
Here are the routines that are giving the headache.
sub VESA_Scr2Mem(seg_buf as word) ' seg_buf: Segment
' of Virtual Array
' Direct Bank Switch Pointer
asm_WFP???=DPBVX_INTERNAL_WIN_FUNC_PTR
' Number of Banks
asm_NOB??=DPBVX_INTERNAL_NUMBER_OF_BANKS
' Video Segment
asm_SEG??=DPBVX_INTERNAL_WIN_A_SEG
'
' dx : current bank
' es:[si] : pointer to target memory (buffer)
' ds:[di] : pointer to source memory (screen)
'
dim bank as word
startseg??=seg_buf
for bank=0 to asm_NOB??
p1??=startseg??
p2??=startseg??+1
p3??=startseg??+2
p4??=startseg??+3
! push ds
! db &h60 ; -------------
! mov dx,bank ; Direct Bank
! xor bx,bx ; Switch
! lds di,asm_WFP??? ; Routine
! call dword ptr ds:[di] ;
! db &h61 ; -------------
! mov ax,asm_SEG??
! mov ds,ax
! mov ax,p1?? ; This should copy
! mov es,ax ; the first 16k
! xor si,si ; from each bank
! xor di,di ; to the buffer
! mov cx,&h1000 ;
! db &h66 ;
! rep movsw ;
! mov ax,p2?? ; This should copy
! mov es,ax ; the second 16k
! xor si,si ; from each bank
! mov di,&h4000 ; to the buffer
! mov cx,&h1000 ;
! db &h66 ;
! rep movsw ;
! mov ax,p3?? ; This should copy
! mov es,ax ; the third 16k
! xor si,si ; from each bank
! mov di,&h8000 ; to the buffer
! mov cx,&h1000 ;
! db &h66 ;
! rep movsw ;
! mov ax,p4?? ; This should copy
! mov es,ax ; the fourth 16k
! xor si,si ; from each bank
! mov di,&hc000 ; to the buffer
! mov cx,&h1000 ;
! db &h66 ; Together the whole bank (64k)
! rep movsw ;
! pop ds
incr startseg??,4 ' jump over 4 segs ( good way? )
next bank
end sub
sub VESA_Mem2Scr(seg_buf as word) ' seg_buf: Segment
' of Virtual Array
' Direct Bank Switch Pointer
asm_WFP???=DPBVX_INTERNAL_WIN_FUNC_PTR
' Number of Banks
asm_NOB??=DPBVX_INTERNAL_NUMBER_OF_BANKS
' Video Segment
asm_SEG??=DPBVX_INTERNAL_WIN_A_SEG
'
' dx : current bank
' es:[si] : pointer to target memory (screen)
' ds:[di] : pointer to source memory (buffer)
'
dim bank as word
startseg??=seg_buf
for bank=0 to asm_NOB??
p1??=startseg??
p2??=startseg??+1
p3??=startseg??+2
p4??=startseg??+3
! push ds
! db &h60 ; -------------
! mov dx,bank ; Direct Bank
! xor bx,bx ; Switch
! lds di,asm_WFP??? ; Routine
! call dword ptr ds:[di] ;
! db &h61 ; -------------
! mov ax,asm_SEG??
! mov es,ax
! mov ax,p1?? ; This should copy
! mov ds,ax ; the first 16k
! xor di,di ; back to the screen
! xor si,si ; for each bank
! mov cx,&h1000 ;
! db &h66 ;
! rep movsw ;
! mov ax,p2?? ; etc...
! mov ds,ax
! xor di,di
! mov si,&h4000
! mov cx,&h1000
! db &h66
! rep movsw
! mov ax,p3??
! mov ds,ax
! xor di,di
! mov si,&h8000
! mov cx,&h1000
! db &h66
! rep movsw
! mov ax,p4??
! mov ds,ax
! xor di,di
! mov si,&hc000
! mov cx,&h1000
! db &h66
! rep movsw
! pop ds
incr startseg??,4
next bank
end sub
------------------
Here are the routines that are giving the headache.
sub VESA_Scr2Mem(seg_buf as word) ' seg_buf: Segment
' of Virtual Array
' Direct Bank Switch Pointer
asm_WFP???=DPBVX_INTERNAL_WIN_FUNC_PTR
' Number of Banks
asm_NOB??=DPBVX_INTERNAL_NUMBER_OF_BANKS
' Video Segment
asm_SEG??=DPBVX_INTERNAL_WIN_A_SEG
'
' dx : current bank
' es:[si] : pointer to target memory (buffer)
' ds:[di] : pointer to source memory (screen)
'
dim bank as word
startseg??=seg_buf
for bank=0 to asm_NOB??
p1??=startseg??
p2??=startseg??+1
p3??=startseg??+2
p4??=startseg??+3
! push ds
! db &h60 ; -------------
! mov dx,bank ; Direct Bank
! xor bx,bx ; Switch
! lds di,asm_WFP??? ; Routine
! call dword ptr ds:[di] ;
! db &h61 ; -------------
! mov ax,asm_SEG??
! mov ds,ax
! mov ax,p1?? ; This should copy
! mov es,ax ; the first 16k
! xor si,si ; from each bank
! xor di,di ; to the buffer
! mov cx,&h1000 ;
! db &h66 ;
! rep movsw ;
! mov ax,p2?? ; This should copy
! mov es,ax ; the second 16k
! xor si,si ; from each bank
! mov di,&h4000 ; to the buffer
! mov cx,&h1000 ;
! db &h66 ;
! rep movsw ;
! mov ax,p3?? ; This should copy
! mov es,ax ; the third 16k
! xor si,si ; from each bank
! mov di,&h8000 ; to the buffer
! mov cx,&h1000 ;
! db &h66 ;
! rep movsw ;
! mov ax,p4?? ; This should copy
! mov es,ax ; the fourth 16k
! xor si,si ; from each bank
! mov di,&hc000 ; to the buffer
! mov cx,&h1000 ;
! db &h66 ; Together the whole bank (64k)
! rep movsw ;
! pop ds
incr startseg??,4 ' jump over 4 segs ( good way? )
next bank
end sub
sub VESA_Mem2Scr(seg_buf as word) ' seg_buf: Segment
' of Virtual Array
' Direct Bank Switch Pointer
asm_WFP???=DPBVX_INTERNAL_WIN_FUNC_PTR
' Number of Banks
asm_NOB??=DPBVX_INTERNAL_NUMBER_OF_BANKS
' Video Segment
asm_SEG??=DPBVX_INTERNAL_WIN_A_SEG
'
' dx : current bank
' es:[si] : pointer to target memory (screen)
' ds:[di] : pointer to source memory (buffer)
'
dim bank as word
startseg??=seg_buf
for bank=0 to asm_NOB??
p1??=startseg??
p2??=startseg??+1
p3??=startseg??+2
p4??=startseg??+3
! push ds
! db &h60 ; -------------
! mov dx,bank ; Direct Bank
! xor bx,bx ; Switch
! lds di,asm_WFP??? ; Routine
! call dword ptr ds:[di] ;
! db &h61 ; -------------
! mov ax,asm_SEG??
! mov es,ax
! mov ax,p1?? ; This should copy
! mov ds,ax ; the first 16k
! xor di,di ; back to the screen
! xor si,si ; for each bank
! mov cx,&h1000 ;
! db &h66 ;
! rep movsw ;
! mov ax,p2?? ; etc...
! mov ds,ax
! xor di,di
! mov si,&h4000
! mov cx,&h1000
! db &h66
! rep movsw
! mov ax,p3??
! mov ds,ax
! xor di,di
! mov si,&h8000
! mov cx,&h1000
! db &h66
! rep movsw
! mov ax,p4??
! mov ds,ax
! xor di,di
! mov si,&hc000
! mov cx,&h1000
! db &h66
! rep movsw
! pop ds
incr startseg??,4
next bank
end sub
------------------
Comment