2006-01-03 10:43:31 +01:00
|
|
|
;
|
|
|
|
; CHESS CLIENT for CHESSCLUB.COM (VT)
|
|
|
|
;
|
|
|
|
; Compile with FASM for Menuet
|
|
|
|
;
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
appname equ 'Chess Client for Chessclub.com '
|
|
|
|
version equ '0.2'
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
use32
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
org 0x0
|
|
|
|
|
|
|
|
db 'MENUET00' ; 8 byte id
|
|
|
|
dd 38 ; required os
|
|
|
|
dd START ; program start
|
|
|
|
dd I_END ; program image size
|
|
|
|
dd 0x100000 ; required amount of memory
|
|
|
|
; esp = 0x7FFF0
|
|
|
|
dd 0x00000000 ; reserved=no extended header
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
include 'lang.inc'
|
|
|
|
include 'macros.inc'
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
;file_info:
|
|
|
|
;
|
|
|
|
; dd 0,0,-1,0x4000,0x20000
|
|
|
|
; db '/rd/1/chess.bmp',0
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
file_info:
|
2006-10-12 01:19:10 +02:00
|
|
|
dd 0
|
|
|
|
dd 0
|
|
|
|
dd 0
|
|
|
|
dd -1
|
|
|
|
dd 0x4000
|
|
|
|
db '/rd/1/chess.bmp',0
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
pawn_color:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
dd 0x000000
|
|
|
|
dd 0x222222
|
|
|
|
dd 0x444444
|
|
|
|
dd 0xf0f0f0
|
|
|
|
dd 0xc0c0c0
|
|
|
|
dd 0xa0a0a0
|
|
|
|
dd 0xa0a0a0
|
|
|
|
dd 0x707070
|
|
|
|
dd 0xb0b0b0
|
|
|
|
dd 0xc0c0c0
|
|
|
|
dd 0xd0d0d0
|
|
|
|
dd 0xd8d8d8
|
|
|
|
dd 0xe0e0e0
|
|
|
|
dd 0xe8e8e8
|
|
|
|
dd 0x00ff00
|
|
|
|
dd 0xffffff
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
texts equ board_old+80*30
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
text equ texts+80*32*4
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
START: ; start of execution
|
|
|
|
|
|
|
|
; mov eax,58
|
|
|
|
mov eax,70
|
|
|
|
; mov ebx,file_info
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,file_info
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov esi,0x4000+22*3+4+24*2
|
|
|
|
mov edi,0x10000+18*3
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,0
|
|
|
|
mov ecx,0
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
newp:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
xor eax,eax
|
|
|
|
mov al,[esi]
|
|
|
|
and al,0xf0
|
|
|
|
shr al,4
|
|
|
|
shl eax,2
|
|
|
|
mov eax,[pawn_color+eax]
|
|
|
|
mov [edi+0],eax
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
xor eax,eax
|
|
|
|
mov al,[esi]
|
|
|
|
and al,0x0f
|
|
|
|
shl eax,2
|
|
|
|
mov eax,[pawn_color+eax]
|
|
|
|
mov [edi+3],eax
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
add edi,6
|
|
|
|
add esi,1
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
inc ebx
|
|
|
|
cmp ebx,23
|
|
|
|
jbe newp
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
sub edi,12
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,0
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
inc ecx
|
|
|
|
cmp ecx,279
|
2006-10-12 01:19:10 +02:00
|
|
|
jb newp
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
; Clear the screen memory
|
|
|
|
mov eax, ' '
|
|
|
|
mov edi,text
|
|
|
|
mov ecx,80*30 /4
|
|
|
|
cld
|
|
|
|
rep stosd
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
call draw_window
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
still:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
call check_for_board
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
call board_changed
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
call draw_board
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
; check connection status
|
|
|
|
mov eax,53
|
|
|
|
mov ebx,6
|
|
|
|
mov ecx,[socket]
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx, [socket_status]
|
|
|
|
mov [socket_status], eax
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp eax, ebx
|
2006-10-12 01:19:10 +02:00
|
|
|
je waitev
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
call display_status
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
waitev:
|
2006-10-12 01:19:10 +02:00
|
|
|
mov eax,23 ; wait here for event
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,20
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
cmp eax,1 ; redraw request ?
|
|
|
|
je red
|
|
|
|
cmp eax,2 ; key in buffer ?
|
|
|
|
je key
|
|
|
|
cmp eax,3 ; button in buffer ?
|
|
|
|
je button
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
; any data from the socket?
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax, 53
|
|
|
|
mov ebx, 2
|
|
|
|
mov ecx, [socket]
|
|
|
|
int 0x40
|
|
|
|
cmp eax, 0
|
|
|
|
jne read_input
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
jmp still
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
read_input:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
push ecx
|
|
|
|
mov eax, 53
|
|
|
|
mov ebx, 3
|
|
|
|
mov ecx, [socket]
|
|
|
|
int 0x40
|
|
|
|
pop ecx
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
call handle_data
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
push ecx
|
|
|
|
mov eax, 53
|
|
|
|
mov ebx, 2
|
|
|
|
mov ecx, [socket]
|
|
|
|
int 0x40
|
|
|
|
pop ecx
|
|
|
|
cmp eax, 0
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
jne read_input
|
|
|
|
call draw_text
|
|
|
|
jmp still
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
check_for_board:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
pusha
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov esi,text-80
|
|
|
|
news:
|
|
|
|
add esi,80
|
|
|
|
cmp esi,text+80*10
|
2006-10-12 01:19:10 +02:00
|
|
|
je board_not_found
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp [esi+12],dword '----'
|
2006-10-12 01:19:10 +02:00
|
|
|
je cfb1
|
2006-01-03 10:43:31 +01:00
|
|
|
jmp news
|
|
|
|
cfb1:
|
|
|
|
cmp [esi+16*80+12],dword '----'
|
2006-10-12 01:19:10 +02:00
|
|
|
je cfb2
|
2006-01-03 10:43:31 +01:00
|
|
|
jmp news
|
|
|
|
cfb2:
|
|
|
|
cmp [esi+2*80+12],dword '+---'
|
|
|
|
jne news
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp [esi+4*80+12],dword '+---'
|
|
|
|
jne news
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
board_found:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edi,chess_board
|
|
|
|
mov ecx,80*18
|
|
|
|
cld
|
|
|
|
rep movsb
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
board_not_found:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
yst dd 150
|
|
|
|
textx equ 10
|
|
|
|
ysts equ 410
|
|
|
|
|
|
|
|
boardx dd 45
|
|
|
|
boardy dd 45
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
boardxs dd 44
|
|
|
|
boardys dd 44
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
conx equ 420
|
|
|
|
cony equ 118
|
|
|
|
|
|
|
|
dconx equ 420
|
|
|
|
dcony equ 148
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
statusx equ 420
|
|
|
|
statusy equ 178
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
drsq:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
push eax ebx
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ecx,ebx
|
|
|
|
mov ebx,eax
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,ebx
|
|
|
|
add eax,ecx
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
imul ebx,[boardxs]
|
|
|
|
add ebx,[boardx]
|
|
|
|
shl ebx,16
|
|
|
|
imul ecx,[boardys]
|
|
|
|
add ecx,[boardy]
|
|
|
|
shl ecx,16
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
add ebx,[boardxs]
|
|
|
|
add ecx,[boardys]
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edx,[sq_black]
|
|
|
|
test eax,1
|
|
|
|
jnz dbl22
|
|
|
|
mov edx,[sq_white]
|
|
|
|
dbl22:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,13
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
pop ebx eax
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
draw_pawn:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
; edi,0 ; white / black
|
|
|
|
; esi,0 ; from position 2 , 20 square
|
|
|
|
; eax,2 ; board x
|
|
|
|
; ebx,0 ; board y
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
pusha
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
call drsq
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp esi,20
|
|
|
|
jne no_sqd
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
no_sqd:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
imul eax,[boardxs]
|
|
|
|
imul ebx,[boardys]
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
add eax,[boardx]
|
|
|
|
add ebx,[boardy]
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
imul esi,44*45*3
|
|
|
|
add esi,0x10000+18*3
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ecx,43
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
dp0:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
pusha
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ecx,44
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
ldp1:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
pusha
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ecx,ebx
|
|
|
|
mov ebx,eax
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edx,[esi]
|
|
|
|
and edx,0xffffff
|
|
|
|
mov eax,1
|
|
|
|
cmp edx,0x00ff00
|
|
|
|
je nowp
|
|
|
|
cmp edi,1
|
|
|
|
jne nobl
|
|
|
|
shr edx,1
|
|
|
|
and edx,0x7f7f7f
|
|
|
|
nobl:
|
|
|
|
int 0x40
|
|
|
|
nowp:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
add esi,3
|
|
|
|
add eax,1
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
dec ecx
|
|
|
|
jnz ldp1
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
add ebx,1
|
|
|
|
add esi,3*44
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
dec ecx
|
|
|
|
jnz dp0
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
board_changed:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
pusha
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,0
|
|
|
|
mov esi,chess_board
|
|
|
|
bcl1:
|
|
|
|
add eax,[esi]
|
|
|
|
add esi,4
|
|
|
|
cmp esi,chess_board+19*80
|
2006-10-12 01:19:10 +02:00
|
|
|
jb bcl1
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp eax,[checksum]
|
2006-10-12 01:19:10 +02:00
|
|
|
je bcl2
|
2006-01-03 10:43:31 +01:00
|
|
|
mov [changed],1
|
|
|
|
bcl2:
|
|
|
|
mov [checksum],eax
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
checksum dd 0
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
changed db 1
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
draw_board:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
pusha
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp [changed],1
|
|
|
|
jne no_change_in_board
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov [changed],0
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,0
|
|
|
|
mov ebx,0
|
|
|
|
scan_board:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
push eax ebx
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov esi,ebx
|
|
|
|
imul esi,2
|
|
|
|
imul esi,80
|
|
|
|
add esi,80
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
imul eax,4
|
|
|
|
add eax,10
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
add esi,eax
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
movzx edx,word [chess_board+esi]
|
|
|
|
cmp dx,[board_old+esi]
|
|
|
|
je empty_slot
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ecx,13
|
|
|
|
newseek2:
|
|
|
|
mov edi,ecx
|
|
|
|
imul edi,8
|
|
|
|
sub edi,8
|
|
|
|
cmp dx,[edi+nappulat]
|
|
|
|
je foundnappula2
|
|
|
|
loop newseek2
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
jmp empty_slot
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
foundnappula2:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov esi,[edi+nappulat+4]
|
|
|
|
mov edi,0
|
|
|
|
cmp dl,'*'
|
|
|
|
jne nnbb
|
|
|
|
mov edi,1
|
|
|
|
nnbb:
|
|
|
|
mov eax,[esp+4]
|
|
|
|
mov ebx,[esp]
|
|
|
|
call draw_pawn
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
empty_slot:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
pop ebx eax
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
inc eax
|
|
|
|
cmp eax,8
|
|
|
|
jb scan_board
|
|
|
|
mov eax,0
|
|
|
|
inc ebx
|
|
|
|
cmp ebx,8
|
|
|
|
jb scan_board
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov esi,chess_board
|
|
|
|
mov edi,board_old
|
|
|
|
mov ecx,80*19
|
|
|
|
cld
|
|
|
|
rep movsb
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,13
|
|
|
|
mov ebx,[boardx]
|
|
|
|
sub ebx,14
|
|
|
|
shl ebx,16
|
|
|
|
add ebx,8
|
|
|
|
mov ecx,[boardy]
|
|
|
|
shl ecx,16
|
|
|
|
add ecx,46*8
|
|
|
|
mov edx,[wcolor]
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
mov eax,4 ; numbers at left
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,[boardx]
|
|
|
|
sub ebx,14
|
|
|
|
shl ebx,16
|
|
|
|
add ebx,[boardy]
|
|
|
|
add ebx,18
|
|
|
|
mov ecx,[tcolor]
|
|
|
|
mov edx,chess_board+80+5
|
|
|
|
mov esi,3
|
|
|
|
db1:
|
|
|
|
int 0x40
|
|
|
|
add edx,80*2
|
|
|
|
add ebx,[boardxs]
|
|
|
|
cmp edx,chess_board+80*16
|
|
|
|
jb db1
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,13
|
|
|
|
mov ebx,[boardx]
|
|
|
|
shl ebx,16
|
|
|
|
add ebx,8*46
|
|
|
|
mov ecx,[boardys]
|
|
|
|
imul ecx,8
|
|
|
|
add ecx,[boardy]
|
|
|
|
add ecx,8
|
|
|
|
shl ecx,16
|
|
|
|
add ecx,10
|
|
|
|
mov edx,[wcolor]
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
mov eax,4 ; letters at bottom
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,[boardx]
|
|
|
|
add ebx,3
|
|
|
|
shl ebx,16
|
|
|
|
mov bx,word [boardys]
|
|
|
|
imul bx,8
|
|
|
|
add ebx,[boardy]
|
|
|
|
add ebx,8
|
|
|
|
mov ecx,[tcolor]
|
|
|
|
mov edx,chess_board+80*17+8
|
|
|
|
mov esi,4
|
|
|
|
db3:
|
|
|
|
int 0x40
|
|
|
|
mov edi,[boardxs]
|
|
|
|
shl edi,16
|
|
|
|
add ebx,edi
|
|
|
|
add edx,4
|
|
|
|
cmp edx,chess_board+80*17+8+4*8
|
|
|
|
jb db3
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
; print player times
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edi,74
|
|
|
|
cmp [chess_board+80+5],byte '1'
|
|
|
|
jne nowww2
|
|
|
|
mov edi,371
|
|
|
|
nowww2:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,13
|
|
|
|
mov ebx,(conx)*65536+100
|
|
|
|
mov ecx,edi
|
|
|
|
shl ecx,16
|
|
|
|
add ecx,10
|
|
|
|
mov edx,[wcolor]
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,4
|
|
|
|
mov ebx,(conx)*65536
|
|
|
|
add ebx,edi
|
|
|
|
mov ecx,[tcolor]
|
|
|
|
mov edx,chess_board+80*7+59-1
|
|
|
|
mov esi,20
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edi,74
|
|
|
|
cmp [chess_board+80+5],byte '1'
|
|
|
|
je nowww
|
|
|
|
mov edi,371
|
|
|
|
nowww:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,13
|
|
|
|
mov ebx,(conx)*65536+100
|
|
|
|
mov ecx,edi
|
|
|
|
shl ecx,16
|
|
|
|
add ecx,10
|
|
|
|
mov edx,[wcolor]
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,4
|
|
|
|
mov ebx,(conx)*65536
|
|
|
|
add ebx,edi
|
|
|
|
mov ecx,[tcolor]
|
|
|
|
mov edx,chess_board+80*9+59-1
|
|
|
|
mov esi,20
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
; move #
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,13
|
|
|
|
mov ebx,conx*65536+120
|
|
|
|
mov ecx,200*65536+10
|
|
|
|
mov edx,[wcolor]
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,4
|
|
|
|
mov ebx,conx*65536
|
|
|
|
add ebx,200
|
|
|
|
mov ecx,[tcolor]
|
|
|
|
mov edx,chess_board+80*1+46
|
|
|
|
mov esi,30
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
no_change_in_board:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
handle_data:
|
|
|
|
; Telnet servers will want to negotiate options about our terminal window
|
|
|
|
; just reject them all.
|
|
|
|
; Telnet options start with the byte 0xff and are 3 bytes long.
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov al, [telnetstate]
|
|
|
|
cmp al, 0
|
2006-10-12 01:19:10 +02:00
|
|
|
je state0
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp al, 1
|
2006-10-12 01:19:10 +02:00
|
|
|
je state1
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp al, 2
|
2006-10-12 01:19:10 +02:00
|
|
|
je state2
|
2006-01-03 10:43:31 +01:00
|
|
|
jmp hd001
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
state0:
|
|
|
|
cmp bl, 255
|
|
|
|
jne hd001
|
|
|
|
mov al, 1
|
|
|
|
mov [telnetstate], al
|
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
state1:
|
|
|
|
mov al, 2
|
|
|
|
mov [telnetstate], al
|
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
state2:
|
|
|
|
mov al, 0
|
|
|
|
mov [telnetstate], al
|
|
|
|
mov [telnetrep+2], bl
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edx, 3
|
|
|
|
mov eax,53
|
|
|
|
mov ebx,7
|
|
|
|
mov ecx,[socket]
|
|
|
|
mov esi, telnetrep
|
|
|
|
int 0x40
|
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
hd001:
|
2006-10-12 01:19:10 +02:00
|
|
|
cmp bl,13 ; BEGINNING OF LINE
|
2006-01-03 10:43:31 +01:00
|
|
|
jne nobol
|
|
|
|
mov ecx,[pos]
|
|
|
|
add ecx,1
|
|
|
|
boll1:
|
|
|
|
sub ecx,1
|
|
|
|
mov eax,ecx
|
|
|
|
xor edx,edx
|
|
|
|
mov ebx,80
|
|
|
|
div ebx
|
|
|
|
cmp edx,0
|
|
|
|
jne boll1
|
|
|
|
mov [pos],ecx
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
call check_for_board
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
jmp newdata
|
|
|
|
nobol:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
cmp bl,10 ; LINE DOWN
|
2006-01-03 10:43:31 +01:00
|
|
|
jne nolf
|
|
|
|
addx1:
|
|
|
|
add [pos],dword 1
|
|
|
|
mov eax,[pos]
|
|
|
|
xor edx,edx
|
|
|
|
mov ecx,80
|
|
|
|
div ecx
|
|
|
|
cmp edx,0
|
|
|
|
jnz addx1
|
|
|
|
mov eax,[pos]
|
|
|
|
jmp cm1
|
|
|
|
nolf:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
cmp bl,9 ; TAB
|
2006-01-03 10:43:31 +01:00
|
|
|
jne notab
|
|
|
|
add [pos],dword 8
|
|
|
|
jmp newdata
|
|
|
|
notab:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
cmp bl,8 ; BACKSPACE
|
2006-01-03 10:43:31 +01:00
|
|
|
jne nobasp
|
|
|
|
mov eax,[pos]
|
|
|
|
dec eax
|
|
|
|
mov [pos],eax
|
|
|
|
mov [eax+text],byte 32
|
|
|
|
mov [eax+text+60*80],byte 0
|
|
|
|
jmp newdata
|
|
|
|
nobasp:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
cmp bl,15 ; CHARACTER
|
2006-01-03 10:43:31 +01:00
|
|
|
jbe newdata
|
|
|
|
mov eax,[pos]
|
|
|
|
mov [eax+text],bl
|
|
|
|
mov eax,[pos]
|
|
|
|
add eax,1
|
|
|
|
cm1:
|
|
|
|
mov ebx,[scroll+4]
|
|
|
|
imul ebx,80
|
|
|
|
cmp eax,ebx
|
2006-10-12 01:19:10 +02:00
|
|
|
jb noeaxz
|
2006-01-03 10:43:31 +01:00
|
|
|
mov esi,text+80
|
|
|
|
mov edi,text
|
|
|
|
mov ecx,ebx
|
|
|
|
cld
|
|
|
|
rep movsb
|
|
|
|
mov eax,ebx
|
|
|
|
sub eax,80
|
|
|
|
noeaxz:
|
|
|
|
mov [pos],eax
|
|
|
|
newdata:
|
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
red: ; REDRAW WINDOW
|
2006-01-03 10:43:31 +01:00
|
|
|
call draw_window
|
|
|
|
jmp still
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
key: ; KEY
|
|
|
|
mov eax,2 ; send to modem
|
2006-01-03 10:43:31 +01:00
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx, [socket_status]
|
2006-10-12 01:19:10 +02:00
|
|
|
cmp ebx, 4 ; connection open?
|
|
|
|
jne still ; no, so ignore key
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
shr eax,8
|
2006-10-12 01:19:10 +02:00
|
|
|
cmp eax,178 ; ARROW KEYS
|
2006-01-03 10:43:31 +01:00
|
|
|
jne noaup
|
|
|
|
mov al,'A'
|
|
|
|
call arrow
|
|
|
|
jmp still
|
|
|
|
noaup:
|
|
|
|
cmp eax,177
|
|
|
|
jne noadown
|
|
|
|
mov al,'B'
|
|
|
|
call arrow
|
|
|
|
jmp still
|
|
|
|
noadown:
|
|
|
|
cmp eax,179
|
|
|
|
jne noaright
|
|
|
|
mov al,'C'
|
|
|
|
call arrow
|
|
|
|
jmp still
|
|
|
|
noaright:
|
|
|
|
cmp eax,176
|
|
|
|
jne noaleft
|
|
|
|
mov al,'D'
|
|
|
|
call arrow
|
|
|
|
jmp still
|
|
|
|
noaleft:
|
|
|
|
modem_out:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
call to_modem
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
jmp still
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
button: ; BUTTON
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,17
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
cmp ah,1 ; CLOSE PROGRAM
|
2006-01-03 10:43:31 +01:00
|
|
|
jne noclose
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,53
|
|
|
|
mov ebx,8
|
|
|
|
mov ecx,[socket]
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,-1
|
|
|
|
int 0x40
|
|
|
|
noclose:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
cmp ah, 4 ; connect
|
2006-01-03 10:43:31 +01:00
|
|
|
jne notcon
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax, [socket_status]
|
|
|
|
cmp eax, 4
|
2006-10-12 01:19:10 +02:00
|
|
|
je still
|
2006-01-03 10:43:31 +01:00
|
|
|
call connect
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
jmp still
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
notcon:
|
2006-10-12 01:19:10 +02:00
|
|
|
cmp ah,5 ; disconnect
|
2006-01-03 10:43:31 +01:00
|
|
|
jne notdiscon
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
call disconnect
|
|
|
|
jmp still
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
notdiscon:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
jmp still
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
arrow:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
push eax
|
|
|
|
mov al,27
|
|
|
|
call to_modem
|
|
|
|
mov al,'['
|
|
|
|
call to_modem
|
|
|
|
pop eax
|
|
|
|
call to_modem
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
to_modem:
|
|
|
|
pusha
|
|
|
|
push ax
|
|
|
|
mov [tx_buff], al
|
|
|
|
mov edx, 1
|
|
|
|
cmp al, 13
|
|
|
|
jne tm_000
|
|
|
|
mov edx, 2
|
|
|
|
tm_000:
|
|
|
|
mov eax,53
|
|
|
|
mov ebx,7
|
|
|
|
mov ecx,[socket]
|
|
|
|
mov esi, tx_buff
|
|
|
|
int 0x40
|
|
|
|
pop bx
|
|
|
|
mov al, [echo]
|
|
|
|
cmp al, 0
|
2006-10-12 01:19:10 +02:00
|
|
|
je tm_001
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
push bx
|
|
|
|
call handle_data
|
|
|
|
pop bx
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp bl, 13
|
|
|
|
jne tm_002
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov bl, 10
|
|
|
|
call handle_data
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
tm_002:
|
|
|
|
call draw_text
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
tm_001:
|
|
|
|
popa
|
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
disconnect:
|
|
|
|
mov eax,53
|
|
|
|
mov ebx,8
|
|
|
|
mov ecx,[socket]
|
|
|
|
int 0x40
|
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
connect:
|
|
|
|
pusha
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
mov ecx, 1000 ; local port starting at 1000
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
getlp:
|
2006-10-12 01:19:10 +02:00
|
|
|
inc ecx
|
2006-01-03 10:43:31 +01:00
|
|
|
push ecx
|
2006-10-12 01:19:10 +02:00
|
|
|
mov eax, 53
|
|
|
|
mov ebx, 9
|
|
|
|
int 0x40
|
|
|
|
pop ecx
|
|
|
|
cmp eax, 0 ; is this local port in use?
|
|
|
|
jz getlp ; yes - so try next
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,53
|
|
|
|
mov ebx,5
|
|
|
|
mov dl, [ip_address + 3]
|
|
|
|
shl edx, 8
|
|
|
|
mov dl, [ip_address + 2]
|
|
|
|
shl edx, 8
|
|
|
|
mov dl, [ip_address + 1]
|
|
|
|
shl edx, 8
|
|
|
|
mov dl, [ip_address]
|
|
|
|
mov esi, edx
|
2006-10-12 01:19:10 +02:00
|
|
|
movzx edx, word [port] ; telnet port id
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edi,1 ; active open
|
|
|
|
int 0x40
|
|
|
|
mov [socket], eax
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
; *********************************************
|
|
|
|
; ******* WINDOW DEFINITIONS AND DRAW ********
|
|
|
|
; *********************************************
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
draw_window:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
pusha
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,12
|
|
|
|
mov ebx,1
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,14
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,eax
|
|
|
|
mov ecx,eax
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
shr ebx,16
|
|
|
|
and ebx,0xffff
|
|
|
|
and ecx,0xffff
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
shr ebx,1
|
|
|
|
shr ecx,1
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
sub ebx,275
|
|
|
|
sub ecx,235
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
shl ebx,16
|
|
|
|
shl ecx,16
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
mov eax,0 ; DRAW WINDOW
|
2006-01-03 10:43:31 +01:00
|
|
|
mov bx,550
|
|
|
|
mov cx,470
|
|
|
|
mov edx,[wcolor]
|
2006-10-12 01:19:10 +02:00
|
|
|
add edx,0x13000000
|
|
|
|
mov edi,header
|
2006-01-03 10:43:31 +01:00
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
call display_status
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
mov eax,8 ; BUTTON 4: Connect
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,conx*65536+80
|
|
|
|
mov ecx,cony*65536+15
|
|
|
|
mov esi,[wbutton]
|
|
|
|
mov edx,4
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
mov eax,4 ; Button text
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,(conx+4)*65536+cony+4
|
|
|
|
mov ecx,0xffffff
|
|
|
|
mov edx,cont
|
|
|
|
mov esi,conlen-cont
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
mov eax,8 ; BUTTON 5: disconnect
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,dconx*65536+80
|
|
|
|
mov ecx,dcony*65536+15
|
|
|
|
mov edx,5
|
|
|
|
mov esi,[wbutton]
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
mov eax,4 ; Button text
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,(dconx+4)*65536+dcony+4
|
|
|
|
mov ecx,0x00ffffff
|
|
|
|
mov edx,dist
|
|
|
|
mov esi,dislen-dist
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
xor eax,eax
|
|
|
|
mov edi,text+80*30
|
|
|
|
mov ecx,80*30 /4
|
|
|
|
cld
|
|
|
|
rep stosd
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
call draw_text
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov [changed],1
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edi,board_old
|
|
|
|
mov ecx,80*19
|
|
|
|
mov al,0
|
|
|
|
cld
|
|
|
|
rep stosb
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,4
|
|
|
|
mov ebx,conx*65536+52
|
|
|
|
mov ecx,[tcolor]
|
|
|
|
mov edx,quick_start
|
|
|
|
mov esi,30
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
prqs:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
int 0x40
|
|
|
|
add ebx,10
|
|
|
|
add edx,30
|
|
|
|
cmp [edx],byte 'x'
|
|
|
|
jne prqs
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,12
|
|
|
|
mov ebx,2
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
display_status:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
pusha
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
; draw status bar
|
|
|
|
mov eax, 13
|
|
|
|
mov ebx, statusx*65536+80
|
|
|
|
mov ecx, statusy*65536 + 16
|
|
|
|
mov edx, [wcolor]
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
mov esi,contlen-contt ; display connected status
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edx, contt
|
|
|
|
mov eax, [socket_status]
|
2006-10-12 01:19:10 +02:00
|
|
|
cmp eax, 4 ; 4 is connected
|
|
|
|
je pcon
|
2006-01-03 10:43:31 +01:00
|
|
|
mov esi,discontlen-discontt
|
|
|
|
mov edx, discontt
|
|
|
|
pcon:
|
2006-10-12 01:19:10 +02:00
|
|
|
mov eax,4 ; status text
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,statusx*65536+statusy+2
|
|
|
|
mov ecx,[tcolor]
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
nappulat:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
dd '*P ',5
|
|
|
|
dd '*K ',3
|
|
|
|
dd '*Q ',4
|
|
|
|
dd '*R ',0
|
|
|
|
dd '*N ',1
|
|
|
|
dd '*B ',2
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
dd ' ',20
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
dd 'P ',5
|
|
|
|
dd 'K ',3
|
|
|
|
dd 'Q ',4
|
|
|
|
dd 'R ',0
|
|
|
|
dd 'N ',1
|
|
|
|
dd 'B ',2
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
row dd 0x0
|
|
|
|
col dd 0x0
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
draw_text:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov esi,text+80*24
|
|
|
|
mov edi,texts+80*3
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
dtl1:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp [esi],dword 'logi'
|
2006-10-12 01:19:10 +02:00
|
|
|
je add_text
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp [esi],dword 'aics'
|
2006-10-12 01:19:10 +02:00
|
|
|
je add_text
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp [esi],dword 'You '
|
2006-10-12 01:19:10 +02:00
|
|
|
je add_text
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp [esi],dword 'Your'
|
2006-10-12 01:19:10 +02:00
|
|
|
je add_text
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp [esi],dword 'Game'
|
2006-10-12 01:19:10 +02:00
|
|
|
je add_text
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp [esi],dword 'Ille'
|
2006-10-12 01:19:10 +02:00
|
|
|
je add_text
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp [esi],dword 'No s'
|
2006-10-12 01:19:10 +02:00
|
|
|
je add_text
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
sub esi,80
|
|
|
|
cmp esi,text
|
|
|
|
jge dtl1
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
dtl2:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,13
|
|
|
|
mov ebx,10*65536+532
|
|
|
|
mov ecx,420*65536+40
|
|
|
|
mov edx,[wtcom]
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,4
|
|
|
|
mov ebx,10*65536+420
|
|
|
|
mov ecx,[wtxt]
|
|
|
|
mov edx,texts
|
|
|
|
mov esi,80
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
dtl3:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
int 0x40
|
|
|
|
add edx,80
|
|
|
|
add ebx,10
|
|
|
|
cmp edx,texts+4*80
|
2006-10-12 01:19:10 +02:00
|
|
|
jb dtl3
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
add_text:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
pusha
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
cld
|
|
|
|
mov ecx,80
|
|
|
|
rep movsb
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
sub esi,80
|
|
|
|
sub edi,80
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp edi,texts
|
2006-10-12 01:19:10 +02:00
|
|
|
jb dtl2
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
jmp dtl1
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
read_string:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edi,string
|
|
|
|
mov eax,'_'
|
|
|
|
mov ecx,[string_length]
|
|
|
|
inc ecx
|
|
|
|
cld
|
|
|
|
rep stosb
|
|
|
|
call print_text
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edi,string
|
|
|
|
f11:
|
|
|
|
mov eax,10
|
|
|
|
int 0x40
|
|
|
|
cmp eax,2
|
|
|
|
jne read_done
|
|
|
|
mov eax,2
|
|
|
|
int 0x40
|
|
|
|
shr eax,8
|
|
|
|
cmp eax,13
|
2006-10-12 01:19:10 +02:00
|
|
|
je read_done
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp eax,8
|
|
|
|
jnz nobsl
|
|
|
|
cmp edi,string
|
2006-10-12 01:19:10 +02:00
|
|
|
jz f11
|
2006-01-03 10:43:31 +01:00
|
|
|
sub edi,1
|
|
|
|
mov [edi],byte '_'
|
|
|
|
call print_text
|
|
|
|
jmp f11
|
|
|
|
nobsl:
|
|
|
|
cmp eax,dword 31
|
|
|
|
jbe f11
|
|
|
|
cmp eax,dword 95
|
2006-10-12 01:19:10 +02:00
|
|
|
jb keyok
|
2006-01-03 10:43:31 +01:00
|
|
|
sub eax,32
|
|
|
|
keyok:
|
|
|
|
mov [edi],al
|
|
|
|
call print_text
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
inc edi
|
|
|
|
mov esi,string
|
|
|
|
add esi,[string_length]
|
|
|
|
cmp esi,edi
|
|
|
|
jnz f11
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
read_done:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
call print_text
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
print_text:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
pusha
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,13
|
|
|
|
mov ebx,[string_x]
|
|
|
|
shl ebx,16
|
|
|
|
add ebx,[string_length]
|
|
|
|
imul bx,6
|
|
|
|
mov ecx,[string_y]
|
|
|
|
shl ecx,16
|
|
|
|
mov cx,8
|
|
|
|
mov edx,[wcolor]
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,4
|
|
|
|
mov ebx,[string_x]
|
|
|
|
shl ebx,16
|
|
|
|
add ebx,[string_y]
|
|
|
|
mov ecx,[tcolor]
|
|
|
|
mov edx,string
|
|
|
|
mov esi,[string_length]
|
|
|
|
int 0x40
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
|
|
|
ret
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
; DATA AREA
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
telnetrep db 0xff,0xfc,0x00
|
|
|
|
telnetstate db 0
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
string_length dd 16
|
|
|
|
string_x dd 200
|
|
|
|
string_y dd 60
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
string db '________________'
|
|
|
|
|
|
|
|
tx_buff db 0, 10
|
|
|
|
ip_address db 204,178,125,65
|
|
|
|
port dw 5051 ; 0,0
|
|
|
|
echo db 1
|
|
|
|
socket dd 0x0
|
|
|
|
socket_status dd 0x0
|
|
|
|
pos dd 80 * 22
|
|
|
|
scroll dd 1
|
|
|
|
dd 24
|
|
|
|
|
|
|
|
wbutton dd 0x336688
|
|
|
|
|
|
|
|
wtcom dd 0x336688 ; 0x666666
|
|
|
|
wtxt dd 0xffffff
|
|
|
|
|
|
|
|
wcolor dd 0xe0e0e0
|
|
|
|
tcolor dd 0x000000
|
|
|
|
|
|
|
|
sq_black dd 0x336688 ; 666666
|
|
|
|
sq_white dd 0xffffff
|
|
|
|
|
|
|
|
header db appname,version,0
|
|
|
|
|
|
|
|
setipt db ' . . .'
|
2006-01-03 10:43:31 +01:00
|
|
|
setiplen:
|
2006-10-12 01:19:10 +02:00
|
|
|
setportt db ' '
|
2006-01-03 10:43:31 +01:00
|
|
|
setportlen:
|
2006-10-12 01:19:10 +02:00
|
|
|
cont db 'Connect'
|
2006-01-03 10:43:31 +01:00
|
|
|
conlen:
|
2006-10-12 01:19:10 +02:00
|
|
|
dist db 'Disconnect'
|
2006-01-03 10:43:31 +01:00
|
|
|
dislen:
|
2006-10-12 01:19:10 +02:00
|
|
|
contt db 'Connected'
|
2006-01-03 10:43:31 +01:00
|
|
|
contlen:
|
2006-10-12 01:19:10 +02:00
|
|
|
discontt db 'Disconnected'
|
2006-01-03 10:43:31 +01:00
|
|
|
discontlen:
|
2006-10-12 01:19:10 +02:00
|
|
|
echot db 'Echo On'
|
2006-01-03 10:43:31 +01:00
|
|
|
echolen:
|
2006-10-12 01:19:10 +02:00
|
|
|
echoot db 'Echo Off'
|
2006-01-03 10:43:31 +01:00
|
|
|
echoolen:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
quick_start:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
db '( OPPONENT ) '
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
times 16 db ' 1'
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
db 'Quick start: '
|
|
|
|
db ' '
|
|
|
|
db '1 Connect '
|
|
|
|
db '2 login: "guest" '
|
|
|
|
db '3 aics% "seek 10 0" '
|
|
|
|
db ' (for a player) '
|
|
|
|
db ' (wait) '
|
|
|
|
db '4 Play eg. "e7e5" '
|
|
|
|
db ' or "d2d4" '
|
|
|
|
db '5 aics% "resign" '
|
|
|
|
db ' (quit game) '
|
|
|
|
db '6 Disconnect '
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
times 5 db ' '
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
db '( YOU ) '
|
|
|
|
|
|
|
|
db 'x'
|
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
chess_board:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
times 80 db 0
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
db ' 8 *R *N *B *Q *K *B *N *R'
|
|
|
|
db ' '
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
times 80 db 0
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
db ' 7 *P *P *P *P *P *P *P *P'
|
|
|
|
db ' '
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
times 80 db 0
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
db ' 6 '
|
|
|
|
db ' '
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
times 80 db 0
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
db ' 5 '
|
|
|
|
db ' '
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
times 80 db 0
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
db ' 4 '
|
|
|
|
db ' '
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
times 80 db 0
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
db ' 3 '
|
|
|
|
db ' '
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
times 80 db 0
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
db ' 2 P P P P P P P P '
|
|
|
|
db ' '
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
times 80 db 0
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
db ' 1 R N B Q K B N R '
|
|
|
|
db ' '
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
times 80 db 0
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
db ' a b c d e f g h '
|
|
|
|
db ' '
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
times 80*20 db 0
|
2006-10-12 01:19:10 +02:00
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
board_old:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
I_END:
|
2006-10-12 01:19:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|