📄 procvid.asm
字号:
mov esi,70*2+70*288*2
add esi,[vidbuffer]
mov ecx,150
call drawhline16b
mov esi,70*2+70*288*2
add esi,[vidbuffer]
mov ecx,70
call drawvline16b
mov esi,70*2+139*288*2
add esi,[vidbuffer]
mov ecx,150
call drawhline16b
mov esi,219*2+70*288*2
add esi,[vidbuffer]
mov ecx,70
call drawvline16b
mov esi,75*2+93*288*2
add esi,[vidbuffer]
mov ecx,111
call drawhline16b
mov esi,75*2+104*288*2
add esi,[vidbuffer]
mov ecx,111
call drawhline16b
mov esi,75*2+94*288*2
add esi,[vidbuffer]
mov bl,11
.nextvline16b
mov ecx,10
push esi
push ebx
call drawvline16b
pop ebx
pop esi
add esi,22
dec bl
jnz .nextvline16b
mov esi,78*2+96*288*2
add esi,[vidbuffer]
mov al,1
call outputchar16b
mov bl,9
.nextnumchar16b
add esi,22
inc al
push ebx
call outputchar16b
pop ebx
dec bl
jnz .nextnumchar16b
mov byte[curblank],0h
mov bl,0
mov ebx,[statefileloc]
mov al,byte[fnamest+ebx]
%ifdef __LINUX__
cmp al,'t'
%else
cmp al,'T'
%endif
jne .noT16b
mov bl,0
jmp .nexter16b
.noT16b
mov bl,al
sub bl,48
.nexter16b
mov dx,[.allred]
call drawbox16b
push ebx
mov al,[newengen]
mov byte[newengen],0
push eax
call copyvid
pop eax
mov [newengen],al
pop ebx
; wait until esc/enter is pressed
mov byte[PrevPictureVal],0FFh
.noesc16b
mov [CurPictureVal],bl
pushad
mov eax,[statefileloc]
mov cl,byte[fnamest+eax]
push ecx
cmp bl,0
jne .nozero16b2
%ifdef __LINUX__
mov cl,'t'
%else
mov cl,'T'
%endif
jmp .save16b2
.nozero16b2
mov cl,bl
add cl,48
.save16b2
mov byte[fnamest+eax],cl
call GetPicture
pop ecx
mov eax,[statefileloc]
mov byte[fnamest+eax],cl
popad
mov dx,0FFFFh
call drawbox16b
mov ecx,2500
call delay
call testpressed8b
test byte[pressed+1],1
jnz near .esc16b
test byte[pressed+28],1
jnz near .enter16b
mov ecx,2500
call delay
call testpressed8b
test byte[pressed+1],1
jnz near .esc16b
test byte[pressed+28],1
jnz near .enter16b
push ebx
mov al,[newengen]
mov byte[newengen],0
push eax
call copyvid
pop eax
mov [newengen],al
pop ebx
mov ecx,2500
call delay
call testpressed8b
test byte[pressed+1],1
jnz near .esc16b
test byte[pressed+28],1
jnz near .enter16b
mov ecx,2500
call delay
call testpressed8b
test byte[pressed+1],1
jnz near .esc16b
test byte[pressed+28],1
jnz near .enter16b
mov dx,[.allred]
call drawbox16b
push ebx
mov al,[newengen]
mov byte[newengen],0
push eax
call copyvid
pop eax
mov [newengen],al
pop ebx
jmp .noesc16b
.enter16b
mov byte[pressed+28],2
cmp bl,0
jne .nozero16b
%ifdef __LINUX__
mov al,'t'
%else
mov al,'T'
%endif
jmp .save16b
.nozero16b
add bl,48
mov al,bl
.save16b
mov ebx,[statefileloc]
mov byte[fnamest+ebx],al
.esc16b
mov eax,pressed
mov ecx,256
.looppr2
cmp byte[eax],1
jne .notpr2
mov byte[eax],2
.notpr2
inc eax
loop .looppr2
.prwin
%ifdef __MSDOS__
mov byte[pressed+1],0
%endif
mov word[t1cc],0
mov byte[csounddisable],0
call StartSound
mov byte[f3menuen],0
mov byte[ForceNonTransp],0
mov byte[GUIOn],0
call Clear2xSaIBuffer
ret
.stringa db 'PLEASE SELECT',0
.stringb db 'SAVE STATE SLOT',0
.stringc db 'USE CURSOR KEYS',0
.stringd db 'TO MOVE AND',0
.stringe db 'ENTER TO SELECT',0
NEWSYM ForceNonTransp, db 0
NEWSYM testpressed8b
test byte[pressed+2],1
jz .no1
mov bl,1
.no1
test byte[pressed+3],1
jz .no2
mov bl,2
.no2
test byte[pressed+4],1
jz .no3
mov bl,3
.no3
test byte[pressed+5],1
jz .no4
mov bl,4
.no4
test byte[pressed+6],1
jz .no5
mov bl,5
.no5
test byte[pressed+7],1
jz .no6
mov bl,6
.no6
test byte[pressed+8],1
jz .no7
mov bl,7
.no7
test byte[pressed+9],1
jz .no8
mov bl,8
.no8
test byte[pressed+10],1
jz .no9
mov bl,9
.no9
test byte[pressed+11],1
jz .no0
mov bl,0
.no0
test byte[pressed+75],1
jz .noleft
cmp bl,0
je .noleft
dec bl
mov byte[pressed+75],2
.noleft
test byte[pressed+77],1
jz .noright
cmp bl,9
je .noright
inc bl
mov byte[pressed+77],2
.noright
;cmp byte[OSPort],3
;jne near .nowin32
%ifndef __MSDOS__
%ifdef __LINUX__
test byte[pressed+92],1
%else
test byte[pressed+0CBh],1
%endif
jz .noleft2
cmp bl,0
je .noleft2
dec bl
%ifdef __LINUX__
mov byte[pressed+92],2
%else
mov byte[pressed+0CBh],2
%endif
.noleft2
%ifdef __LINUX__
test byte[pressed+94],1
%else
test byte[pressed+0CDh],1
%endif
jz .noright2
cmp bl,9
je .noright2
inc bl
%ifdef __LINUX__
mov byte[pressed+94],2
%else
mov byte[pressed+0CDh],2
%endif
.noright2
;.nowin32
%endif
ret
;*******************************************************
; MakePal Changes the entire palette
;*******************************************************
; set the brightness with [maxbr]
NEWSYM cgramback, times 256 dw 0
NEWSYM doveg
pushad
; backup cgram
mov ecx,128
xor ebx,ebx
.loop
mov eax,[cgram+ebx]
mov [cgramback+ebx],eax
add ebx,4
loop .loop
xor eax,eax
mov al,[coladdr]
add al,[coladdg]
add al,[coladdb]
xor dx,dx
mov bx,3
div bx
and ax,011111b
mov [coladdr],al
mov [coladdg],al
mov [coladdb],al
xor eax,eax
.next
push eax
mov ax,[cgram+eax]
mov bx,ax
mov cx,ax
and bx,011111b
and cx,1111100000b
shr cx,5
add bx,cx
mov cx,ax
and cx,111110000000000b
shr cx,10
add bx,cx
mov ax,bx
xor dx,dx
mov bx,3
div bx
and ax,011111b
mov cx,ax
mov bx,ax
shl bx,5
or ax,bx
shl cx,10
or ax,cx
mov bx,ax
pop eax
mov word[cgram+eax],bx
add eax,2
cmp eax,200h
jne .next
popad
ret
NEWSYM dovegrest
pushad
; backup cgram
mov ecx,128
xor ebx,ebx
.loop
mov eax,[cgramback+ebx]
mov [cgram+ebx],eax
add ebx,4
loop .loop
popad
ret
blahblahblah dw 0
NEWSYM dosmakepal
cmp byte[V8Mode],1
jne .noveg
call doveg
.noveg
mov ax,[cgram]
mov [tempco0],ax
test byte[scaddtype],00100000b
jz near .noaddition
test byte[scaddtype],10000000b
jnz near .noaddition
mov cx,[cgram]
mov ax,cx
and ax,001Fh
add al,[coladdr]
cmp al,01Fh
jb .noadd
mov al,01Fh
.noadd
mov bx,ax
mov ax,cx
shr ax,5
and ax,001Fh
add al,[coladdg]
cmp al,01Fh
jb .noaddb
mov al,01Fh
.noaddb
shl ax,5
add bx,ax
mov ax,cx
shr ax,10
and ax,001Fh
add al,[coladdb]
cmp al,01Fh
jb .noaddc
mov al,01Fh
.noaddc
shl ax,10
add bx,ax
mov [cgram],bx
.noaddition
cmp byte[Palette0],0
je .nocol0mod
mov word[cgram],0
.nocol0mod
NEWSYM makepalb
mov edi,cgram
mov ebx,prevpal
xor ah,ah
.loopa
mov cx,[edi]
push eax
push ebx
mov [ebx],cx
mov al,ah
mov dx,03C8h
out dx,al
mov ax,cx
and al,01Fh
mov bh,[maxbr]
mov bl,bh
mul bl
mov bl,15
div bl
shl al,1
mov dx,03C9h
add al,[gammalevel]
cmp al,63
jbe .nor
mov al,63
.nor
out dx,al
mov ax,cx
shr ax,5
and al,01Fh
mov bl,bh
mul bl
mov bl,15
div bl
shl al,1
add al,[gammalevel]
cmp al,63
jbe .nog
mov al,63
.nog
out dx,al
mov ax,cx
shr ax,10
and al,01Fh
mov bl,bh
mul bl
mov bl,15
div bl
shl al,1
add al,[gammalevel]
cmp al,63
jbe .nob
mov al,63
.nob
out dx,al
pop ebx
pop eax
add edi,2
add ebx,2
inc ah
jnz near .loopa
mov al,[maxbr]
mov [prevbright],al
mov ax,[tempco0]
mov [cgram],ax
cmp byte[MessageOn],0
je .nochange128
mov dx,03C8h
mov al,128
out dx,al
mov al,63
inc dx
out dx,al
out dx,al
out dx,al
mov dx,03C8h
mov al,128+64
out dx,al
mov al,0
inc dx
out dx,al
out dx,al
out dx,al
.nochange128
cmp byte[V8Mode],1
jne .noveg2
call dovegrest
.noveg2
ret
NEWSYM tempco0, dw 0
;*******************************************************
; ChangePal Sets up the palette
;*******************************************************
NEWSYM doschangepal
cmp byte[V8Mode],1
jne .noveg
call doveg
.noveg
mov ax,[cgram]
mov [tempco0],ax
test byte[scaddtype],00100000b
jz near .noaddition
test byte[scaddtype],10000000b
jnz near .noaddition
mov cx,[cgram]
mov ax,cx
and ax,001Fh
add al,[coladdr]
cmp al,01Fh
jb .noadd
mov al,01Fh
.noadd
mov bx,ax
mov ax,cx
shr ax,5
and ax,001Fh
add al,[coladdg]
cmp al,01Fh
jb .noaddb
mov al,01Fh
.noaddb
shl ax,5
add bx,ax
mov ax,cx
shr ax,10
and ax,001Fh
add al,[coladdb]
cmp al,01Fh
jb .noaddc
mov al,01Fh
.noaddc
shl ax,10
add bx,ax
mov [cgram],bx
.noaddition
cmp byte[Palette0],0
je .nocol0mod
mov word[cgram],0
.nocol0mod
; check if brightness differs
mov al,[maxbr]
cmp al,[prevbright]
jne near makepalb
; check for duplicate palette (Compare prevpal with cgram)
mov ebx,prevpal
mov edi,cgram
xor ah,ah
.loopa
mov cx,[edi]
cmp cx,[ebx]
je .nochange
push eax
push ebx
push eax
pop eax
mov [ebx],cx
mov al,ah
mov dx,03C8h
out dx,al
mov ax,cx
and al,01Fh
mov bh,[maxbr]
mov bl,bh
mul bl
mov bl,15
div bl
shl al,1
add al,[gammalevel]
cmp al,63
jbe .nor
mov al,63
.nor
inc dx
out dx,al
mov ax,cx
shr ax,5
and al,01Fh
mov bl,bh
mul bl
mov bl,15
div bl
shl al,1
add al,[gammalevel]
cmp al,63
jbe .nog
mov al,63
.nog
out dx,al
mov ax,cx
shr ax,10
and al,01Fh
mov bl,bh
mul bl
mov bl,15
div bl
shl al,1
add al,[gammalevel]
cmp al,63
jbe .nob
mov al,63
.nob
out dx,al
pop ebx
pop eax
.nochange
add edi,2
add ebx,2
inc ah
jnz near .loopa
mov ax,[tempco0]
mov [cgram],ax
cmp byte[MessageOn],0
je .nochange128
mov dx,03C8h
mov al,128
out dx,al
mov al,63
inc dx
out dx,al
out dx,al
out dx,al
.nochange128
cmp byte[V8Mode],1
jne .noveg2
call dovegrest
.noveg2
ret
NEWSYM prevbright, db 0 ; previous brightness
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -