Subversion Repositories Kolibri OS

Rev

Rev 180 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 180 Rev 485
Line 6... Line 6...
6
 
6
 
7
appname equ 'Chess Client for Chessclub.com '
7
appname equ 'Chess Client for Chessclub.com '
Line 8... Line 8...
8
version equ '0.2'
8
version equ '0.2'
9
 
-
 
10
use32
9
 
11
 
-
 
12
		org	0x0
10
use32
13
 
11
 org	0x0
14
		db	'MENUET00'		; 8 byte id
12
 db	'MENUET01'    ; header
15
		dd	38			; required os
13
 dd	0x01	      ; header version
16
		dd	START			; program start
14
 dd	START	      ; entry point
17
		dd	I_END			; program image size
15
 dd	I_END	      ; image size
18
		dd	0x100000		; required amount of memory
16
 dd	I_END+0x10000 ; required memory
Line 19... Line 17...
19
						; esp = 0x7FFF0
17
 dd	I_END+0x10000 ; esp
20
		dd	0x00000000		; reserved=no extended header
18
 dd	0x0 , 0x0     ; I_Param , I_Path
Line 21... Line 19...
21
 
19
 
22
include 'lang.inc'
20
include 'lang.inc'
23
include 'macros.inc'
21
include '..\..\..\macros.inc'
24
 
22
 
Line 65... Line 63...
65
 
63
 
66
;    mov  eax,58
64
;    mov  eax,58
67
    mov  eax,70
65
    mov  eax,70
68
;    mov  ebx,file_info
66
;    mov  ebx,file_info
69
    mov  ebx,file_info
67
    mov  ebx,file_info
Line 70... Line 68...
70
    int  0x40
68
    mcall
71
 
69
 
Line 72... Line 70...
72
    mov  esi,0x4000+22*3+4+24*2
70
    mov  esi,0x4000+22*3+4+24*2
Line 127... Line 125...
127
 
125
 
128
    ; check connection status
126
    ; check connection status
129
    mov  eax,53
127
    mov  eax,53
130
    mov  ebx,6
128
    mov  ebx,6
131
    mov  ecx,[socket]
129
    mov  ecx,[socket]
Line 132... Line 130...
132
    int  0x40
130
    mcall
133
 
131
 
Line 134... Line 132...
134
    mov     ebx, [socket_status]
132
    mov     ebx, [socket_status]
Line 140... Line 138...
140
    call    display_status
138
    call    display_status
Line 141... Line 139...
141
 
139
 
142
waitev:
140
waitev:
143
    mov  eax,23 		; wait here for event
141
    mov  eax,23 		; wait here for event
144
    mov  ebx,20
142
    mov  ebx,20
Line 145... Line 143...
145
    int  0x40
143
    mcall
146
 
144
 
147
    cmp  eax,1			; redraw request ?
145
    cmp  eax,1			; redraw request ?
148
    je	 red
146
    je	 red
Line 154... Line 152...
154
    ; any data from the socket?
152
    ; any data from the socket?
Line 155... Line 153...
155
 
153
 
156
    mov     eax, 53
154
    mov     eax, 53
157
    mov     ebx, 2
155
    mov     ebx, 2
158
    mov     ecx, [socket]
156
    mov     ecx, [socket]
159
    int     0x40
157
    mcall
160
    cmp     eax, 0
158
    cmp     eax, 0
Line 161... Line 159...
161
    jne      read_input
159
    jne      read_input
Line 167... Line 165...
167
 
165
 
168
    push ecx
166
    push ecx
169
    mov     eax, 53
167
    mov     eax, 53
170
    mov     ebx, 3
168
    mov     ebx, 3
171
    mov     ecx, [socket]
169
    mov     ecx, [socket]
172
    int     0x40
170
    mcall
Line 173... Line 171...
173
    pop  ecx
171
    pop  ecx
Line 174... Line 172...
174
 
172
 
175
    call    handle_data
173
    call    handle_data
176
 
174
 
177
    push    ecx
175
    push    ecx
178
    mov     eax, 53
176
    mov     eax, 53
179
    mov     ebx, 2
177
    mov     ebx, 2
180
    mov     ecx, [socket]
178
    mov     ecx, [socket]
Line 181... Line 179...
181
    int     0x40
179
    mcall
Line 271... Line 269...
271
     jnz  dbl22
269
     jnz  dbl22
272
     mov  edx,[sq_white]
270
     mov  edx,[sq_white]
273
   dbl22:
271
   dbl22:
Line 274... Line 272...
274
 
272
 
275
     mov  eax,13
273
     mov  eax,13
Line 276... Line 274...
276
     int  0x40
274
     mcall
Line 277... Line 275...
277
 
275
 
Line 332... Line 330...
332
     cmp  edi,1
330
     cmp  edi,1
333
     jne  nobl
331
     jne  nobl
334
     shr  edx,1
332
     shr  edx,1
335
     and  edx,0x7f7f7f
333
     and  edx,0x7f7f7f
336
   nobl:
334
   nobl:
337
     int  0x40
335
     mcall
338
   nowp:
336
   nowp:
Line 339... Line 337...
339
 
337
 
Line 340... Line 338...
340
     popa
338
     popa
Line 463... Line 461...
463
     add  ebx,8
461
     add  ebx,8
464
     mov  ecx,[boardy]
462
     mov  ecx,[boardy]
465
     shl  ecx,16
463
     shl  ecx,16
466
     add  ecx,46*8
464
     add  ecx,46*8
467
     mov  edx,[wcolor]
465
     mov  edx,[wcolor]
468
     int  0x40
466
     mcall
Line 469... Line 467...
469
 
467
 
470
     mov  eax,4 		   ; numbers at left
468
     mov  eax,4 		   ; numbers at left
471
     mov  ebx,[boardx]
469
     mov  ebx,[boardx]
472
     sub  ebx,14
470
     sub  ebx,14
Line 475... Line 473...
475
     add  ebx,18
473
     add  ebx,18
476
     mov  ecx,[tcolor]
474
     mov  ecx,[tcolor]
477
     mov  edx,chess_board+80+5
475
     mov  edx,chess_board+80+5
478
     mov  esi,3
476
     mov  esi,3
479
    db1:
477
    db1:
480
     int  0x40
478
     mcall
481
     add  edx,80*2
479
     add  edx,80*2
482
     add  ebx,[boardxs]
480
     add  ebx,[boardxs]
483
     cmp  edx,chess_board+80*16
481
     cmp  edx,chess_board+80*16
484
     jb   db1
482
     jb   db1
Line 492... Line 490...
492
     add  ecx,[boardy]
490
     add  ecx,[boardy]
493
     add  ecx,8
491
     add  ecx,8
494
     shl  ecx,16
492
     shl  ecx,16
495
     add  ecx,10
493
     add  ecx,10
496
     mov  edx,[wcolor]
494
     mov  edx,[wcolor]
497
     int  0x40
495
     mcall
Line 498... Line 496...
498
 
496
 
499
     mov  eax,4 		   ; letters at bottom
497
     mov  eax,4 		   ; letters at bottom
500
     mov  ebx,[boardx]
498
     mov  ebx,[boardx]
501
     add  ebx,3
499
     add  ebx,3
Line 506... Line 504...
506
     add  ebx,8
504
     add  ebx,8
507
     mov  ecx,[tcolor]
505
     mov  ecx,[tcolor]
508
     mov  edx,chess_board+80*17+8
506
     mov  edx,chess_board+80*17+8
509
     mov  esi,4
507
     mov  esi,4
510
   db3:
508
   db3:
511
     int  0x40
509
     mcall
512
     mov  edi,[boardxs]
510
     mov  edi,[boardxs]
513
     shl  edi,16
511
     shl  edi,16
514
     add  ebx,edi
512
     add  ebx,edi
515
     add  edx,4
513
     add  edx,4
516
     cmp  edx,chess_board+80*17+8+4*8
514
     cmp  edx,chess_board+80*17+8+4*8
Line 528... Line 526...
528
     mov  ebx,(conx)*65536+100
526
     mov  ebx,(conx)*65536+100
529
     mov  ecx,edi
527
     mov  ecx,edi
530
     shl  ecx,16
528
     shl  ecx,16
531
     add  ecx,10
529
     add  ecx,10
532
     mov  edx,[wcolor]
530
     mov  edx,[wcolor]
533
     int  0x40
531
     mcall
Line 534... Line 532...
534
 
532
 
535
     mov  eax,4
533
     mov  eax,4
536
     mov  ebx,(conx)*65536
534
     mov  ebx,(conx)*65536
537
     add  ebx,edi
535
     add  ebx,edi
538
     mov  ecx,[tcolor]
536
     mov  ecx,[tcolor]
539
     mov  edx,chess_board+80*7+59-1
537
     mov  edx,chess_board+80*7+59-1
540
     mov  esi,20
538
     mov  esi,20
Line 541... Line 539...
541
     int  0x40
539
     mcall
542
 
540
 
543
     mov  edi,74
541
     mov  edi,74
544
     cmp  [chess_board+80+5],byte '1'
542
     cmp  [chess_board+80+5],byte '1'
Line 550... Line 548...
550
     mov  ebx,(conx)*65536+100
548
     mov  ebx,(conx)*65536+100
551
     mov  ecx,edi
549
     mov  ecx,edi
552
     shl  ecx,16
550
     shl  ecx,16
553
     add  ecx,10
551
     add  ecx,10
554
     mov  edx,[wcolor]
552
     mov  edx,[wcolor]
555
     int  0x40
553
     mcall
Line 556... Line 554...
556
 
554
 
557
     mov  eax,4
555
     mov  eax,4
558
     mov  ebx,(conx)*65536
556
     mov  ebx,(conx)*65536
559
     add  ebx,edi
557
     add  ebx,edi
560
     mov  ecx,[tcolor]
558
     mov  ecx,[tcolor]
561
     mov  edx,chess_board+80*9+59-1
559
     mov  edx,chess_board+80*9+59-1
562
     mov  esi,20
560
     mov  esi,20
Line 563... Line 561...
563
     int  0x40
561
     mcall
Line 564... Line 562...
564
 
562
 
565
     ; move #
563
     ; move #
566
 
564
 
567
     mov  eax,13
565
     mov  eax,13
568
     mov  ebx,conx*65536+120
566
     mov  ebx,conx*65536+120
Line 569... Line 567...
569
     mov  ecx,200*65536+10
567
     mov  ecx,200*65536+10
570
     mov  edx,[wcolor]
568
     mov  edx,[wcolor]
571
     int  0x40
569
     mcall
572
 
570
 
573
     mov  eax,4
571
     mov  eax,4
574
     mov  ebx,conx*65536
572
     mov  ebx,conx*65536
575
     add  ebx,200
573
     add  ebx,200
Line 576... Line 574...
576
     mov  ecx,[tcolor]
574
     mov  ecx,[tcolor]
Line 577... Line 575...
577
     mov  edx,chess_board+80*1+46
575
     mov  edx,chess_board+80*1+46
Line 619... Line 617...
619
    mov     edx, 3
617
    mov     edx, 3
620
    mov     eax,53
618
    mov     eax,53
621
    mov     ebx,7
619
    mov     ebx,7
622
    mov     ecx,[socket]
620
    mov     ecx,[socket]
623
    mov     esi, telnetrep
621
    mov     esi, telnetrep
624
    int     0x40
622
    mcall
625
    ret
623
    ret
Line 626... Line 624...
626
 
624
 
627
hd001:
625
hd001:
628
    cmp  bl,13				; BEGINNING OF LINE
626
    cmp  bl,13				; BEGINNING OF LINE
Line 702... Line 700...
702
    call draw_window
700
    call draw_window
703
    jmp  still
701
    jmp  still
Line 704... Line 702...
704
 
702
 
705
  key:				; KEY
703
  key:				; KEY
706
    mov  eax,2			; send to modem
704
    mov  eax,2			; send to modem
Line 707... Line 705...
707
    int  0x40
705
    mcall
708
 
706
 
709
    mov     ebx, [socket_status]
707
    mov     ebx, [socket_status]
Line 741... Line 739...
741
 
739
 
Line 742... Line 740...
742
    jmp  still
740
    jmp  still
743
 
741
 
744
  button:			; BUTTON
742
  button:			; BUTTON
745
    mov  eax,17
743
    mov  eax,17
746
    int  0x40
744
    mcall
Line 747... Line 745...
747
    cmp  ah,1			; CLOSE PROGRAM
745
    cmp  ah,1			; CLOSE PROGRAM
748
    jne  noclose
746
    jne  noclose
749
 
747
 
750
    mov  eax,53
748
    mov  eax,53
Line 751... Line 749...
751
    mov  ebx,8
749
    mov  ebx,8
752
    mov  ecx,[socket]
750
    mov  ecx,[socket]
753
    int  0x40
751
    mcall
Line 754... Line 752...
754
 
752
 
755
     mov  eax,-1
753
     mov  eax,-1
Line 801... Line 799...
801
tm_000:
799
tm_000:
802
    mov     eax,53
800
    mov     eax,53
803
    mov     ebx,7
801
    mov     ebx,7
804
    mov     ecx,[socket]
802
    mov     ecx,[socket]
805
    mov     esi, tx_buff
803
    mov     esi, tx_buff
806
    int  0x40
804
    mcall
807
    pop     bx
805
    pop     bx
808
    mov     al, [echo]
806
    mov     al, [echo]
809
    cmp     al, 0
807
    cmp     al, 0
810
    je	    tm_001
808
    je	    tm_001
Line 830... Line 828...
830
 
828
 
831
disconnect:
829
disconnect:
832
    mov  eax,53
830
    mov  eax,53
833
    mov  ebx,8
831
    mov  ebx,8
834
    mov  ecx,[socket]
832
    mov  ecx,[socket]
835
    int  0x40
833
    mcall
Line 836... Line 834...
836
    ret
834
    ret
Line 845... Line 843...
845
getlp:
843
getlp:
846
 inc	 ecx
844
 inc	 ecx
847
 push ecx
845
 push ecx
848
 mov	 eax, 53
846
 mov	 eax, 53
849
 mov	 ebx, 9
847
 mov	 ebx, 9
850
 int	 0x40
848
 mcall
851
 pop	 ecx
849
 pop	 ecx
852
 cmp	 eax, 0   ; is this local port in use?
850
 cmp	 eax, 0   ; is this local port in use?
853
 jz  getlp	; yes - so try next
851
 jz  getlp	; yes - so try next
Line 854... Line 852...
854
 
852
 
Line 862... Line 860...
862
    shl     edx, 8
860
    shl     edx, 8
863
    mov     dl, [ip_address]
861
    mov     dl, [ip_address]
864
    mov     esi, edx
862
    mov     esi, edx
865
    movzx   edx, word [port]	  ; telnet port id
863
    movzx   edx, word [port]	  ; telnet port id
866
    mov     edi,1      ; active open
864
    mov     edi,1      ; active open
867
    int     0x40
865
    mcall
868
    mov     [socket], eax
866
    mov     [socket], eax
Line 869... Line 867...
869
 
867
 
Line 870... Line 868...
870
    popa
868
    popa
Line 882... Line 880...
882
 
880
 
Line 883... Line 881...
883
    pusha
881
    pusha
884
 
882
 
885
    mov  eax,12
883
    mov  eax,12
Line 886... Line 884...
886
    mov  ebx,1
884
    mov  ebx,1
887
    int  0x40
885
    mcall
Line 888... Line 886...
888
 
886
 
889
    mov  eax,14
887
    mov  eax,14
Line 890... Line 888...
890
    int  0x40
888
    mcall
Line 908... Line 906...
908
    mov  eax,0 		    ; DRAW WINDOW
906
    mov  eax,0 		    ; DRAW WINDOW
909
    mov  bx,550
907
    mov  bx,550
910
    mov  cx,470
908
    mov  cx,470
911
    mov  edx,[wcolor]
909
    mov  edx,[wcolor]
