All pastes #812222 Raw Edit

zon

public text v1 · immutable
·published 2007-12-11 16:38 UTC
rendered paste body
%define REPTIMES ((( @end-@loop) +1) /2) + 100
%define JUMPSPACE  2049
%define BYTESCALLFAR 300
;
; 1. initialization
;
@start:
;Speed things up =D
	mov cx, 010h
@waitloop:
	wait
	wait
	wait
	wait
	loop @waitloop

;start the setting
;ES is set to be the same as DS so we write
;and read from the arena
	mov dx, ds
	mov es, dx
;sets stack postion to be code segment
	mov ss,dx

;DX is set to the first byte of our 
;copycat code (only the part that is copied
	mov dx, ax           
	add dx, @loop-@start

; Copying loop
; and setting it to go forward
	cld
	mov bp, REPTIMES ; make it faster
	mov ax, JUMPSPACE + (@end - @loop) ;make it faster
@loop: ;calls far here =D
;set stack pointer to be before the code
;maybe should be removed
	mov si, dx
	add dx, ax
	mov di, dx
	mov cx, bp
@write:
	rep movsw
;    mov cx, BYTESCALLFAR / 4		
	jmp dx ;calls to @loop
@end: