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

📄 m716text.asm

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 ASM
📖 第 1 页 / 共 2 页
字号:
.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
    add esi,2
    add ebp,2
    dec byte[.temp]
    jnz near .tilerep3
    jmp .finishmode7

;**********************************************************
; Mode 7, old routines
;**********************************************************

.nextval3
    test byte[mode7set],80h
    jnz near .norep
.nextval2
    ; get tile # @ ([.mode7xpos],[.mode7ypos])
    ; get tile location in vram (tileloc=x*2+y*256)
    mov ebx,[.mode7ypos+1]
    mov eax,[.mode7xpos+1]
    mov cl,bl
    mov ch,al
    shl ebx,5
    shr eax,3
    mov dl,[mode7tab+ecx]
    and ebx,07FF8h
    shl al,1
    mov bl,al
    xor ch,ch
    mov cl,[edi+ebx]
    mov eax,[.mode7xadder]
    shl ecx,7
    add [.mode7xpos],eax
    add ecx,edx
    mov eax,[.mode7yadder]
    mov dl,[edi+ecx]
    sub [.mode7ypos],eax
    %1
    add esi,2
    add ebp,2
    dec byte[.temp]
    jnz near .nextval2
    xor eax,eax
    mov dh,byte[curmosaicsz]
    cmp dh,1
    jne near domosaic16b
    ret
    ; Color repetition
.norep
    test byte[mode7set],40h
    jnz near .tilerep
.nextvalb
    ; get tile # @ ([.mode7xpos],[.mode7ypos])
    ; get tile location in vram (tileloc=x*2+y*256)
    cmp byte[.mode7ypos+2],3
    ja near .offscr
    cmp byte[.mode7xpos+2],3
    ja near .offscr
.offscrb
    mov ebx,[.mode7ypos+1]
    mov eax,[.mode7xpos+1]
    mov cl,bl
    mov ch,al
    shl ebx,5
    shr eax,3
    mov dl,[mode7tab+ecx]
    and ebx,07FF8h
    shl al,1
    mov bl,al
    xor ch,ch
    mov cl,[edi+ebx]
    mov eax,[.mode7xadder]
    shl ecx,7
    add [.mode7xpos],eax
    add ecx,edx
    mov eax,[.mode7yadder]
    mov dl,[edi+ecx]
    sub [.mode7ypos],eax
    %1
    add esi,2
    add ebp,2
    dec byte[.temp]
    jnz near .nextvalb
    jmp .goon
.offscrc
    cmp byte[.mode7ypos+2],3
    ja .offscr
    cmp byte[.mode7xpos+2],3
    jbe near .offscrb
.offscr
    mov eax,[.mode7xadder]
    mov ebx,[.mode7yadder]
    add [.mode7xpos],eax
    sub [.mode7ypos],ebx
    add esi,2
    add ebp,2
    dec byte[.temp]
    jnz .offscrc
.goon
    xor eax,eax
    mov dh,byte[curmosaicsz]
    cmp dh,1
    jne near domosaic16b
    ret

.tilerep
.nextvalbtr
    ; get tile # @ ([.mode7xpos],[.mode7ypos])
    ; get tile location in vram (tileloc=x*2+y*256)
    cmp byte[.mode7ypos+2],3
    ja near .offscrtr
    cmp byte[.mode7xpos+2],3
    ja near .offscrtr
.offscrtrb
    mov ebx,[.mode7ypos+1]
    mov eax,[.mode7xpos+1]
    mov cl,bl
    mov ch,al
    shl ebx,5
    shr eax,3
    mov dl,[mode7tab+ecx]
    and ebx,07FF8h
    shl al,1
    mov bl,al
    xor ch,ch
    mov cl,[edi+ebx]
    mov eax,[.mode7xadder]
    shl ecx,7
    add [.mode7xpos],eax
    add ecx,edx
    mov eax,[.mode7yadder]
    mov dl,[edi+ecx]
    sub [.mode7ypos],eax
    %1
    add esi,2
    add ebp,2
    dec byte[.temp]
    jnz near .nextvalbtr
    jmp .goon
.offscrtrc
    cmp byte[.mode7ypos+2],3
    ja .offscrtr
    cmp byte[.mode7xpos+2],3
    jbe near .offscrtrb
.offscrtr
    mov ch,[.mode7xpos+1]
    mov eax,[.mode7xadder]
    mov cl,[.mode7ypos+1]
    mov ebx,[.mode7yadder]
    mov dl,[mode7tab+ecx]
    add [.mode7xpos],eax
    mov dl,[vrama+edx]
    sub [.mode7ypos],ebx
    %1
    add esi,2
    add ebp,2
    dec byte[.temp]
    jnz near .offscrtrc
    jmp .goon

ALIGN32
.temp        dd 0       ; for byte move left
.mode7xpos   dd 0       ; x position
.tempa2      dd 0       ; keep this blank!
.mode7xrpos  dd 0       ; x position
.tempa       dd 0       ; keep this blank!
.mode7ypos   dd 0       ; y position
.tempb2      dd 0       ; keep this blank!
.mode7yrpos  dd 0       ; y position
.tempb       dd 0       ; keep this blank!
.mode7xadder dd 0       ; number to add for x
.tempc2      dd 0       ; keep this blank!
.mode7xadd2  dd 0       ; number to add for x
.tempc       dd 0       ; keep this blank!
.mode7yadder dd 0       ; number to add for y
.tempd2      dd 0       ; keep this blank!
.mode7yadd2  dd 0       ; number to add for y
.tempd       dd 0       ; keep this blank!
.mode7ptr    dd 0       ; pointer value
.mode7xinc   dd 0       ; number to add for x
.mode7yinc   dd 0       ; number to add for y
.mode7xsloc  dd 0       ; which screen x
.mode7ysloc  dd 0       ; which screen y
.mode7xsrl   dd 0       ; which relative screen x
.mode7ysrl   dd 0       ; which relative screen y
.cxloc       dd 0       ; cx location
.cyloc       dd 0       ; cy location
%endmacro

;*******************************************************
; Processes & Draws Mode 7 half Addition
;*******************************************************
NEWSYM drawmode716textbg
;    test byte[scaddset],1
;    jnz near drawmode7dcolor
    mov esi,[cwinptr]
    mov [winptrref],esi
    cmp byte[curmosaicsz],1
    jne .domosaic
    cmp byte[winon],0
    jne near drawmode716twinonextbg
.domosaic
    test byte[scaddtype],80h
    jnz near drawmode716tsubextbg
    test byte[scaddtype],40h
    jz near drawmode716tfulladdextbg
    cmp byte[scrnon+1],0
    je near drawmode716tfulladdextbg
    cmp dword[coladdr],0
    jnz near drawmode716tfulladdextbg
    mode716tmacro mode7halfadd


;*******************************************************
; Processes & Draws Mode 7 Full Addition
;*******************************************************
NEWSYM drawmode716tfulladdextbg
    mode716tmacro mode7fulladd

;**********************************************************
; Processes and draws Mode 7 subtract
;**********************************************************

drawmode716tsubextbg:
    mode716tmacro mode7fullsub

;**********************************************************
; Mode 7, main & sub mode
;**********************************************************

NEWSYM drawmode716tbextbg
    mode716tmacro mode7mainsub

;*******************************************************
; Processes & Draws Mode 7 half Addition, Window on
;*******************************************************
NEWSYM drawmode716twinonextbg
    test byte[scaddtype],80h
    jnz near drawmode716tsubwinonextbg
    test byte[scaddtype],40h
    jz near drawmode716tfulladdwinonextbg
    cmp byte[scrnon+1],0
    je near drawmode716tfulladdwinonextbg
    cmp dword[coladdr],0
    jnz near drawmode716tfulladdwinonextbg
    mode716tmacro mode7halfaddwinon


;*******************************************************
; Processes & Draws Mode 7 Full Addition, Window on
;*******************************************************

NEWSYM drawmode716tfulladdwinonextbg
    mode716tmacro mode7fulladdwinon

;**********************************************************
; Processes and draws Mode 7 subtract, Window on
;**********************************************************

NEWSYM drawmode716tsubwinonextbg
    mode716tmacro mode7fullsubwinon

;**********************************************************
; Mode 7, main & sub mode, Window on
;**********************************************************

NEWSYM drawmode716tbwinonextbg
    mode716tmacro mode7mainsubwinon


NEWSYM drawmode716textbg2
    mov esi,[cwinptr]
    mov [winptrref],esi

    ; esi = pointer to video buffer
    mov esi,[curvidoffset]       ; esi = [vidbuffer] + curypos * 288 + 16
    mov edi,[vram]
    cmp byte[curmosaicsz],1
    je .nomosaic
    mov esi,xtravbuf+32
    mov ecx,128
.clearnext
    mov dword[esi],0
    add esi,4
    dec ecx
    jnz .clearnext
    mov esi,xtravbuf+32
.nomosaic

    mov edi,transpbuf+32
    test byte[scaddtype],80h
    jnz near extbg2sub
    test byte[scaddtype],40h
    jz near extbg2add

    cmp byte[curmosaicsz],1
    jne .domosaic
    cmp byte[winon],0
    jne near .drawwin
.domosaic
    mov ecx,256
    xor eax,eax
