⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mode716.mac

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 MAC
📖 第 1 页 / 共 3 页
字号:
    shl ebx,5
    shr eax,3
    and ebx,07FF8h
    shl al,1
    mov bl,al
    mov edi,[vram]
    xor ch,ch
    mov [mmode7ptr],ebx
    mov cl,[edi+ebx]
    shl ecx,7
    add edi,ecx

    jmp %%nextvalr
    ALIGN16
%%nodr2
    add esi,%3
    dec dword[ngwleftb]
    jz near %%fin2
%%nextvalr
    test byte[mode7xrpos+1],0F8h
    jnz near %%rposoffxr
%%nextposxr
    test byte[mode7yrpos+1],0F8h
    jnz near %%rposoffyr
%%nextposyr
    mov cl,[mode7yrpos+1]
    mov ch,[mode7xrpos+1]
    mov edx,[mode7xadder]
    add dword[mode7xrpos],edx
    mov edx,[mode7yadder]
    sub dword[mode7yrpos],edx
    xor edx,edx
    mov dl,[mode7tab+ecx]
    mov dl,[edi+edx]
    %1
    dec dword[ngwleftb]
    jnz near %%nextvalr
%%fin2

    cmp dword[ngwleft],0
    je %%notskipvalues4
    call ProcessMode7ngwinB16b
    cmp byte[switchtorep3],0
    jne near %%tilerep3
    cmp dword[ngwleftb],0
    jne near %%nextvalr
%%notskipvalues4

    jmp %%finishmode7
%%rposoffxr
    mov al,[mmode7xinc]
    mov edi,[vram]
    add [mmode7ptr],al
    mov cl,byte[mmode7xincc]
    cmp byte[mmode7ptr],cl
    je %%roff
%%roffxretb
    mov ebx,[mmode7ptr]
    xor ecx,ecx
    mov cl,[edi+ebx]
    mov eax,[mmode7xadd2]
    shl ecx,7
    sub [mode7xrpos],eax
    add edi,ecx
    jmp %%nextvalr
%%rposoffyr
    mov al,[mmode7yinc]
    mov edi,[vram]
    sub [mmode7ptr+1],al
    js %%roff
%%roffyretb
    mov ebx,[mmode7ptr]
    xor ecx,ecx
    mov cl,[edi+ebx]
    mov eax,[mmode7yadd2]
    shl ecx,7
    add [mode7yrpos],eax
    add edi,ecx
    jmp %%nextposxr
%%roff
    test byte[mode7set],40h
    jnz %%tilerep3
    jmp %%finishmode7
%%tilerep3
    and byte[mode7yrpos+1],07h
    and byte[mode7xrpos+1],07h
    mov cl,[mode7yrpos+1]
    mov eax,[mode7xadder]
    mov ch,[mode7xrpos+1]
    add [mode7xrpos],eax
    mov dl,[mode7tab+ecx]
    mov eax,[mode7yadder]
    mov dl,[vrama+edx]
    sub [mode7yrpos],eax
    %1
    dec dword[ngwleftb]
    jnz near %%tilerep3

    mov [mode7xrpos],eax
    cmp dword[ngwleft],0
    je %%notskipvalues5
    call ProcessMode7ngwinB16b
    cmp dword[ngwleftb],0
    jne near %%tilerep3
%%notskipvalues5

    jmp %%finishmode7
%endmacro

%macro Mode7Processngw216b 4
    mov eax,[ngcwinptr]
    mov eax,[eax]
    mov [ngwleft],eax

    mov dword[mtemp],256
    test byte[mode7set],80h
    jnz near %%norep2start

    mov eax,[mmode7xpos]
    and eax,7FFh
    mov [mmode7xrpos],eax
    mov eax,[mmode7ypos]
    and eax,7FFh
    mov [mmode7yrpos],eax

    ; get tile data offset into edi
    mov ebx,[mmode7ypos+1]
    mov eax,[mmode7xpos+1]
    shl ebx,5
    shr eax,3
    and ebx,07FF8h
    shl al,1
    mov bl,al
    mov edi,[vram]
    xor ch,ch
    mov [mmode7ptr],ebx
    mov cl,[edi+ebx]
    shl ecx,7
    add edi,ecx

    mov eax,[mmode7xrpos]
    mov ebx,[mmode7ptr]

    cmp dword[ngwleft],0
    jne %%nextvalwb
    jmp %%nextvalwc
