Diff for /np2/i286x/memory.x86 between versions 1.2 and 1.15

version 1.2, 2003/10/19 14:56:15 version 1.15, 2005/05/20 13:59:47
Line 2 Line 2
 ;  ;
 ; ToDo: egc word-boundary  ; ToDo: egc word-boundary
   
 %include 'x86/np2asm.inc'  %include 'np2asm.inc'
   %include 'cpucore.inc'
   %include 'iocore.inc'
   %include 'vram.inc'
   
 section .bss  section .bss
   
         extern  _mem          global  _mem
         extern  _i286reg          extern  _i286core
         extern  _grcg  
         extern  _extmem  
         extern  _gdcs  
         extern  _tramupdate          extern  _tramupdate
         extern  _vramupdate          extern  _vramupdate
         extern  _cgwindow  
 ;       extern  ___font  
         extern  _itf  
         extern  _vramop          extern  _vramop
   
         extern  _extmemmng_ptr  _mem    resb    0x200000
         extern  _extmemmng_size  
   
   
 MAINMEMORY              equ             _mem  MAINMEMORY              equ             _mem
Line 27  EXTMEMORY  equ  0 Line 23  EXTMEMORY  equ  0
 VIDEOMEMORY             equ             _mem  VIDEOMEMORY             equ             _mem
 USERSMEMORY_R   equ             0a8000h  USERSMEMORY_R   equ             0a8000h
 USERSMEMORY_W   equ             0a0000h  USERSMEMORY_W   equ             0a0000h
   _extmemmng_ptr  equ             _i286core + cpucore_t.ext
   _extmemmng_size equ             _i286core + cpucore_t.extsize
   
 %if 1  %if 1
 _font                   equ             _mem + FONT_ADRS  _font                   equ             _mem + FONT_ADRS
Line 78  extern @tracevramwrite_w@8 Line 76  extern @tracevramwrite_w@8
 %endmacro  %endmacro
 %endif  %endif
   
   
 section .text  section .text
   
 ; ----------------------------------------------------------------- write byte  ; ----------------------------------------------------------------- write byte
   
   
 %if USE_EGCASM  %if USE_EGCASM
         extern  _egca_read          extern  egc_read
         extern  _egca_read_w          extern  egc_read_w
         extern  _egca_write          extern  egc_write
         extern  _egca_write_w          extern  egc_write_w
 %else  %else
         extern  @egc_read@4          extern  @memegc_rd8@4
         extern  @egc_read_w@4          extern  @memegc_rd16@4
         extern  @egc_write@8          extern  @memegc_wr8@8
         extern  @egc_write_w@8          extern  @memegc_wr16@8
 %endif  %endif
   
 ; normal memory  ; normal memory
                                         align   16                                          align   16
 @i286_wt:                       mov             ebx, ecx  @i286_wt:                       mov             ebx, ecx
                                         and             ebx, [_extmem + extmem_t.adrsmask]                                          and             ebx, [_i286core + cpucore_t.adrsmask]
                                         mov             [MAINMEMORY + ebx], dl                                          mov             [MAINMEMORY + ebx], dl
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
Line 107  section .text Line 104  section .text
 ; tram write  ; tram write
                                         align   16                                          align   16
 @tram_wt:                       mov             ebx, [_vramop + vramop_t.tramwait]  @tram_wt:                       mov             ebx, [_vramop + vramop_t.tramwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         mov             ebx, ecx                                          mov             ebx, ecx
                                         cmp             ecx, 000a2000h                                          cmp             ecx, 000a2000h
                                         jnc             short wtram_a                                          jnc             short wtram_a
Line 123  wtram_a:   cmp  ecx, 000a3fe0h Line 120  wtram_a:   cmp  ecx, 000a3fe0h
                                         jc              short wtram_m                                          jc              short wtram_m
                                         cmp             ecx, 000a4000h                                          cmp             ecx, 000a4000h
                                         jnc             wcgwindow_s                                          jnc             wcgwindow_s
                                           test    ecx, 2
                                           je              short wtram_m
                                         cmp             byte [_gdcs + gdcs_t.msw_accessable], 0                                          cmp             byte [_gdcs + gdcs_t.msw_accessable], 0
                                         je              short wtram_e                                          je              short wtram_e
 wtram_m:                        shr             ebx, 1  wtram_m:                        shr             ebx, 1
Line 156  wcgwindow_e:  pop  ebx Line 155  wcgwindow_e:  pop  ebx
                                         or              byte [_vramupdate + ebx], 1                                          or              byte [_vramupdate + ebx], 1
                                         or              byte [_gdcs + gdcs_t.grphdisp], 1                                          or              byte [_gdcs + gdcs_t.grphdisp], 1
                                         mov             ebx, [_vramop + vramop_t.vramwait]                                          mov             ebx, [_vramop + vramop_t.vramwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
   
Line 168  wcgwindow_e:  pop  ebx Line 167  wcgwindow_e:  pop  ebx
                                         or              byte [_vramupdate + ebx], 2                                          or              byte [_vramupdate + ebx], 2
                                         or              byte [_gdcs + gdcs_t.grphdisp], 2                                          or              byte [_gdcs + gdcs_t.grphdisp], 2
                                         mov             ebx, [_vramop + vramop_t.vramwait]                                          mov             ebx, [_vramop + vramop_t.vramwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
   
Line 189  wcgwindow_e:  pop  ebx Line 188  wcgwindow_e:  pop  ebx
                                         or              byte [_gdcs + gdcs_t.grphdisp], 1                                          or              byte [_gdcs + gdcs_t.grphdisp], 1
   
 grcg_rmw:                       mov             ebx, [_vramop + vramop_t.grcgwait]  grcg_rmw:                       mov             ebx, [_vramop + vramop_t.grcgwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         mov             ebx, dword [_grcg + grcg_t.mode]                                          mov             ebx, dword [_grcg + grcg_t.mode]
                                         mov             bl, dl                                          mov             bl, dl
                                         not             bl                                          not             bl
Line 238  grcgrmw_end:  pop  ecx Line 237  grcgrmw_end:  pop  ecx
                                         or              byte [_gdcs + gdcs_t.grphdisp], 1                                          or              byte [_gdcs + gdcs_t.grphdisp], 1
   
 grcg_tdw:                       mov             ebx, [_vramop + vramop_t.grcgwait]  grcg_tdw:                       mov             ebx, [_vramop + vramop_t.grcgwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         mov             bh, [_grcg + grcg_t.modereg]                                          mov             bh, [_grcg + grcg_t.modereg]
                                         shr             bh, 1                                          shr             bh, 1
                                         jc              short grcgtdw_r                                          jc              short grcgtdw_r
Line 263  grcgtdw_end:  pop  ecx Line 262  grcgtdw_end:  pop  ecx
 ; EGC bridge  ; EGC bridge
                                         align   16                                          align   16
 @egc_wt:                        VRAMTRACE  @egc_wt:                        VRAMTRACE
                                           mov             ebx, [_vramop + vramop_t.grcgwait]
                                           sub             [_i286core + cpucore_t.remainclock], ebx
                                         pop             ebx                                          pop             ebx
 %if USE_EGCASM  %if USE_EGCASM
                                         jmp             _egca_write                                                     ; ver0.26                                          jmp             egc_write
 %else  %else
                                         pushad                                          pushad
                                         call    @egc_write@8                                          call    @memegc_wr8@8
                                         popad                                          popad
                                         ret                                          ret
 %endif  %endif
Line 280  grcgtdw_end:  pop  ecx Line 281  grcgtdw_end:  pop  ecx
                                         and             ecx, 3fffh                                          and             ecx, 3fffh
                                         shr             ebx, 12                                          shr             ebx, 12
                                         and             ebx, byte (3*4)                                          and             ebx, byte (3*4)
                                         add             ecx, [_extmem + extmem_t.pageptr + ebx]                                          add             ecx, [_i286core + cpucore_t.ems + ebx]
                                         mov             [EXTMEMORY + ecx], dl                                   ; ver0.28                                          mov             [EXTMEMORY + ecx], dl
                                         pop             ecx                                          pop             ecx
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
   
   @i286_wb:                       mov             [MAINMEMORY + 1c8000h - 0e8000h + ecx], dl
                                           pop             ebx
                                           ret
   
 ; non writable memory  ; non writable memory
                                         align   16                                          align   16
 @i286_wn:                       pop             ebx  @i286_wn:                       pop             ebx
Line 297  grcgtdw_end:  pop  ecx Line 302  grcgtdw_end:  pop  ecx
 ; normal memory  ; normal memory
                                         align   16                                          align   16
 @i286_rd:                       mov             ebx, ecx  @i286_rd:                       mov             ebx, ecx
                                         and             ebx, [_extmem + extmem_t.adrsmask]                                          and             ebx, [_i286core + cpucore_t.adrsmask]
                                         mov             al, [MAINMEMORY + ebx]                                          mov             al, [MAINMEMORY + ebx]
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
Line 305  grcgtdw_end:  pop  ecx Line 310  grcgtdw_end:  pop  ecx
 ; font cg-window  ; font cg-window
                                         align   16                                          align   16
 @tram_rd:                       mov             ebx, [_vramop + vramop_t.tramwait]  @tram_rd:                       mov             ebx, [_vramop + vramop_t.tramwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         cmp             ecx, 0a4000h                                          cmp             ecx, 0a4000h
                                         jnc             rcgwindow_s                                          jnc             rcgwindow_s
 rcgwindow_n:            mov             al, [MAINMEMORY + ecx]  rcgwindow_n:            mov             al, [MAINMEMORY + ecx]
Line 328  rcgwindow_s:  cmp  ecx, 0a5000h Line 333  rcgwindow_s:  cmp  ecx, 0a5000h
                                         align   16                                          align   16
 @vram_r0:                       mov             al, [VIDEOMEMORY + ecx]  @vram_r0:                       mov             al, [VIDEOMEMORY + ecx]
                                         mov             ebx, [_vramop + vramop_t.vramwait]                                          mov             ebx, [_vramop + vramop_t.vramwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
   
Line 336  rcgwindow_s:  cmp  ecx, 0a5000h Line 341  rcgwindow_s:  cmp  ecx, 0a5000h
                                         align   16                                          align   16
 @vram_r1:                       mov             al, [VIDEOMEMORY + VRAM_STEP + ecx]  @vram_r1:                       mov             al, [VIDEOMEMORY + VRAM_STEP + ecx]
                                         mov             ebx, [_vramop + vramop_t.vramwait]                                          mov             ebx, [_vramop + vramop_t.vramwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
   
Line 351  rcgwindow_s:  cmp  ecx, 0a5000h Line 356  rcgwindow_s:  cmp  ecx, 0a5000h
                                         and             ecx, 7fffh                                          and             ecx, 7fffh
   
 grcg_tcr:                       mov             ebx, [_vramop + vramop_t.grcgwait]  grcg_tcr:                       mov             ebx, [_vramop + vramop_t.grcgwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         mov             al, 0                                          mov             al, 0
                                         mov             bh, [_grcg + grcg_t.modereg]                                          mov             bh, [_grcg + grcg_t.modereg]
                                         shr             bh, 1                                          shr             bh, 1
Line 380  grcgtcr_end:  not  al Line 385  grcgtcr_end:  not  al
   
 ; EGC bridge  ; EGC bridge
                                         align   16                                          align   16
 @egc_rd:                        pop             ebx  @egc_rd:                        mov             ebx, [_vramop + vramop_t.grcgwait]
                                           sub             [_i286core + cpucore_t.remainclock], ebx
                                           pop             ebx
 %if USE_EGCASM  %if USE_EGCASM
                                         jmp             _egca_read                                                      ; ver0.26                                          jmp             egc_read
 %else  %else
                                         pushad                                          pushad
                                         call    @egc_read@4                                          call    @memegc_rd8@4
                                         mov             [esp + 28], al                                          mov             [esp + 28], al
                                         popad                                          popad
                                         ret                                          ret
Line 399  grcgtcr_end:  not  al Line 406  grcgtcr_end:  not  al
                                         and             ecx, 3fffh                                          and             ecx, 3fffh
                                         shr             ebx, 12                                          shr             ebx, 12
                                         and             ebx, byte (3*4)                                          and             ebx, byte (3*4)
                                         add             ecx, [_extmem + extmem_t.pageptr + ebx]                                          add             ecx, [_i286core + cpucore_t.ems + ebx]
                                         mov             al, [EXTMEMORY + ecx]                                   ; ver0.28                                          mov             al, [EXTMEMORY + ecx]
                                         pop             ecx                                          pop             ecx
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
   
 ; BIOS or ITF  ; BIOS or ITF
                                         align   16                                          align   16
 @i286_itf:                      cmp             byte [_itf], 0  @i286_rb:                       pop             ebx
                                         jne             readmem_itr                                          cmp             byte [_i286core + cpucore_t.itfbank], 0
                                           jne             readmem_itf
                                         mov             al, [MAINMEMORY + ecx]                                          mov             al, [MAINMEMORY + ecx]
                                         pop             ebx  
                                         ret                                          ret
                                         align   16  readmem_itf:            mov             al, [MAINMEMORY + VRAM_STEP + ecx]
 readmem_itr:            mov             ebx, ecx  
                                         and             ebx, 00007fffh  
                                         mov             al, [MAINMEMORY + ITF_ADRS + ebx]  
                                         pop             ebx  
                                         ret                                          ret
   
 ; ----------------------------------------------------------------- write word  ; ----------------------------------------------------------------- write word
Line 424  readmem_itr:  mov  ebx, ecx Line 427  readmem_itr:  mov  ebx, ecx
 ; normal memory  ; normal memory
                                         align   16                                          align   16
 @i286w_wt:                      mov             ebx, ecx  @i286w_wt:                      mov             ebx, ecx
                                         and             ebx, [_extmem + extmem_t.adrsmask]                                          and             ebx, [_i286core + cpucore_t.adrsmask]
                                         mov             [MAINMEMORY + ebx], dx                                          mov             [MAINMEMORY + ebx], dx
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
Line 432  readmem_itr:  mov  ebx, ecx Line 435  readmem_itr:  mov  ebx, ecx
 ; tram write  ; tram write
                                         align   16                                          align   16
 @tramw_wt:                      mov             ebx, [_vramop + vramop_t.tramwait]  @tramw_wt:                      mov             ebx, [_vramop + vramop_t.tramwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         mov             ebx, ecx                                          mov             ebx, ecx
                                         cmp             ecx, 000a1fffh                                          cmp             ecx, 000a1fffh
                                         jnc             short wtramw_a                                          jnc             short wtramw_a
Line 455  wtramw_a:   je  short wword_a1fffh Line 458  wtramw_a:   je  short wword_a1fffh
                                         jc              short wtramw_m                                          jc              short wtramw_m
                                         cmp             ecx, 000a3fffh                                          cmp             ecx, 000a3fffh
                                         jnc             wcgwindoww_s                                          jnc             wcgwindoww_s
                                           test    ecx, 2
                                           je              short wtramw_m
                                         cmp             byte [_gdcs + gdcs_t.msw_accessable], 0                                          cmp             byte [_gdcs + gdcs_t.msw_accessable], 0
                                         je              short wtramw_e                                          je              short wtramw_e
 wtramw_m:                       and             ebx, 1fffh  wtramw_m:                       and             ebx, 1fffh
Line 507  wcgwinw_odd:  add  ebx, dword [_cgwindow Line 512  wcgwinw_odd:  add  ebx, dword [_cgwindow
                                         or              word [_vramupdate + ebx], 0101h                                          or              word [_vramupdate + ebx], 0101h
                                         or              byte [_gdcs + gdcs_t.grphdisp], 1                                          or              byte [_gdcs + gdcs_t.grphdisp], 1
                                         mov             ebx, [_vramop + vramop_t.vramwait]                                          mov             ebx, [_vramop + vramop_t.vramwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
   
Line 519  wcgwinw_odd:  add  ebx, dword [_cgwindow Line 524  wcgwinw_odd:  add  ebx, dword [_cgwindow
                                         or              word [_vramupdate + ebx], 0202h                                          or              word [_vramupdate + ebx], 0202h
                                         or              byte [_gdcs + gdcs_t.grphdisp], 2                                          or              byte [_gdcs + gdcs_t.grphdisp], 2
                                         mov             ebx, [_vramop + vramop_t.vramwait]                                          mov             ebx, [_vramop + vramop_t.vramwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
   
Line 540  wcgwinw_odd:  add  ebx, dword [_cgwindow Line 545  wcgwinw_odd:  add  ebx, dword [_cgwindow
                                         or              byte [_gdcs + gdcs_t.grphdisp], 1                                          or              byte [_gdcs + gdcs_t.grphdisp], 1
   
 grcgw_rmw:                      mov             ebx, [_vramop + vramop_t.grcgwait]  grcgw_rmw:                      mov             ebx, [_vramop + vramop_t.grcgwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         push    eax                                          push    eax
                                         mov             ebx, dword [_grcg + grcg_t.mode]                                          mov             ebx, dword [_grcg + grcg_t.mode]
                                         mov             bx, dx                                          mov             bx, dx
Line 591  grcgwrmw_end:  pop  eax Line 596  grcgwrmw_end:  pop  eax
                                         or              byte [_gdcs + gdcs_t.grphdisp], 1                                          or              byte [_gdcs + gdcs_t.grphdisp], 1
   
 grcgw_tdw:                      mov             ebx, [_vramop + vramop_t.grcgwait]  grcgw_tdw:                      mov             ebx, [_vramop + vramop_t.grcgwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         mov             ebx, [_grcg + grcg_t.mode]                                          mov             ebx, [_grcg + grcg_t.mode]
                                         test    ebx, 010000h                                          test    ebx, 010000h
                                         jne             short grcgwtdw_r                                          jne             short grcgwtdw_r
Line 616  grcgwtdw_end:  pop  ecx Line 621  grcgwtdw_end:  pop  ecx
 ; EGC bridge  ; EGC bridge
                                         align   16                                          align   16
 @egcw_wt:                       VRAMTRACE_W  @egcw_wt:                       VRAMTRACE_W
                                           mov             ebx, [_vramop + vramop_t.grcgwait]
                                           sub             [_i286core + cpucore_t.remainclock], ebx
                                         pop             ebx                                          pop             ebx
 %if USE_EGCASM  %if USE_EGCASM
                                         jmp             _egca_write_w                                           ; ver0.26                                          jmp             egc_write_w
 %else  %else
                                         test    ecx, 1  
                                         jne             short egcw_wtodd  
                                         pushad                                          pushad
                                         call    @egc_write_w@8                                          call    @memegc_wr16@8
                                         popad  
                                         ret  
 egcw_wtodd:  
                                         pushad  
                                         push    ecx  
                                         push    edx  
                                         call    @egc_write@8  
                                         pop             edx  
                                         pop             ecx  
                                         inc             ecx  
                                         shr             edx, 8  
                                         call    @egc_write@8  
                                         popad                                          popad
                                         ret                                          ret
 %endif  %endif
Line 647  egcw_wtodd: Line 640  egcw_wtodd:
                                         and             ecx, 3fffh                                          and             ecx, 3fffh
                                         shr             ebx, 12                                          shr             ebx, 12
                                         and             ebx, byte (3*4)                                          and             ebx, byte (3*4)
                                         add             ecx, [_extmem + extmem_t.pageptr + ebx]                                          add             ecx, [_i286core + cpucore_t.ems + ebx]
                                         mov             [EXTMEMORY + ecx], dx                                   ; ver0.28                                          mov             [EXTMEMORY + ecx], dx
                                         pop             ecx                                          pop             ecx
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
   
   @i286w_wb:                      mov             [MAINMEMORY + 1c8000h - 0e8000h + ecx], dx
                                           pop             ebx
                                           ret
   
 ; ------------------------------------------------------------------ read word  ; ------------------------------------------------------------------ read word
   
 ; normal memory  ; normal memory
                                         align   16                                          align   16
 @i286w_rd:                      mov             ebx, ecx  @i286w_rd:                      mov             ebx, ecx
                                         and             ebx, [_extmem + extmem_t.adrsmask]                                          and             ebx, [_i286core + cpucore_t.adrsmask]
                                         mov             ax, [MAINMEMORY + ebx]                                          mov             ax, [MAINMEMORY + ebx]
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
Line 666  egcw_wtodd: Line 663  egcw_wtodd:
 ; font cg-window  ; font cg-window
                                         align   16                                          align   16
 @tramw_rd:                      mov             ebx, [_vramop + vramop_t.tramwait]  @tramw_rd:                      mov             ebx, [_vramop + vramop_t.tramwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         cmp             ecx, 0a3fffh                                          cmp             ecx, 0a3fffh
                                         jnc             rcgwwindow_s                                          jnc             rcgwwindow_s
                                         mov             ax, [MAINMEMORY + ecx]                                          mov             ax, [MAINMEMORY + ecx]
Line 720  rcgwwindow_a4fff: mov  ebx, dword [_cgwi Line 717  rcgwwindow_a4fff: mov  ebx, dword [_cgwi
                                         align   16                                          align   16
 @vramw_r0:                      mov             ax, [VIDEOMEMORY + ecx]  @vramw_r0:                      mov             ax, [VIDEOMEMORY + ecx]
                                         mov             ebx, [_vramop + vramop_t.vramwait]                                          mov             ebx, [_vramop + vramop_t.vramwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
   
Line 728  rcgwwindow_a4fff: mov  ebx, dword [_cgwi Line 725  rcgwwindow_a4fff: mov  ebx, dword [_cgwi
                                         align   16                                          align   16
 @vramw_r1:                      mov             ax, [VIDEOMEMORY + VRAM_STEP + ecx]  @vramw_r1:                      mov             ax, [VIDEOMEMORY + VRAM_STEP + ecx]
                                         mov             ebx, [_vramop + vramop_t.vramwait]                                          mov             ebx, [_vramop + vramop_t.vramwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
   
Line 743  rcgwwindow_a4fff: mov  ebx, dword [_cgwi Line 740  rcgwwindow_a4fff: mov  ebx, dword [_cgwi
                                         and             ecx, 7fffh                                          and             ecx, 7fffh
   
 grcgw_tcr:                      mov             ebx, [_vramop + vramop_t.grcgwait]  grcgw_tcr:                      mov             ebx, [_vramop + vramop_t.grcgwait]
                                         sub             [_i286reg + i286reg_t.remainclock], ebx                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         mov             ax, 0                                          mov             ax, 0
                                         mov             ebx, [_grcg + grcg_t.mode]                                          mov             ebx, [_grcg + grcg_t.mode]
                                         test    ebx, 010000h                                          test    ebx, 010000h
Line 772  grcgwtcr_end:  not  ax Line 769  grcgwtcr_end:  not  ax
   
 ; EGC bridge  ; EGC bridge
                                         align   16                                          align   16
 @egcw_rd:                       pop             ebx  @egcw_rd:                       mov             ebx, [_vramop + vramop_t.grcgwait]
                                         test    ecx, 1                                          sub             [_i286core + cpucore_t.remainclock], ebx
                                         jne             short egcw_rdodd                                          pop             ebx
 %if USE_EGCASM  %if USE_EGCASM
                                         jmp             _egca_read_w                                            ; ver0.26                                          jmp             egc_read_w
 %else  %else
                                         pushad                                          pushad
                                         call    @egc_read_w@4                                          call    @memegc_rd16@4
                                         mov             [esp + 28], ax                                          mov             [esp + 28], ax
                                         popad                                          popad
                                         ret                                          ret
 %endif  %endif
   
 egcw_rdodd:  
 %if USE_EGCASM                                                                                          ; ver0.26  
                                         inc             ecx  
                                         call    _egca_read  
                                         mov             ah, al  
                                         dec             ecx  
                                         jmp             _egca_read  
 %else  
                                         pushad  
                                         push    ecx  
                                         call    @egc_read@4  
                                         pop             ecx  
                                         mov             [esp+28], al  
                                         inc             ecx  
                                         call    @egc_read@4  
                                         mov             [esp+29], al  
                                         popad  
 %endif  
                                         ret  
   
 ; EMM read  ; EMM read
                                         align   16                                          align   16
Line 812  egcw_rdodd: Line 790  egcw_rdodd:
                                         and             ecx, 3fffh                                          and             ecx, 3fffh
                                         shr             ebx, 12                                          shr             ebx, 12
                                         and             ebx, byte (3*4)                                          and             ebx, byte (3*4)
                                         add             ecx, [_extmem + extmem_t.pageptr + ebx]                                          add             ecx, [_i286core + cpucore_t.ems + ebx]
                                         mov             ax, [EXTMEMORY + ecx]                                   ; ver0.28                                          mov             ax, [EXTMEMORY + ecx]
                                         pop             ecx                                          pop             ecx
                                         pop             ebx                                          pop             ebx
                                         ret                                          ret
   
 ; BIOS or ITF  ; BIOS or ITF
                                         align   16                                          align   16
 @i286w_itf:                     cmp             byte [_itf], 0  @i286w_rb:                      pop             ebx
                                         jne             readwmem_itr                                          cmp             byte [_i286core + cpucore_t.itfbank], 0
                                           jne             readwmem_itf
                                         mov             ax, [MAINMEMORY + ecx]                                          mov             ax, [MAINMEMORY + ecx]
                                         pop             ebx  
                                         ret                                          ret
                                         align   16  readwmem_itf:           mov             ax, [MAINMEMORY + VRAM_STEP + ecx]
 readwmem_itr:           mov             ebx, ecx  
                                         and             ebx, 00007fffh  
                                         mov             ax, [MAINMEMORY + ITF_ADRS + ebx]  
                                         pop             ebx  
                                         ret                                          ret
   
   
 section .data  section .data
   
 ; ---------------------------------------------------------------------- table  ; ---------------------------------------------------------------------- table
   
         global  _memory_write  
         global  _memory_read          global  _memory_read
           global  _memory_write
   
   _memory_read    dd      @i286_rd,               @i286_rd                ; 00
                                   dd      @i286_rd,               @i286_rd                ; 10
                                   dd      @i286_rd,               @i286_rd                ; 20
                                   dd      @i286_rd,               @i286_rd                ; 30
                                   dd      @i286_rd,               @i286_rd                ; 40
                                   dd      @i286_rd,               @i286_rd                ; 50
                                   dd      @i286_rd,               @i286_rd                ; 60
                                   dd      @i286_rd,               @i286_rd                ; 70
                                   dd      @i286_rd,               @i286_rd                ; 80
                                   dd      @i286_rd,               @i286_rd                ; 90
                                   dd      @tram_rd,               @vram_r0                ; a0
                                   dd      @vram_r0,               @vram_r0                ; b0
                                   dd      @emmc_rd,               @emmc_rd                ; c0
                                   dd      @i286_rd,               @i286_rd                ; d0
                                   dd      @vram_r0,               @i286_rd                ; e0
                                   dd      @i286_rd,               @i286_rb                ; f0
   
 _memory_write   dd      @i286_wt,               @i286_wt                ; 00  _memory_write   dd      @i286_wt,               @i286_wt                ; 00
                                 dd      @i286_wt,               @i286_wt                ; 10                                  dd      @i286_wt,               @i286_wt                ; 10
Line 856  _memory_write dd @i286_wt,  @i286_wt  ;  Line 848  _memory_write dd @i286_wt,  @i286_wt  ; 
                                 dd      @vram_w0,               @i286_wn                ; e0                                  dd      @vram_w0,               @i286_wn                ; e0
                                 dd      @i286_wn,               @i286_wn                ; f0                                  dd      @i286_wn,               @i286_wn                ; f0
   
 _memory_read    dd      @i286_rd,               @i286_rd                ; 00  _memword_read   dd      @i286w_rd,              @i286w_rd               ; 00
                                 dd      @i286_rd,               @i286_rd                ; 10                                  dd      @i286w_rd,              @i286w_rd               ; 10
                                 dd      @i286_rd,               @i286_rd                ; 20                                  dd      @i286w_rd,              @i286w_rd               ; 20
                                 dd      @i286_rd,               @i286_rd                ; 30                                  dd      @i286w_rd,              @i286w_rd               ; 30
                                 dd      @i286_rd,               @i286_rd                ; 40                                  dd      @i286w_rd,              @i286w_rd               ; 40
                                 dd      @i286_rd,               @i286_rd                ; 50                                  dd      @i286w_rd,              @i286w_rd               ; 50
                                 dd      @i286_rd,               @i286_rd                ; 60                                  dd      @i286w_rd,              @i286w_rd               ; 60
                                 dd      @i286_rd,               @i286_rd                ; 70                                  dd      @i286w_rd,              @i286w_rd               ; 70
                                 dd      @i286_rd,               @i286_rd                ; 80                                  dd      @i286w_rd,              @i286w_rd               ; 80
                                 dd      @i286_rd,               @i286_rd                ; 90                                  dd      @i286w_rd,              @i286w_rd               ; 90
                                 dd      @tram_rd,               @vram_r0                ; a0                                  dd      @tramw_rd,              @vramw_r0               ; a0
                                 dd      @vram_r0,               @vram_r0                ; b0                                  dd      @vramw_r0,              @vramw_r0               ; b0
                                 dd      @emmc_rd,               @emmc_rd                ; c0                                  dd      @emmcw_rd,              @emmcw_rd               ; c0
                                 dd      @i286_rd,               @i286_rd                ; d0                                  dd      @i286w_rd,              @i286w_rd               ; d0
                                 dd      @vram_r0,               @i286_rd                ; e0                                  dd      @vramw_r0,              @i286w_rd               ; e0
                                 dd      @i286_rd,               @i286_itf               ; f0                                  dd      @i286w_rd,              @i286w_rb               ; f0
   
 _memword_write  dd      @i286w_wt,              @i286w_wt               ; 00  _memword_write  dd      @i286w_wt,              @i286w_wt               ; 00
                                 dd      @i286w_wt,              @i286w_wt               ; 10                                  dd      @i286w_wt,              @i286w_wt               ; 10
Line 890  _memword_write dd @i286w_wt,  @i286w_wt  Line 882  _memword_write dd @i286w_wt,  @i286w_wt 
                                 dd      @vramw_w0,              @i286_wn                ; e0                                  dd      @vramw_w0,              @i286_wn                ; e0
                                 dd      @i286_wn,               @i286_wn                ; f0                                  dd      @i286_wn,               @i286_wn                ; f0
   
 _memword_read   dd      @i286w_rd,              @i286w_rd               ; 00  section .rdata
                                 dd      @i286w_rd,              @i286w_rd               ; 10  
                                 dd      @i286w_rd,              @i286w_rd               ; 20  
                                 dd      @i286w_rd,              @i286w_rd               ; 30  
                                 dd      @i286w_rd,              @i286w_rd               ; 40  
                                 dd      @i286w_rd,              @i286w_rd               ; 50  
                                 dd      @i286w_rd,              @i286w_rd               ; 60  
                                 dd      @i286w_rd,              @i286w_rd               ; 70  
                                 dd      @i286w_rd,              @i286w_rd               ; 80  
                                 dd      @i286w_rd,              @i286w_rd               ; 90  
                                 dd      @tramw_rd,              @vramw_r0               ; a0  
                                 dd      @vramw_r0,              @vramw_r0               ; b0  
                                 dd      @emmcw_rd,              @emmcw_rd               ; c0  
                                 dd      @i286w_rd,              @i286w_rd               ; d0  
                                 dd      @vramw_r0,              @i286w_rd               ; e0  
                                 dd      @i286w_rd,              @i286w_itf              ; f0  
   
 _vram_write             dd      @vram_w0,               @vram_w1                ; 00  memmap                  dd      @i286_rd,               @i286_rb                ; NEC
                                 dd      @vram_w0,               @vram_w1                                  dd      @i286_wn,               @i286_wn
                                 dd      @vram_w0,               @vram_w1                ; 40                                  dd      @i286w_rd,              @i286w_rb
                                 dd      @vram_w0,               @vram_w1                                  dd      @i286_wn,               @i286_wn
                                 dd      @grcg_tdw0,             @grcg_tdw1              ; 80 tdw/tcr  
                                 dd      @egc_wt,                @egc_wt  
                                 dd      @grcg_rmw0,             @grcg_rmw1              ; c0 rmw  
                                 dd      @egc_wt,                @egc_wt  
   
 _vram_read              dd      @vram_r0,               @vram_r1                ; 00                                  dd      @i286_rb,               @i286_rb                ; EPSON
                                   dd      @i286_wt,               @i286_wb
                                   dd      @i286w_rb,              @i286w_rb
                                   dd      @i286w_wt,              @i286w_wb
   
   
   vram_read               dd      @vram_r0,               @vram_r1                ; 00
                                 dd      @vram_r0,               @vram_r1                                  dd      @vram_r0,               @vram_r1
                                 dd      @vram_r0,               @vram_r1                ; 40                                  dd      @vram_r0,               @vram_r1                ; 40
                                 dd      @vram_r0,               @vram_r1                                  dd      @vram_r0,               @vram_r1
Line 925  _vram_read  dd @vram_r0,  @vram_r1  ; 00 Line 904  _vram_read  dd @vram_r0,  @vram_r1  ; 00
                                 dd      @vram_r0,               @vram_r1                ; c0 rmw                                  dd      @vram_r0,               @vram_r1                ; c0 rmw
                                 dd      @egc_rd,                @egc_rd                                  dd      @egc_rd,                @egc_rd
   
 _vramw_write    dd      @vramw_w0,              @vramw_w1               ; 00  vram_write              dd      @vram_w0,               @vram_w1                ; 00
                                 dd      @vramw_w0,              @vramw_w1                                  dd      @vram_w0,               @vram_w1
                                 dd      @vramw_w0,              @vramw_w1               ; 40                                  dd      @vram_w0,               @vram_w1                ; 40
                                 dd      @vramw_w0,              @vramw_w1                                  dd      @vram_w0,               @vram_w1
                                 dd      @grcgw_tdw0,    @grcgw_tdw1             ; 80 tdw/tcr                                  dd      @grcg_tdw0,             @grcg_tdw1              ; 80 tdw/tcr
                                 dd      @egcw_wt,               @egcw_wt                                  dd      @egc_wt,                @egc_wt
                                 dd      @grcgw_rmw0,    @grcgw_rmw1             ; c0 rmw                                  dd      @grcg_rmw0,             @grcg_rmw1              ; c0 rmw
                                 dd      @egcw_wt,               @egcw_wt                                  dd      @egc_wt,                @egc_wt
   
 _vramw_read             dd      @vramw_r0,              @vramw_r1               ; 00  vramw_read              dd      @vramw_r0,              @vramw_r1               ; 00
                                 dd      @vramw_r0,              @vramw_r1                                  dd      @vramw_r0,              @vramw_r1
                                 dd      @vramw_r0,              @vramw_r1               ; 40                                  dd      @vramw_r0,              @vramw_r1               ; 40
                                 dd      @vramw_r0,              @vramw_r1                                  dd      @vramw_r0,              @vramw_r1
Line 943  _vramw_read  dd @vramw_r0,  @vramw_r1  ; Line 922  _vramw_read  dd @vramw_r0,  @vramw_r1  ;
                                 dd      @vramw_r0,              @vramw_r1               ; c0 rmw                                  dd      @vramw_r0,              @vramw_r1               ; c0 rmw
                                 dd      @egcw_rd,               @egcw_rd                                  dd      @egcw_rd,               @egcw_rd
   
   vramw_write             dd      @vramw_w0,              @vramw_w1               ; 00
                                   dd      @vramw_w0,              @vramw_w1
                                   dd      @vramw_w0,              @vramw_w1               ; 40
                                   dd      @vramw_w0,              @vramw_w1
                                   dd      @grcgw_tdw0,    @grcgw_tdw1             ; 80 tdw/tcr
                                   dd      @egcw_wt,               @egcw_wt
                                   dd      @grcgw_rmw0,    @grcgw_rmw1             ; c0 rmw
                                   dd      @egcw_wt,               @egcw_wt
   
   
   
 section .text  section .text
   
           global  @i286_memorymap@4
         global  @i286_vram_dispatch@4          global  @i286_vram_dispatch@4
   
         global  @i286_memorywrite@8          global  @i286_memorywrite@8
Line 971  section .text Line 961  section .text
                                         align   16                                          align   16
 writeextmem_w:  writeextmem_w:
 %if USE_HIMEM  %if USE_HIMEM
                                         cmp             ecx, 10ffefh                            ; HIMEM                                          cmp             ecx, (USE_HIMEM - 1)
                                         jae             near writehimem_w                                          jae             near writehimem_w
 %endif  %endif
                                         push    ebx                                          push    ebx
Line 1009  writemain_b:  mov  [MAINMEMORY + ecx], d Line 999  writemain_b:  mov  [MAINMEMORY + ecx], d
                                         align   16                                          align   16
 writeextmem_b:  writeextmem_b:
 %if USE_HIMEM  %if USE_HIMEM
                                         cmp             ecx, 10fff0h                            ; HIMEM                                          cmp             ecx, USE_HIMEM
                                         jae             near writehimem                                          jae             near writehimem
 %endif  %endif
                                         push    ebx                                          push    ebx
Line 1026  writeextmem_b: Line 1016  writeextmem_b:
                                         align   16                                          align   16
 readmemory_w:  readmemory_w:
 %if USE_HIMEM  %if USE_HIMEM
                                         cmp             ecx, 10ffefh                            ; HIMEM                                          cmp             ecx, (USE_HIMEM - 1)
                                         jae             near readhimem_w                                          jae             near readhimem_w
 %endif  %endif
                                         push    ebx                                          push    ebx
Line 1061  readmain_b:   mov  al, [MAINMEMORY + ecx Line 1051  readmain_b:   mov  al, [MAINMEMORY + ecx
                                         align   16                                          align   16
 readmemory_b:  readmemory_b:
 %if USE_HIMEM  %if USE_HIMEM
                                         cmp             ecx, 10fff0h                            ; HIMEM                                          cmp             ecx, USE_HIMEM
                                         jae             near readhimem                                          jae             near readhimem
 %endif  %endif
                                         push    ebx                                          push    ebx
Line 1084  readmemory_b: Line 1074  readmemory_b:
                                         mov             ax, 0ffffh                                          mov             ax, 0ffffh
                                         ret                                          ret
   
   
                                           align   16
   @i286_memorymap@4:      and             ecx, 1
                                           shl             ecx, 5
                                           lea             ecx, [memmap + ecx]
                                           mov             edx, _memory_read
                                           mov             eax, [ecx]
                                           mov             [edx + 74h], eax
                                           mov             [edx + 78h], eax
                                           mov             eax, [ecx+4]
                                           mov             [edx + 7ch], eax
                                           mov             eax, [ecx+8]
                                           mov             edx, _memory_write
                                           mov             [edx + 68h], eax
                                           mov             [edx + 6ch], eax
                                           mov             eax, [ecx+12]
                                           mov             [edx + 74h], eax
                                           mov             [edx + 78h], eax
                                           mov             [edx + 7ch], eax
                                           mov             eax, [ecx+16]
                                           mov             edx, _memword_read
                                           mov             [edx + 74h], eax
                                           mov             [edx + 78h], eax
                                           mov             eax, [ecx+20]
                                           mov             [edx + 7ch], eax
                                           mov             eax, [ecx+24]
                                           mov             edx, _memword_write
                                           mov             [edx + 68h], eax
                                           mov             [edx + 6ch], eax
                                           mov             eax, [ecx+28]
                                           mov             [edx + 74h], eax
                                           mov             [edx + 78h], eax
                                           mov             [edx + 7ch], eax
                                           ret
   
                                         align   16                                          align   16
 @i286_vram_dispatch@4:  @i286_vram_dispatch@4:
                                         mov             edx, ecx                                          mov             edx, ecx
                                         and             edx, byte 15                                          and             edx, byte 15
                                         mov             eax, [_vram_write + edx*4]                                          mov             eax, [vram_read + edx*4]
                                         mov             [_memory_write + 54h], eax              ; VRAM_B  
                                         mov             [_memory_write + 58h], eax              ; VRAM_R  
                                         mov             [_memory_write + 5ch], eax              ; VRAM_G  
                                         mov             [_memory_write + 70h], eax              ; VRAM_E  
                                         mov             eax, [_vram_read + edx*4]  
                                         mov             [_memory_read + 54h], eax               ; VRAM_B                                          mov             [_memory_read + 54h], eax               ; VRAM_B
                                         mov             [_memory_read + 58h], eax               ; VRAM_R                                          mov             [_memory_read + 58h], eax               ; VRAM_R
                                         mov             [_memory_read + 5ch], eax               ; VRAM_G                                          mov             [_memory_read + 5ch], eax               ; VRAM_G
                                         mov             [_memory_read + 70h], eax               ; VRAM_E                                          mov             [_memory_read + 70h], eax               ; VRAM_E
                                         mov             eax, [_vramw_write + edx*4]                                          mov             eax, [vram_write + edx*4]
                                         mov             [_memword_write + 54h], eax             ; VRAM_B                                          mov             [_memory_write + 54h], eax              ; VRAM_B
                                         mov             [_memword_write + 58h], eax             ; VRAM_R                                          mov             [_memory_write + 58h], eax              ; VRAM_R
                                         mov             [_memword_write + 5ch], eax             ; VRAM_G                                          mov             [_memory_write + 5ch], eax              ; VRAM_G
                                         mov             [_memword_write + 70h], eax             ; VRAM_E                                          mov             [_memory_write + 70h], eax              ; VRAM_E
                                         mov             eax, [_vramw_read + edx*4]                                          mov             eax, [vramw_read + edx*4]
                                         mov             [_memword_read + 54h], eax              ; VRAM_B                                          mov             [_memword_read + 54h], eax              ; VRAM_B
                                         mov             [_memword_read + 58h], eax              ; VRAM_R                                          mov             [_memword_read + 58h], eax              ; VRAM_R
                                         mov             [_memword_read + 5ch], eax              ; VRAM_G                                          mov             [_memword_read + 5ch], eax              ; VRAM_G
                                         mov             [_memword_read + 70h], eax              ; VRAM_E                                          mov             [_memword_read + 70h], eax              ; VRAM_E
                                           mov             eax, [vramw_write + edx*4]
                                           mov             [_memword_write + 54h], eax             ; VRAM_B
                                           mov             [_memword_write + 58h], eax             ; VRAM_R
                                           mov             [_memword_write + 5ch], eax             ; VRAM_G
                                           mov             [_memword_write + 70h], eax             ; VRAM_E
                                         test    ecx, 10h                                          test    ecx, 10h
                                         jne             short degtaldispatch_e                                          jne             short degtaldispatch_e
                                         mov             eax, @i286_nonram_w@8                                          mov             eax, @i286_nonram_w@8

Removed from v.1.2  
changed lines
  Added in v.1.15


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