Diff for /np2/win9x/x64/makegrph.x64 between versions 1.1 and 1.1.2.1

version 1.1, 2006/12/30 16:43:14 version 1.1.2.1, 2006/12/30 16:43:14
Line 0 Line 1
   
   %include 'pccore.inc'
   %include 'cpucore.inc'
   %include 'iocore.inc'
   %include 'vram.inc'
   
   section .bss
   
           extern  np2cfg
           extern  mem
           extern  np2_vram
           extern  renewal_line
           extern  dsync
           extern  vramupdate
           global  grph_table
   
   grph_table              resd    4*256*2
   
   
   GDC_S_SYNC              equ             gdc + gdc_t.s + gdcd_t.para
   GDC_S_ZOOM              equ             (GDC_S_SYNC+8)
   GDC_S_CSRFORM   equ             (GDC_S_ZOOM+1)
   GDC_S_SCROLL    equ             (GDC_S_CSRFORM+3)
   GDC_S_TEXTW             equ             (GDC_S_SCROLL+8)
   GDC_S_PITCH             equ             (GDC_S_TEXTW+8)
   GDC_S_LPEN              equ             (GDC_S_PITCH+1)
   GDC_S_VECTW             equ             (GDC_S_LPEN+3)
   GDC_S_CSRW              equ             (GDC_S_VECTW+11)
   GDC_S_MASK              equ             (GDC_S_CSRW+3)
   GDC_S_CSRR              equ             (GDC_S_MASK+2)
   GDC_S_WRITE             equ             (GDC_S_CSRR+5)
   
   
   
   section .text
   
                   align   16
                   global  makegrph_initialize
   
   makegrph_initialize:
                                   xor             r8, r8
   
   .0:                             mov             ecx, 4
                                   mov             edx, 1
   .1:                             shl             eax, 8
                                   test    r8d, edx
                                   setnz   al
                                   add             edx, edx
                                   loop    .1
   
                                   add             ecx, byte 4
                                   lea             r9, [grph_table + 4]
   .2:                             mov             [r9 + r8*8], eax
                                   add             eax, eax
                                   add             r9, 512*4
                                   loop    .2
   
                                   add             ecx, byte 4
   .3:                             shl             eax, 8
                                   test    r8d, edx
                                   setnz   al
                                   add             edx, edx
                                   loop    .3
   
                                   add             ecx, byte 4
                                   sub             r9, 512*4*4+4
   .4:                             mov             [r9 + r8*8], eax
                                   add             eax, eax
                                   add             r9, 512*4
                                   loop    .4
   
                                   inc             r8d
                                   cmp             r8d, 256
                                   jb              short .0
   
                                   ret
   
   
   
                           align   16
                           global  makegrph
   
           GRP_LR                  equ             rsp + 0
           LINE_WIDTH              equ             rsp + 4
   
   makegrph:               sub                     rsp, byte 40
                                   mov                     [rsp+8], rbx
                                   mov                     [rsp+16], rsi
                                   mov                     [rsp+24], rdi
                                   mov                     [rsp+32], rbp
   
                                   lea                     r8, [mem]
   
                                   mov                     eax, [dsync + dsync_t.grphvad]
                                   and                     ecx, byte 1
                                   je                      short .adjustpage
                                   add                     eax, SCRN_BUFSIZE
                                   add                     r8, VRAM_STEP
   .adjustpage:    lea                     rdi, [np2_vram]
                                   inc                     ecx
                                   add                     rdi, rax
                                   pxor            xmm0, xmm0
                                   movd            xmm1, ecx
                                   punpcklbw       xmm1, xmm1
                                   pshuflw         xmm1, xmm1, 0
                                   punpcklqdq      xmm1, xmm1
   
                                   mov                     dh, dl
                                   mov                     dl, cl
                                   cmp                     dh, 0
                                   je                      short .calcmaxline
   
                                   lea                     rbx, [vramupdate]
                                   mov                     ecx, 8000h/32
   .dirtyfilllp:   movapd          xmm2, [rbx]
                                   movapd          xmm3, [rbx+16]
                                   por                     xmm2, xmm1
                                   por                     xmm3, xmm1
                                   movapd          [rbx], xmm2
                                   movapd          [rbx+16], xmm3
                                   add                     rbx, byte 32
                                   loop            .dirtyfilllp
   
   .calcmaxline:   movzx           eax, byte [GDC_S_CSRFORM]
                                   and                     eax, byte 01fh
                                   mov                     [GRP_LR], eax
   
                                   mov                     ebx, [dsync + dsync_t.grph_vbp]
   .drawlp:                movzx           esi, word [GDC_S_SCROLL+ 0+0]
                                   movzx           ecx, word [GDC_S_SCROLL+ 0+2]
                                   call            .grphputlines
                                   movzx           esi, word [GDC_S_SCROLL+ 4+0]
                                   movzx           ecx, word [GDC_S_SCROLL+ 4+2]
                                   call            .grphputlines
                                   cmp                     byte [np2cfg + np2cfg_t.uPD72020], 0
                                   jne                     short .drawlp
                                   movzx           esi, word [GDC_S_SCROLL+ 8+0]
                                   movzx           ecx, word [GDC_S_SCROLL+ 8+2]
                                   call            .grphputlines
                                   movzx           esi, word [GDC_S_SCROLL+12+0]
                                   movzx           ecx, word [GDC_S_SCROLL+12+2]
                                   call            .grphputlines
                                   jmp                     short .drawlp
   
   .grphputlines:          movzx           eax, byte [GDC_S_PITCH]
                                           test            ecx, 4000h
                                           jne                     short .storewidth
                                           add                     eax, eax
   .storewidth:            and                     eax, 0000feh                            ; uPD72020¤Ç³Îǧ¡Ä
                                           mov                     [LINE_WIDTH+8], eax
   
                                           and                     esi, 3fffh
                                           add                     esi, esi
                                           shr                     ecx, 4
                                           and                     ecx, 03ffh
                                           jne                     short .grphlineputst
                                           mov                     ecx, 0400h
   .grphlineputst:         push            rcx
   
   .grphlineput_lp:        mov                     ecx, [GRP_LR+16]
   .grphline1_lp:          mov                     ebp, 79*2
                                           test            bl, 1
                                           je                      short .putline
                                           test            byte [gdc + gdc_t.mode1], 10h
                                           je                      short .putline
                                           add                     edi, 640
   
                                           cmp                     dh, 0                                           ; ALL_DRAWFLAG
                                           je                      short .putlineskip
                                           jmp                     near .linedirtyon
   
   .putline:                       push            rsi
   .linelp:                        test            [vramupdate + rsi], dl
                                           je                      short .nodirty
                                           movzx           eax, byte [r8 + rsi + VRAM0_B]
                                           movq            mm0, [grph_table + rax*8 + 0*0x800]
                                           movzx           eax, byte [r8 + rsi + VRAM0_R]
                                           por                     mm0, [grph_table + rax*8 + 1*0x800]
                                           movzx           eax, byte [r8 + rsi + VRAM0_G]
                                           por                     mm0, [grph_table + rax*8 + 2*0x800]
                                           movzx           eax, byte [r8 + rsi + VRAM0_E]
                                           por                     mm0, [grph_table + rax*8 + 3*0x800]
                                           or                      ebp, byte 1
                                           movq            [rdi], mm0
   .nodirty:                       inc                     esi
                                           and                     esi, 07fffh
                                           add                     rdi, byte 8
                                           sub                     ebp, byte 2
                                           jns                     short .linelp
                                           pop                     rsi
   
                                           test            ebp, 1
                                           je                      short .putlineskip
   .linedirtyon:           or                      [renewal_line + rbx], dl
   
   .putlineskip:           inc                     ebx
                                           cmp                     ebx, [dsync + dsync_t.grphymax]
                                           jnc                     short .grphbreak
                                           dec                     dword [rsp]
                                           je                      short .grphline1ed
                                           dec                     ecx
                                           jns                     near .grphline1_lp
                                           add                     esi, [LINE_WIDTH+16]
                                           and                     esi, 7fffh
                                           jmp                     near .grphlineput_lp
   
   .grphline1ed:           add                     rsp, byte 8
                                           ret
   
   .grphbreak:             add                     rsp, byte 16
   
                                   cmp                     dh, 0                                           ; ALL_DRAWFLAG
                                   je                      short .deldirty
   
                                   cmp                     ebx, [dsync + dsync_t.scrnymax]
                                   jae                     short .deldirty
   .bottomfill0:   or                      [renewal_line + rbx], dl
                                   mov                     ecx, 640/32
   .bottomfill1:   movapd          [rdi], xmm0
                                   movapd          [rdi+16], xmm0
                                   add                     rdi, byte 32
                                   loop            .bottomfill1
                                   inc                     ebx
                                   cmp                     ebx, [dsync + dsync_t.scrnymax]
                                   jb                      short .bottomfill0
   
   .deldirty:              pcmpeqd         xmm2, xmm2
                                   lea                     rbx, [vramupdate]
                                   pandn           xmm1, xmm2
                                   mov                     ecx, 8000h/32
   .deldirtylp:    movapd          xmm2, [rbx]
                                   movapd          xmm3, [rbx+16]
                                   pand            xmm2, xmm1
                                   pand            xmm3, xmm1
                                   movapd          [rbx], xmm2
                                   movapd          [rbx+16], xmm3
                                   add                     rbx, byte 32
                                   loop            .deldirtylp
   
                                   mov                     rbx, [rsp+8]
                                   mov                     rsi, [rsp+16]
                                   mov                     rdi, [rsp+24]
                                   mov                     rbp, [rsp+32]
                                   add                     rsp, byte 40
                                   emms
                                   ret
   
           ends
   

Removed from v.1.1  
changed lines
  Added in v.1.1.2.1


RetroPC.NET-CVS <cvs@retropc.net>