%%nextvalw
    add dword[ngcwinptr],4
    mov edx,[ngcwinptr]
    mov edx,[edx]
    mov dword[ngwleft],edx
    xor edx,edx
%%nextvalwb

    test ah,08h
    jnz near %%rposoffxw
%%nextposxw
    test byte[mmode7yrpos+1],08h
    jnz near %%rposoffyw
%%nextposyw
    mov ch,ah
    mov cl,byte[mmode7yrpos+1]
    mov edx,[mmode7yadder]
    sub dword[mmode7yrpos],edx
    xor edx,edx
    mov dl,[mode7tab+ecx]
    add eax,[mmode7xadder]
    mov dl,[edi+edx]
    %1
    dec dword[mtemp]
    jz near %%finishmode7
    dec dword[ngwleft]
    jnz near %%nextvalwb
    jmp %%nextvalwc

%%rposoffxw
    add bl,[mmode7xinc]
    xor ecx,ecx
    mov cl,[vrama+ebx]
    shl ecx,7
    sub eax,[mmode7xadd2]
    lea edi,[ecx+vrama]
    jmp %%nextposxw
%%rposoffyw
    sub bh,[mmode7yinc]
    and ebx,07FFFh
    xor ecx,ecx
    mov cl,[vrama+ebx]
    mov edx,[mmode7yadd2]
    shl ecx,7
    add dword[mmode7yrpos],edx
    lea edi,[ecx+vrama]
    jmp %%nextposyw

%%nextvalwc
    add dword[ngcwinptr],4
    mov edx,[ngcwinptr]
    mov edx,[edx]
    mov dword[ngwleft],edx
    xor edx,edx
%%nextval
    test ah,08h
    jnz near %%rposoffx
%%nextposx
    test byte[mmode7yrpos+1],08h
    jnz near %%rposoffy
%%nextposy
    mov ch,ah
    mov cl,byte[mmode7yrpos+1]
    mov edx,[mmode7yadder]
    sub dword[mmode7yrpos],edx
    xor edx,edx
    mov dl,[mode7tab+ecx]
    add eax,[mmode7xadder]
    mov dl,[edi+edx]
    %4
    dec dword[mtemp]
    jz near %%finishmode7
    dec dword[ngwleft]
    jnz near %%nextval
    jmp %%nextvalw
%%rposoffx
    add bl,[mmode7xinc]
    xor ecx,ecx
    mov cl,[vrama+ebx]
    shl ecx,7
    sub eax,[mmode7xadd2]
    lea edi,[ecx+vrama]
    jmp %%nextposx
%%rposoffy
    sub bh,[mmode7yinc]
    and ebx,07FFFh
    xor ecx,ecx
    mov cl,[vrama+ebx]
    mov edx,[mmode7yadd2]
    shl ecx,7
    add dword[mmode7yrpos],edx
    lea edi,[ecx+vrama]
    jmp %%nextposy
%%finishmode7
    xor eax,eax
    mov dh,byte[curmosaicsz]
    cmp dh,1
    jne near %2
    ret

; *******************************************

%%norep2start
    cmp dword[ngwleft],0
    jne %%firstsetwb
    jmp %%firstsetww
%%firstsetw
    add dword[ngcwinptr],4
    mov edx,[ngcwinptr]
    mov edx,[edx]
    mov dword[ngwleft],edx
    xor edx,edx
%%firstsetwb
%%norep2
    test byte[mode7set],40h
    jnz %%tilerep2
%%nextvalb2
    cmp byte[mmode7ypos+2],3
    ja %%offscr2
    cmp byte[mmode7xpos+2],3
    jbe near %%offscr3
%%offscr2
    mov eax,[mmode7xadder]
    mov ebx,[mmode7yadder]
    add [mmode7xpos],eax
    sub [mmode7ypos],ebx
    add esi,%3
    dec dword[mtemp]
    jz near %%finishmode7
    dec dword[ngwleft]
    jnz near %%nextvalb2
    jmp %%firstsetww
%%tilerep2
%%nextvalb3
    cmp byte[mmode7ypos+2],3
    ja %%offscr2b
    cmp byte[mmode7xpos+2],3
    jbe near %%offscr3
%%offscr2b
    mov ch,[mmode7xpos+1]
    mov eax,[mmode7xadder]
    mov cl,[mmode7ypos+1]
    mov ebx,[mmode7yadder]
    mov dl,[mode7tab+ecx]
    add [mmode7xpos],eax
    mov dl,[vrama+edx]
    sub [mmode7ypos],ebx
    %1
    dec dword[mtemp]
    jz near %%finishmode7
    dec dword[ngwleft]
    jnz near %%nextvalb3
    jmp %%firstsetw

%%offscr3
    mov eax,[mmode7xpos]
    and eax,7FFh
    mov [mmode7xrpos],eax
    mov eax,[mmode7ypos]
    and eax,7FFh
    mov [mmode7yrpos],eax
    ; get tile data offset into edi
    mov ebx,[mmode7ypos+1]
    mov eax,[mmode7xpos+1]
    shl ebx,5
    shr eax,3
    and ebx,07FF8h
    shl al,1
    mov bl,al
    mov edi,[vram]
    xor ch,ch
    mov [mmode7ptr],ebx
    mov cl,[edi+ebx]
    shl ecx,7
    add edi,ecx
    jmp %%nextvalr
%%nodr2
    add esi,%3

    dec dword[mtemp]
    jz near %%finishmode7
    dec dword[ngwleft]
    jnz %%nextvalr
%%secondsetw
    add dword[ngcwinptr],4
    mov edx,[ngcwinptr]
    mov edx,[edx]
    mov dword[ngwleft],edx
    xor edx,edx
%%nextvalr
    test byte[mmode7xrpos+1],08h
    jnz near %%rposoffxr
%%nextposxr
    test byte[mmode7yrpos+1],08h
    jnz near %%rposoffyr
%%nextposyr
    mov cl,[mmode7yrpos+1]
    mov ch,[mmode7xrpos+1]
    mov edx,[mmode7xadder]
    add dword[mmode7xrpos],edx
    mov edx,[mmode7yadder]
    sub dword[mmode7yrpos],edx
    xor edx,edx
    mov dl,[mode7tab+ecx]
    mov dl,[edi+edx]
    %1
    dec dword[mtemp]
    jz near %%finishmode7
    dec dword[ngwleft]
    jnz near %%nextvalr
    jmp %%secondsetww
%%rposoffxr
    mov al,[mmode7xinc]
    mov edi,[vram]
    add [mmode7ptr],al
    mov cl,byte[mmode7xincc]
    cmp byte[mmode7ptr],cl
    je %%roff
%%roffxretb
    mov ebx,[mmode7ptr]
    xor ecx,ecx
    mov cl,[edi+ebx]
    mov eax,[mmode7xadd2]
    shl ecx,7
    sub [mmode7xrpos],eax
    add edi,ecx
    jmp %%nextposxr
%%rposoffyr
    mov al,[mmode7yinc]
    mov edi,[vram]
    sub [mmode7ptr+1],al
    js %%roff
%%roffyretb
    mov ebx,[mmode7ptr]
    xor ecx,ecx
    mov cl,[edi+ebx]
    mov eax,[mmode7yadd2]
    shl ecx,7
    add [mmode7yrpos],eax
    add edi,ecx
    jmp %%nextposyr

