Paining Tomatro by T$ [web]
; Paining Tomatro
; Fastmade 256b entry for Revision 2019 from T$
; runs on MS-DOS / FreeDOS / DosBOX (cycles = max or at least high enough for > 18 fps)
; note that some windows machines have insufficient pc speaker timing both with XP DOS box or NTVDN,
; use plain DOS for maximum fidelity
org 100h
push word 0a000h - 70 ;modified to center to 160,100
pop es
; optional: set fs explicitly to avoid problems with some memory managers:
push byte 0
pop fs
mov al,13h
int 10h
schleife:
; visuals
mov ax,bp
and ax,7
sub ax,4
imul al
add ax,ax
add ax,70
mov bx,bp
test bl,0x40
jz verkehrt
neg bl
verkehrt:
add bx,bx
mov bh,al
sub bl, 40
eyedist equ 22
eyeheight equ 28
tomatoendcolor equ 46 ;48
eyecolorend equ 31
mov dx, eyecolorend
mov si, 8*256
test bp,32+16+6
jnz noblink
mov si,bp
shl si,12
noblink:
;mov cx,16 ;eyes
call kugelding
jc passtschon
sub bx,eyedist*2
call kugelding
jc passtschon
mov dx,bp
and dx,7
add dx,tomatoendcolor
add bx,eyeheight*256+eyedist
mov si,256
;mov cx,16 ; sphere
call kugelding
jc passtschon
; fade fx
mov al,[es:di]
inc al
cmp al,100
jnb strobo
;test bp,32
;jnz strobo
mov dx,bp
shr dl,4
mov cx,di
xor cl,ch
add cl,al
and cl,dl
jnz passtschon
strobo:
mov ax,bp
and al,3
add ax,ax
jp passtschon
add al,103 ; 103 - 123
passtschon:
stosb
or di,di
jnz schleife
mov bp,[fs:0x46c]
; sound
mov ax,bp
shl ax,5
jp np
add ax,ax
np:
imul al
shr ax,7
cmp al, 20
ja bums
mov ax,bp
shl ax,4
add al,ah
add ax,ax
bums:
out 42h,al ; set speaker freq
add cx,bp
test cl,0x2
jnz simple
test cl,0x5
jz r
not cl
r:
shr cx,4
and cl,3
mov ch,0xff
shr ch,cl
and al,ch
simple:
out 42h,al
not al
out 61h,al ; enable speaker
; ui
in al,60h
; optional: check with dec instead of das for better dosbox compatibility:
dec al ;das
jnz schleife ;jp schleife
;ret
kugelding: ; bh = yOffset, bl = xOffset, si = scale, dx = color offset, cx = maxdist^2
push dx
mov ax,0xCCCD
mul di ; dh = y, dl.ah = x)
xchg ax,dx
mov dl, ah
add ax,bx
imul al ; ax = x^2
xchg ax,dx
sub al,bh
imul al ; dx = x^2, ax = y^2
add ax,dx
mov dx,bp
;shr dx,1
and dx,31
add dx,si
mul dx;si
xchg ax,dx
pop dx
cmp ax,16;cx
pushf
;dithering
mov cx,di
xor cl,ch
and cx,1
add ax,cx
neg ax
add ax,dx
popf
ret
;db "Tomat"[ back to the prod ]
