--- np2/i286x/memory.x86 2004/01/31 08:34:41 1.11 +++ np2/i286x/memory.x86 2011/02/02 13:50:29 1.16 @@ -2,17 +2,17 @@ ; ; ToDo: egc word-boundary -%include 'x86/np2asm.inc' +%include 'np2asm.inc' +%include 'cpucore.inc' +%include 'iocore.inc' +%include 'vram.inc' section .bss global _mem extern _i286core - extern _grcg - extern _gdcs extern _tramupdate extern _vramupdate - extern _cgwindow extern _vramop _mem resb 0x200000 @@ -23,8 +23,8 @@ EXTMEMORY equ 0 VIDEOMEMORY equ _mem USERSMEMORY_R equ 0a8000h USERSMEMORY_W equ 0a0000h -_extmemmng_ptr equ _i286core + i286core_t.ext -_extmemmng_size equ _i286core + i286core_t.extsize +_extmemmng_ptr equ _i286core + cpucore_t.ext +_extmemmng_size equ _i286core + cpucore_t.extsize %if 1 _font equ _mem + FONT_ADRS @@ -87,16 +87,16 @@ section .text extern egc_write extern egc_write_w %else - extern @egc_read@4 - extern @egc_read_w@4 - extern @egc_write@8 - extern @egc_write_w@8 + extern @memegc_rd8@4 + extern @memegc_rd16@4 + extern @memegc_wr8@8 + extern @memegc_wr16@8 %endif ; normal memory align 16 @i286_wt: mov ebx, ecx - and ebx, [_i286core + i286core_t.adrsmask] + and ebx, [_i286core + cpucore_t.adrsmask] mov [MAINMEMORY + ebx], dl pop ebx ret @@ -104,7 +104,7 @@ section .text ; tram write align 16 @tram_wt: mov ebx, [_vramop + vramop_t.tramwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx mov ebx, ecx cmp ecx, 000a2000h jnc short wtram_a @@ -155,7 +155,7 @@ wcgwindow_e: pop ebx or byte [_vramupdate + ebx], 1 or byte [_gdcs + gdcs_t.grphdisp], 1 mov ebx, [_vramop + vramop_t.vramwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx pop ebx ret @@ -167,7 +167,7 @@ wcgwindow_e: pop ebx or byte [_vramupdate + ebx], 2 or byte [_gdcs + gdcs_t.grphdisp], 2 mov ebx, [_vramop + vramop_t.vramwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx pop ebx ret @@ -188,7 +188,7 @@ wcgwindow_e: pop ebx or byte [_gdcs + gdcs_t.grphdisp], 1 grcg_rmw: mov ebx, [_vramop + vramop_t.grcgwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx mov ebx, dword [_grcg + grcg_t.mode] mov bl, dl not bl @@ -237,7 +237,7 @@ grcgrmw_end: pop ecx or byte [_gdcs + gdcs_t.grphdisp], 1 grcg_tdw: mov ebx, [_vramop + vramop_t.grcgwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx mov bh, [_grcg + grcg_t.modereg] shr bh, 1 jc short grcgtdw_r @@ -262,12 +262,14 @@ grcgtdw_end: pop ecx ; EGC bridge align 16 @egc_wt: VRAMTRACE + mov ebx, [_vramop + vramop_t.grcgwait] + sub [_i286core + cpucore_t.remainclock], ebx pop ebx %if USE_EGCASM jmp egc_write %else pushad - call @egc_write@8 + call @memegc_wr8@8 popad ret %endif @@ -279,7 +281,7 @@ grcgtdw_end: pop ecx and ecx, 3fffh shr ebx, 12 and ebx, byte (3*4) - add ecx, [_i286core + i286core_t.ems + ebx] + add ecx, [_i286core + cpucore_t.ems + ebx] mov [EXTMEMORY + ecx], dl pop ecx pop ebx @@ -300,7 +302,7 @@ grcgtdw_end: pop ecx ; normal memory align 16 @i286_rd: mov ebx, ecx - and ebx, [_i286core + i286core_t.adrsmask] + and ebx, [_i286core + cpucore_t.adrsmask] mov al, [MAINMEMORY + ebx] pop ebx ret @@ -308,7 +310,7 @@ grcgtdw_end: pop ecx ; font cg-window align 16 @tram_rd: mov ebx, [_vramop + vramop_t.tramwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx cmp ecx, 0a4000h jnc rcgwindow_s rcgwindow_n: mov al, [MAINMEMORY + ecx] @@ -331,7 +333,7 @@ rcgwindow_s: cmp ecx, 0a5000h align 16 @vram_r0: mov al, [VIDEOMEMORY + ecx] mov ebx, [_vramop + vramop_t.vramwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx pop ebx ret @@ -339,7 +341,7 @@ rcgwindow_s: cmp ecx, 0a5000h align 16 @vram_r1: mov al, [VIDEOMEMORY + VRAM_STEP + ecx] mov ebx, [_vramop + vramop_t.vramwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx pop ebx ret @@ -354,7 +356,7 @@ rcgwindow_s: cmp ecx, 0a5000h and ecx, 7fffh grcg_tcr: mov ebx, [_vramop + vramop_t.grcgwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx mov al, 0 mov bh, [_grcg + grcg_t.modereg] shr bh, 1 @@ -383,12 +385,14 @@ grcgtcr_end: not al ; EGC bridge 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 jmp egc_read %else pushad - call @egc_read@4 + call @memegc_rd8@4 mov [esp + 28], al popad ret @@ -402,7 +406,7 @@ grcgtcr_end: not al and ecx, 3fffh shr ebx, 12 and ebx, byte (3*4) - add ecx, [_i286core + i286core_t.ems + ebx] + add ecx, [_i286core + cpucore_t.ems + ebx] mov al, [EXTMEMORY + ecx] pop ecx pop ebx @@ -411,7 +415,7 @@ grcgtcr_end: not al ; BIOS or ITF align 16 @i286_rb: pop ebx - cmp byte [_i286core + i286core_t.itfbank], 0 + cmp byte [_i286core + cpucore_t.itfbank], 0 jne readmem_itf mov al, [MAINMEMORY + ecx] ret @@ -423,7 +427,7 @@ readmem_itf: mov al, [MAINMEMORY + VRA ; normal memory align 16 @i286w_wt: mov ebx, ecx - and ebx, [_i286core + i286core_t.adrsmask] + and ebx, [_i286core + cpucore_t.adrsmask] mov [MAINMEMORY + ebx], dx pop ebx ret @@ -431,7 +435,7 @@ readmem_itf: mov al, [MAINMEMORY + VRA ; tram write align 16 @tramw_wt: mov ebx, [_vramop + vramop_t.tramwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx mov ebx, ecx cmp ecx, 000a1fffh jnc short wtramw_a @@ -508,7 +512,7 @@ wcgwinw_odd: add ebx, dword [_cgwindow or word [_vramupdate + ebx], 0101h or byte [_gdcs + gdcs_t.grphdisp], 1 mov ebx, [_vramop + vramop_t.vramwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx pop ebx ret @@ -520,7 +524,7 @@ wcgwinw_odd: add ebx, dword [_cgwindow or word [_vramupdate + ebx], 0202h or byte [_gdcs + gdcs_t.grphdisp], 2 mov ebx, [_vramop + vramop_t.vramwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx pop ebx ret @@ -541,7 +545,7 @@ wcgwinw_odd: add ebx, dword [_cgwindow or byte [_gdcs + gdcs_t.grphdisp], 1 grcgw_rmw: mov ebx, [_vramop + vramop_t.grcgwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx push eax mov ebx, dword [_grcg + grcg_t.mode] mov bx, dx @@ -592,7 +596,7 @@ grcgwrmw_end: pop eax or byte [_gdcs + gdcs_t.grphdisp], 1 grcgw_tdw: mov ebx, [_vramop + vramop_t.grcgwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx mov ebx, [_grcg + grcg_t.mode] test ebx, 010000h jne short grcgwtdw_r @@ -617,26 +621,14 @@ grcgwtdw_end: pop ecx ; EGC bridge align 16 @egcw_wt: VRAMTRACE_W + mov ebx, [_vramop + vramop_t.grcgwait] + sub [_i286core + cpucore_t.remainclock], ebx pop ebx %if USE_EGCASM jmp egc_write_w %else - test ecx, 1 - jne short egcw_wtodd pushad - call @egc_write_w@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 + call @memegc_wr16@8 popad ret %endif @@ -648,7 +640,7 @@ egcw_wtodd: and ecx, 3fffh shr ebx, 12 and ebx, byte (3*4) - add ecx, [_i286core + i286core_t.ems + ebx] + add ecx, [_i286core + cpucore_t.ems + ebx] mov [EXTMEMORY + ecx], dx pop ecx pop ebx @@ -663,7 +655,7 @@ egcw_wtodd: ; normal memory align 16 @i286w_rd: mov ebx, ecx - and ebx, [_i286core + i286core_t.adrsmask] + and ebx, [_i286core + cpucore_t.adrsmask] mov ax, [MAINMEMORY + ebx] pop ebx ret @@ -671,7 +663,7 @@ egcw_wtodd: ; font cg-window align 16 @tramw_rd: mov ebx, [_vramop + vramop_t.tramwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx cmp ecx, 0a3fffh jnc rcgwwindow_s mov ax, [MAINMEMORY + ecx] @@ -725,7 +717,7 @@ rcgwwindow_a4fff: mov ebx, dword [_cgwi align 16 @vramw_r0: mov ax, [VIDEOMEMORY + ecx] mov ebx, [_vramop + vramop_t.vramwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx pop ebx ret @@ -733,7 +725,7 @@ rcgwwindow_a4fff: mov ebx, dword [_cgwi align 16 @vramw_r1: mov ax, [VIDEOMEMORY + VRAM_STEP + ecx] mov ebx, [_vramop + vramop_t.vramwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx pop ebx ret @@ -748,7 +740,7 @@ rcgwwindow_a4fff: mov ebx, dword [_cgwi and ecx, 7fffh grcgw_tcr: mov ebx, [_vramop + vramop_t.grcgwait] - sub [_i286core + i286core_t.remainclock], ebx + sub [_i286core + cpucore_t.remainclock], ebx mov ax, 0 mov ebx, [_grcg + grcg_t.mode] test ebx, 010000h @@ -777,38 +769,19 @@ grcgwtcr_end: not ax ; EGC bridge align 16 -@egcw_rd: pop ebx - test ecx, 1 - jne short egcw_rdodd +@egcw_rd: mov ebx, [_vramop + vramop_t.grcgwait] + sub [_i286core + cpucore_t.remainclock], ebx + pop ebx %if USE_EGCASM jmp egc_read_w %else pushad - call @egc_read_w@4 + call @memegc_rd16@4 mov [esp + 28], ax popad ret %endif -egcw_rdodd: -%if USE_EGCASM - inc ecx - call egc_read - mov ah, al - dec ecx - jmp egc_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 align 16 @@ -817,7 +790,7 @@ egcw_rdodd: and ecx, 3fffh shr ebx, 12 and ebx, byte (3*4) - add ecx, [_i286core + i286core_t.ems + ebx] + add ecx, [_i286core + cpucore_t.ems + ebx] mov ax, [EXTMEMORY + ecx] pop ecx pop ebx @@ -826,7 +799,7 @@ egcw_rdodd: ; BIOS or ITF align 16 @i286w_rb: pop ebx - cmp byte [_i286core + i286core_t.itfbank], 0 + cmp byte [_i286core + cpucore_t.itfbank], 0 jne readwmem_itf mov ax, [MAINMEMORY + ecx] ret @@ -1370,5 +1343,3 @@ memxwrite_lp: mov dl, [esi] memxwrite_ed: pop ebx ret 4 - ends -