912
    add  edx,0x13000000
910
    add  edx,0x13000000
913
    mov  edi,header
911
    mov  edi,title
914
    int  0x40
912
    mcall
Line 915... Line 913...
915
 
913
 
Line 916... Line 914...
916
    call display_status
914
    call display_status
917
 
915
 
918
    mov  eax,8			   ; BUTTON 4: Connect
916
    mov  eax,8			   ; BUTTON 4: Connect
919
    mov  ebx,conx*65536+80
917
    mov  ebx,conx*65536+80
920
    mov  ecx,cony*65536+15
918
    mov  ecx,cony*65536+15
921
     mov  esi,[wbutton]
919
     mov  esi,[wbutton]
922
     mov  edx,4
920
     mov  edx,4
923
    int  0x40
921
    mcall
924
    mov  eax,4			   ; Button text
922
    mov  eax,4			   ; Button text
925
    mov  ebx,(conx+4)*65536+cony+4
923
    mov  ebx,(conx+4)*65536+cony+4
926
    mov  ecx,0xffffff
924
    mov  ecx,0xffffff
927
    mov  edx,cont
925
    mov  edx,cont
Line 928... Line 926...
928
    mov  esi,conlen-cont
926
    mov  esi,conlen-cont
929
    int  0x40
927
    mcall
930
 
928
 
931
 
929
 
932
    mov  eax,8			   ; BUTTON 5: disconnect
930
    mov  eax,8			   ; BUTTON 5: disconnect
933
    mov  ebx,dconx*65536+80
931
    mov  ebx,dconx*65536+80
934
    mov  ecx,dcony*65536+15
932
    mov  ecx,dcony*65536+15
935
    mov  edx,5
933
    mov  edx,5
936
     mov  esi,[wbutton]
934
     mov  esi,[wbutton]
937
     int  0x40
935
     mcall
938
    mov  eax,4			   ; Button text
936
    mov  eax,4			   ; Button text
939
    mov  ebx,(dconx+4)*65536+dcony+4
937
    mov  ebx,(dconx+4)*65536+dcony+4
Line 940... Line 938...
940
    mov  ecx,0x00ffffff
938
    mov  ecx,0x00ffffff
941
    mov  edx,dist
939
    mov  edx,dist
942
    mov  esi,dislen-dist
940
    mov  esi,dislen-dist
Line 965... Line 963...
965
    mov  edx,quick_start
963
    mov  edx,quick_start
966
    mov  esi,30
964
    mov  esi,30
Line 967... Line 965...
967
 
965
 
Line 968... Line 966...
968
  prqs:
966
  prqs:
969
 
967
 
970
    int  0x40
968
    mcall
971
    add  ebx,10
969
    add  ebx,10
972
    add  edx,30
970
    add  edx,30
Line 973... Line 971...
973
    cmp  [edx],byte 'x'
971
    cmp  [edx],byte 'x'
974
    jne  prqs
972
    jne  prqs
975
 
973
 
Line 976... Line 974...
976
    mov  eax,12
974
    mov  eax,12
Line 977... Line 975...
977
    mov  ebx,2
975
    mov  ebx,2
Line 989... Line 987...
989
    ; draw status bar
987
    ; draw status bar
990
    mov  eax, 13
988
    mov  eax, 13
991
    mov  ebx, statusx*65536+80
989
    mov  ebx, statusx*65536+80
992
    mov  ecx, statusy*65536 + 16
990
    mov  ecx, statusy*65536 + 16
993
    mov  edx, [wcolor]
991
    mov  edx, [wcolor]
994
    int  0x40
992
    mcall
Line 995... Line 993...
995
 
993
 
996
    mov  esi,contlen-contt	    ; display connected status
994
    mov  esi,contlen-contt	    ; display connected status
997
    mov  edx, contt
995
    mov  edx, contt
998
    mov  eax, [socket_status]
996
    mov  eax, [socket_status]
Line 1002... Line 1000...
1002
    mov  edx, discontt
1000
    mov  edx, discontt
1003
  pcon:
1001
  pcon:
1004
    mov  eax,4			   ; status text
1002
    mov  eax,4			   ; status text
1005
    mov  ebx,statusx*65536+statusy+2
1003
    mov  ebx,statusx*65536+statusy+2
1006
     mov  ecx,[tcolor]
1004
     mov  ecx,[tcolor]
1007
     int  0x40
1005
     mcall
Line 1008... Line 1006...
1008
 
1006
 
1009
    popa
1007
    popa
Line 1064... Line 1062...
1064
 
1062
 
1065
    mov  eax,13
1063
    mov  eax,13
1066
    mov  ebx,10*65536+532
1064
    mov  ebx,10*65536+532
1067
    mov  ecx,420*65536+40
1065
    mov  ecx,420*65536+40
1068
     mov  edx,[wtcom]
1066
     mov  edx,[wtcom]
Line 1069... Line 1067...
1069
     int  0x40
1067
     mcall
1070
 
1068
 
1071
    mov  eax,4
1069
    mov  eax,4
1072
    mov  ebx,10*65536+420
1070
    mov  ebx,10*65536+420
1073
     mov  ecx,[wtxt]
1071
     mov  ecx,[wtxt]
Line 1074... Line 1072...
1074
     mov  edx,texts
1072
     mov  edx,texts
Line 1075... Line 1073...
1075
    mov  esi,80
1073
    mov  esi,80
1076
 
1074
 
1077
  dtl3:
1075
  dtl3:
1078
 
1076
 
1079
    int  0x40
1077
    mcall
Line 1115... Line 1113...
1115
    call print_text
1113
    call print_text
Line 1116... Line 1114...
1116
 
1114
 
1117
    mov  edi,string
1115
    mov  edi,string
1118
  f11:
1116
  f11:
1119
    mov  eax,10
1117
    mov  eax,10
1120
    int  0x40
1118
    mcall
1121
    cmp  eax,2
1119
    cmp  eax,2
1122
    jne  read_done
1120
    jne  read_done
1123
    mov  eax,2
1121
    mov  eax,2
1124
    int  0x40
1122
    mcall
1125
    shr  eax,8
1123
    shr  eax,8
1126
    cmp  eax,13
1124
    cmp  eax,13
1127
    je	 read_done
1125
    je	 read_done
1128
    cmp  eax,8
1126
    cmp  eax,8
Line 1167... Line 1165...
1167
    imul bx,6
1165
    imul bx,6
1168
    mov  ecx,[string_y]
1166
    mov  ecx,[string_y]
1169
    shl  ecx,16
1167
    shl  ecx,16
1170
    mov  cx,8
1168
    mov  cx,8
1171
    mov  edx,[wcolor]
1169
    mov  edx,[wcolor]
1172
    int  0x40
1170
    mcall
Line 1173... Line 1171...
1173
 
1171
 
1174
    mov  eax,4
1172
    mov  eax,4
1175
    mov  ebx,[string_x]
1173
    mov  ebx,[string_x]
1176
    shl  ebx,16
1174
    shl  ebx,16
1177
    add  ebx,[string_y]
1175
    add  ebx,[string_y]
1178
    mov  ecx,[tcolor]
1176
    mov  ecx,[tcolor]
1179
    mov  edx,string
1177
    mov  edx,string
1180
    mov  esi,[string_length]
1178
    mov  esi,[string_length]
Line 1181... Line 1179...
1181
    int  0x40
1179
    mcall
1182
 
1180
 
Line 1216... Line 1214...
1216
tcolor		dd  0x000000
1214
tcolor		dd  0x000000
Line 1217... Line 1215...
1217
 
1215
 
1218
sq_black	dd  0x336688 ; 666666
1216
sq_black	dd  0x336688 ; 666666
Line 1219... Line 1217...
1219
sq_white	dd  0xffffff
1217
sq_white	dd  0xffffff
Line 1220... Line 1218...
1220
 
1218
 
1221
header		db  appname,version,0
1219
title		db  appname,version,0
1222
 
1220
 
1223
setipt		db  '               .   .   .'
1221
setipt		db  '               .   .   .'