%%roff
    test byte[mode7set],40h
    jnz %%tilerep3
    jmp %%finishmode7
%%thirdsetw
    add dword[ngcwinptr],4
    mov edx,[ngcwinptr]
    mov edx,[edx]
    mov dword[ngwleft],edx
    xor edx,edx
%%tilerep3
    and byte[mmode7yrpos+1],07h
    and byte[mmode7xrpos+1],07h
    mov cl,[mmode7yrpos+1]
    mov eax,[mmode7xadder]
    mov ch,[mmode7xrpos+1]
    add [mmode7xrpos],eax
    mov dl,[mode7tab+ecx]
    mov eax,[mmode7yadder]
    mov dl,[vrama+edx]
    sub [mmode7yrpos],eax
    %1
    dec dword[mtemp]
    jz near %%finishmode7
    dec dword[ngwleft]
    jnz near %%tilerep3
    jmp %%thirdsetww

; *************************************
%%firstsetww
    add dword[ngcwinptr],4
    mov edx,[ngcwinptr]
    mov edx,[edx]
    mov dword[ngwleft],edx
    xor edx,edx
%%norep2w
    test byte[mode7set],40h
    jnz %%tilerep2w
%%nextvalb2w
    cmp byte[mmode7ypos+2],3
    ja %%offscr2w
    cmp byte[mmode7xpos+2],3
    jbe near %%offscr3w
%%offscr2w
    mov eax,[mmode7xadder]
    mov ebx,[mmode7yadder]
    add [mmode7xpos],eax
    sub [mmode7ypos],ebx
    add esi,%3
    dec dword[mtemp]
    jz near %%finishmode7
    dec dword[ngwleft]
    jnz near %%nextvalb2w
    jmp %%firstsetw
%%tilerep2w
%%nextvalb3w
    cmp byte[mmode7ypos+2],3
    ja %%offscr2bw
    cmp byte[mmode7xpos+2],3
    jbe near %%offscr3w
%%offscr2bw
    mov ch,[mmode7xpos+1]
    mov eax,[mmode7xadder]
    mov cl,[mmode7ypos+1]
    mov ebx,[mmode7yadder]
    mov dl,[mode7tab+ecx]
    add [mmode7xpos],eax
    mov dl,[vrama+edx]
    sub [mmode7ypos],ebx
    %4
    dec dword[mtemp]
    jz near %%finishmode7
    dec dword[ngwleft]
    jnz near %%nextvalb3w
    jmp %%firstsetw

%%offscr3w
    mov eax,[mmode7xpos]
    and eax,7FFh
    mov [mmode7xrpos],eax
    mov eax,[mmode7ypos]
    and eax,7FFh
    mov [mmode7yrpos],eax
    ; get tile data offset into edi
    mov ebx,[mmode7ypos+1]
    mov eax,[mmode7xpos+1]
    shl ebx,5
    shr eax,3
    and ebx,07FF8h
    shl al,1
    mov bl,al
    mov edi,[vram]
    xor ch,ch
    mov [mmode7ptr],ebx
    mov cl,[edi+ebx]
    shl ecx,7
    add edi,ecx
    jmp %%nextvalrw
%%nodr2w
    add esi,%3

    dec dword[mtemp]
    jz near %%finishmode7
    dec dword[ngwleft]
    jnz %%nextvalrw
%%secondsetww
    add dword[ngcwinptr],4
    mov edx,[ngcwinptr]
    mov edx,[edx]
    mov dword[ngwleft],edx
    xor edx,edx
%%nextvalrw
    test byte[mmode7xrpos+1],08h
    jnz near %%rposoffxrw
%%nextposxrw
    test byte[mmode7yrpos+1],08h
    jnz near %%rposoffyrw
