home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 September
/
Chip_2002-09_cd1.bin
/
ctenari
/
Veber
/
src
/
procs.asm
< prev
next >
Wrap
Assembly Source File
|
2002-07-08
|
4KB
|
201 lines
; Procedures (Game Sputnik)
; Copyright (C) 2001 Jaromφr Veber
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;###############################################################################
;this is very good delay - it takes on all computers the same time.
delay:
mov bp,sp
MOV cx,[bp+2]
test cx,cx
jz .pauza_end
mov ax,66
mul cx
mov cx,ax
.pauza_c1
in al,61h
test al,10h
jz .pauza_c1
dec cx
jz .pauza_end
.pauza_c2
in al,61h
test al,10h
jnz .pauza_c2
dec cx
jnz .pauza_c1
.pauza_end
ret
;display procedures
;5 words - 1. position X , 2. position Y, 3. sizeX, 4. sizeY
;5. color (byte)
New_Rectangle ;it is realy programed from me so....
mov bp,sp
mov AX,[bp+10]
mov BX,[bp+8]
SHL BX,6
add AX,BX
SHL BX,2
add BX,AX
mov AL,[bp+2]
mov CX,[bp+6]
.loopik
mov [FS:BX],AL
inc BX
LOOP .loopik
mov CX,[bp+4]
.loopik1
add BX,320
sub BX,[bp+6]
mov [FS:BX],AL
add BX,[bp+6]
mov [FS:BX-1],AL
LOOP .loopik1
.exit
add BX,320
sub BX,[bp+6]
mov CX,[bp+6]
.loopik2
mov [FS:BX],AL
inc BX
LOOP .loopik2
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;1. X; 2. Y ;3. size X 4. color
New_lineX
mov bp,sp
mov AX,[bp+8]
mov BX,[bp+6]
SHL BX,6
add AX,BX
SHL BX,2
add BX,AX
mov AL,[bp+2]
mov CX,[bp+4]
.loopik
mov [FS:BX],AL
inc BX
LOOP .loopik
ret
;;;;;;;;;;;
;random
;1. number to generate radom number; 2. number of posibilities
;returns in AX generated number
;it is not the best generator, but can be used
;it was realy made from my
Random
mov bp,sp
mov AX,[bp+4]
mov BX,[bp+2]
mov CL,BL
rcl AX,CL
mov CX,0FFFFH
.loopt
cmp AX,BX
jb .return
rol AX,15
shr AX,2
ror AX,15
rcl AX,CL
LOOP .loopt
mov CX,10H
.eliminator
cmp AX,BX
jb .return
shr ax,1
LOOP .loopt
.return
ret
WriteStr_proc
mov bp,sp
mov si,[BP+2]
mov AH,0EH
mov BL,7
.UP
LODSB
test AL,AL
JZ .DOWN
INT 10H
JMP .UP
.DOWN
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;1. X; 2. Y ;3. size Y 4. color
lineY_proc
mov bp,sp
mov AX,[bp+8]
mov BX,[bp+6]
SHL BX,6
add AX,BX
SHL BX,2
add BX,AX
mov AL,[bp+2]
mov CX,[bp+4]
dec CX
dec CX
.loopik
mov [FS:BX],AL
add BX,320
LOOP .loopik
ret
%ifdef DEBUG
Write_AX_proc:
push ax
xchg AL,AH
call WriteAL_proc
xchg AL,AH
call WriteAL_proc
pop ax
ret
%endif
WriteAL_proc
pusha
mov CL,AL
shr AL,4
cmp al,10
sbb al,69h
das
mov AH,0EH
mov BL,7
INT 10H
mov AL,CL
and AL,0FH
cmp al,10
sbb al,69h
das
mov AH,0EH
mov BL,7
INT 10H
popa
ret