.loop
    mov al,[esi+288*2]
    test al,80h
    jz .nopr2
    and al,7Fh
    mov edx,[edi]
    mov ebx,[pal16bcl+eax*4]
    cmp dx,0
    je .noadd
    and ebx,[vesa2_clbit]
    and edx,[vesa2_clbit]
    add ebx,edx
    shr ebx,1
.noadd
    mov [esi],bx
.nopr2
    add esi,2
    add edi,2
    loop .loop
    xor eax,eax
    mov dh,byte[curmosaicsz]
    cmp dh,1
    jne near domosaic16b
    ret
.drawwin
    mov ebp,[cwinptr]
    mov byte[esi],cl
.nodrawbw
    mov ecx,256
    xor eax,eax
.loop2
    mov al,[esi+288*2]
    test byte[ebp],0FFh
    jnz .nopr2b
    test al,80h
    jz .nopr2b
    and al,7Fh
    mov edx,[edi]
    mov ebx,[pal16bcl+eax*4]
    cmp dx,0
    je .noadd2
    and ebx,[vesa2_clbit]
    and edx,[vesa2_clbit]
    add ebx,edx
    shr ebx,1
.noadd2
    mov [esi],bx
.nopr2b
    add esi,2
    add edi,2
    inc ebp
    loop .loop2
    xor eax,eax
    mov dh,byte[curmosaicsz]
    cmp dh,1
    jne near domosaic16b
    ret

extbg2add:
    cmp byte[curmosaicsz],1
    jne .domosaic
    cmp byte[winon],0
    jne near .drawwin
.domosaic
    mov ecx,256
    xor eax,eax
.loop
    mov al,[esi+288*2]
    test al,80h
    jz .nopr2
    and al,7Fh
    mov edx,[edi]
    mov ebx,[pal16bcl+eax*4]
    and edx,[vesa2_clbit]
    add ebx,edx
    shr ebx,1
    mov ebx,[fulladdtab+ebx*2]
    mov [esi],bx
.nopr2
    add esi,2
    add edi,2
    loop .loop
    xor eax,eax
    mov dh,byte[curmosaicsz]
    cmp dh,1
    jne near domosaic16b
    ret
.drawwin
    mov ebp,[cwinptr]
    mov byte[esi],cl
.nodrawbw
    mov ecx,256
    xor eax,eax
.loop2
    mov al,[esi+288*2]
    test byte[ebp],0FFh
    jnz .nopr2b
    test al,80h
    jz .nopr2b
    and al,7Fh
    mov edx,[edi]
    mov ebx,[pal16bcl+eax*4]
    and edx,[vesa2_clbit]
    add ebx,edx
    shr ebx,1
    mov ebx,[fulladdtab+ebx*2]
    mov [esi],bx
.nopr2b
    add esi,2
    add edi,2
    inc ebp
    loop .loop2
    xor eax,eax
    mov dh,byte[curmosaicsz]
    cmp dh,1
    jne near domosaic16b
    ret

extbg2sub:
    cmp byte[curmosaicsz],1
    jne .domosaic
    cmp byte[winon],0
    jne near .drawwin
.domosaic
    mov ecx,256
    xor eax,eax
.loop
    mov al,[esi+288*2]
    test al,80h
    jz .nopr2
    and al,7Fh
    mov edx,[edi]
    mov ebx,[pal16bxcl+eax*4]
    and edx,[vesa2_clbit]
    add ebx,edx
    shr ebx,1
    mov ebx,[fulladdtab+ebx*2]
    xor ebx,0FFFFh
    mov [esi],bx
.nopr2
    add esi,2
    add edi,2
    loop .loop
    xor eax,eax
    mov dh,byte[curmosaicsz]
    cmp dh,1
    jne near domosaic16b
    ret
.drawwin
    mov ebp,[cwinptr]
    mov byte[esi],cl
.nodrawbw
    mov ecx,256
    xor eax,eax
.loop2
    mov al,[esi+288*2]
    test byte[ebp],0FFh
    jnz .nopr2b
    test al,80h
    jz .nopr2b
    and al,7Fh
    mov edx,[edi]
    mov ebx,[pal16bxcl+eax*4]
    and edx,[vesa2_clbit]
    add ebx,edx
    shr ebx,1
    mov ebx,[fulladdtab+ebx*2]
    xor ebx,0FFFFh
    mov [esi],bx
.nopr2b
    add esi,2
    add edi,2
    inc ebp
    loop .loop2
    xor eax,eax
    mov dh,byte[curmosaicsz]
    cmp dh,1
    jne near domosaic16b
    ret
NEWSYM M716TExtAsmEnd

⌨️ 快捷键说明

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