%%nextposyrw
    mov cl,[mmode7yrpos+1]
    mov ch,[mmode7xrpos+1]
    mov edx,[mmode7xadder]
    add dword[mmode7xrpos],edx
    mov edx,[mmode7yadder]
    sub dword[mmode7yrpos],edx
    xor edx,edx
    mov dl,[mode7tab+ecx]
    mov dl,[edi+edx]
    %4
    dec dword[mtemp]
    jz near %%finishmode7
    dec dword[ngwleft]
    jnz near %%nextvalrw
    jmp %%secondsetw
%%rposoffxrw
    mov al,[mmode7xinc]
    mov edi,[vram]
    add [mmode7ptr],al
    mov cl,byte[mmode7xincc]
    cmp byte[mmode7ptr],cl
    je %%roffw
%%roffxretbw
    mov ebx,[mmode7ptr]
    xor ecx,ecx
    mov cl,[edi+ebx]
    mov eax,[mmode7xadd2]
    shl ecx,7
    sub [mmode7xrpos],eax
    add edi,ecx
    jmp %%nextposxrw
%%rposoffyrw
    mov al,[mmode7yinc]
    mov edi,[vram]
    sub [mmode7ptr+1],al
    js %%roffw
%%roffyretbw
    mov ebx,[mmode7ptr]
    xor ecx,ecx
    mov cl,[edi+ebx]
    mov eax,[mmode7yadd2]
    shl ecx,7
    add [mmode7yrpos],eax
    add edi,ecx
    jmp %%nextposyrw

%%roffw
    test byte[mode7set],40h
    jnz %%tilerep3w
    jmp %%finishmode7
%%thirdsetww
    add dword[ngcwinptr],4
    mov edx,[ngcwinptr]
    mov edx,[edx]
    mov dword[ngwleft],edx
    xor edx,edx
%%tilerep3w
    and byte[mmode7yrpos+1],07h
    and byte[mmode7xrpos+1],07h
    mov cl,[mmode7yrpos+1]
    mov eax,[mmode7xadder]
    mov ch,[mmode7xrpos+1]
    add [mmode7xrpos],eax
    mov dl,[mode7tab+ecx]
    mov eax,[mmode7yadder]
    mov dl,[vrama+edx]
    sub [mmode7yrpos],eax
    %4
    dec dword[mtemp]
    jz near %%finishmode7
    dec dword[ngwleft]
    jnz near %%tilerep3w
    jmp %%thirdsetw
%endmacro

; *********************************************************************

%macro Mode7NonMainSub 1
    WinEnCheck
    ProcessBuildWindow16b 0
.nohr
    Mode7NoTranspPreStartUp
    Mode7Startup
    Mode7Process %1, domosaicng16b, 2
.nextval3
    Mode7ProcessB %1, domosaicng16b, 2
    Mode7MidRoutines
    mov edi,[vram]
    Mode7Processngw16b %1, domosaicng16b, 2
%endmacro

%macro Mode7NonMainSube 1
    WinEnCheck
    ProcessBuildWindow16b 0
.nohr
    Mode7NoTranspPreStartUp2
    Mode7Startup
    Mode7Process %1, domosaicng16b, 2
.nextval3
    Mode7ProcessB %1, domosaicng16b, 2
    Mode7MidRoutines
    mov edi,[vram]
    Mode7Processngw16b %1, domosaicng16b, 2
%endmacro

%macro Mode7MainSub 2
    WinEnCheckMS
    ProcessBuildWindow16b 0
.nohr
    Mode7NoTranspPreStartUp
    call Mode7Startup16b
    Mode7MidRoutines
    mov edi,[vram]
    Mode7Processngw216b %1, domosaicng16b, 2, %2
%endmacro

%macro Mode7MainSube 2
    WinEnCheckMS
    ProcessBuildWindow16b 0
.nohr
    Mode7NoTranspPreStartUp2
    call Mode7Startup16b
    Mode7MidRoutines
    mov edi,[vram]
    Mode7Processngw216b %1, domosaicng16b, 2, %2
%endmacro

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -