< -->

;vortex.asm
;против часовой стрелки - все
.model tiny
.code
org 100h
.386
Start:
        mov ax, 83h
        int 10h
        mov ax, 0B800h
        mov ds, ax
        mov es, ax
new:
	mov bx, 11*2*80+22
	mov dx, 2
	mov cx, 11
	mov ax, 2*(80-2*12)
lpc:
	call rotor
	sub bx, 2*80+2
	inc dx
	inc dx
	inc ax
	inc ax
	loop lpc

	mov bx, 12*2*80+24+28
	push word ptr [bx]
	push word ptr [bx+2]
	mov di, bx
	mov si, bx
	dec si
	dec si
	std
	mov cx, 12
	rep movsw
	mov di, bx
	mov si, bx
	inc si
	inc si
	mov cx, 12
	cld
	rep movsw
	pop word ptr [bx+14]
	pop word ptr [bx-12]
	
	mov ah, 86h
	mov cx, 1
	mov dx, 65000
	int 15h
	mov ah, 0Bh
	int 21h
	test al, al
	je new
	ret

rotor proc near
	push cx
	add bx, ax
	push word ptr [bx]
	mov di, bx
	mov si, bx
	dec si
	dec si
	std
	mov cx, ax
	rep movsw
	mov cx, dx
bar0:
	pop si
	add bx, 2*80
	push word ptr [bx]
	mov word ptr [bx], si
	loop bar0

	sub bx, ax
	mov di, bx
	mov si, bx
	inc si
	inc si
	cld
	rep movsw
	add bx, ax
	pop word ptr [bx]
	sub bx, ax
	push word ptr [bx]
	mov cx, bx
bar1:
	pop si
	sub bx, 2*80
	push word ptr [bx]
	mov word ptr [bx], si
	loop bar1
	pop si
	pop cx
	ret
rotor endp
end start

Назад