Subversion Repositories Kolibri OS

Rev

Rev 7683 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7683 Rev 8591
Line 131... Line 131...
131
 
131
 
132
start:
132
start:
133
        ; initialize process heap
133
        ; initialize process heap
Line -... Line 134...
-
 
134
        mcall   68, 11
-
 
135
 
134
        mcall   68, 11
136
        call	init_cmd_hist_buffer
135
 
137
 
136
        push    eax
138
        push    eax
137
        fstcw   word [esp]
139
        fstcw   word [esp]
138
        pop     eax
140
        pop     eax
Line 208... Line 210...
208
        call    draw_fpu_regs
210
        call    draw_fpu_regs
209
.draw_label:
211
.draw_label:
210
        pop     edx
212
        pop     edx
211
        mov     edx, [btn2_tab+edx*4]
213
        mov     edx, [btn2_tab+edx*4]
212
        mov     edi, COLOR_BG_NORMAL
214
        mov     edi, COLOR_BG_NORMAL
213
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
215
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
214
        mov     esi, 7
216
        mov     esi, 7
215
        mov     ebx, [registers_x_pos_dd]
217
        mov     ebx, [registers_x_pos_dd]
216
        add     ebx, 4*10000h+REGISTERS_Y_POS
218
        add     ebx, 4*10000h+REGISTERS_Y_POS
217
        mcall   4
219
        mcall   4
218
        jmp     waitevent
220
        jmp     waitevent
Line 249... Line 251...
249
        jz      .up
251
        jz      .up
250
        cmp     ah, 0x41
252
        cmp     ah, 0x41
251
        jz      F7
253
        jz      F7
252
        cmp     ah, 0x42
254
        cmp     ah, 0x42
253
        jz      F8
255
        jz      F8
-
 
256
        mov	[cmd_hist_buffer.tmp_line_flag], 0
254
        cmp     [cmdline_len], CMD_WIDTH
257
        cmp     [cmdline_len], CMD_WIDTH
255
        jae     waitevent
258
        jae     waitevent
256
        push    eax
259
        push    eax
257
        call    clear_cmdline_end
260
        call    clear_cmdline_end
258
        pop     eax
261
        pop     eax
Line 267... Line 270...
267
        stosb
270
        stosb
268
        inc     [cmdline_len]
271
        inc     [cmdline_len]
269
        call    draw_cmdline_end
272
        call    draw_cmdline_end
270
        inc     [cmdline_pos]
273
        inc     [cmdline_pos]
271
        call    draw_cursor
274
        call    draw_cursor
-
 
275
 
272
        jmp     waitevent
276
        jmp     waitevent
Line 273... Line 277...
273
 
277
 
-
 
278
    .backspace:
274
    .backspace:
279
	mov	[cmd_hist_buffer.tmp_line_flag], 0
275
        cmp     [cmdline_pos], 0
280
        cmp     [cmdline_pos], 0
276
        jz      waitevent
281
        jz      waitevent
Line 277... Line 282...
277
        dec     [cmdline_pos]
282
        dec     [cmdline_pos]
-
 
283
 
278
 
284
    .delchar:
279
    .delchar:
285
	mov	[cmd_hist_buffer.tmp_line_flag], 0
280
        call    clear_cmdline_end
286
        call    clear_cmdline_end
281
        mov     edi, [cmdline_pos]
287
        mov     edi, [cmdline_pos]
282
        dec     [cmdline_len]
288
        dec     [cmdline_len]
Line 323... Line 329...
323
        mov     eax, [cmdline_len]
329
        mov     eax, [cmdline_len]
324
        mov     [cmdline_pos], eax
330
        mov     [cmdline_pos], eax
325
        call    draw_cursor
331
        call    draw_cursor
Line 326... Line 332...
326
 
332
 
-
 
333
	.up:
-
 
334
		xor	edx, edx
-
 
335
		jmp	.hist
327
    .up:
336
 
-
 
337
	.down:
-
 
338
		xor	edx, edx
-
 
339
		inc	edx
-
 
340
 
-
 
341
	.hist:
-
 
342
		cmp	[cmd_hist_buffer.tmp_line_flag], 1
-
 
343
		je	@f
-
 
344
		mov	eax, cmdline
-
 
345
		mov	ecx, [cmdline_len]
-
 
346
		mov	byte [eax + ecx], 0
-
 
347
		call	add_cmd_hist_tmp_line
-
 
348
 
-
 
349
	@@:
-
 
350
		test	edx, edx
-
 
351
		jnz	.hist.next
-
 
352
		cmp	[cmd_hist_buffer.n_flag], 0
-
 
353
		jne	@f
-
 
354
		call	get_cmd_hist_line
-
 
355
		inc	[cmd_hist_buffer.n_flag]
-
 
356
		jmp	.hist.cp_line
-
 
357
 
-
 
358
	@@:
-
 
359
		call	prev_cmd_hist_line
-
 
360
		jc	waitevent
-
 
361
		call	get_cmd_hist_line
-
 
362
		inc	[cmd_hist_buffer.n_flag]
-
 
363
		jmp	.hist.cp_line
-
 
364
 
-
 
365
	.hist.next:
-
 
366
		cmp	[cmd_hist_buffer.n_flag], 0
-
 
367
		je	waitevent
-
 
368
 
-
 
369
		call	next_cmd_hist_line
-
 
370
		call	get_cmd_hist_line
-
 
371
		jnc	.hist.cp_line
-
 
372
		call	get_cmd_hist_tmp_line
-
 
373
		mov	[cmd_hist_buffer.tmp_line_flag], 0
-
 
374
		mov	[cmd_hist_buffer.n_flag], 0
-
 
375
 
-
 
376
	.hist.cp_line:
-
 
377
 
-
 
378
		mov	esi, eax
-
 
379
		mov	edi, cmdline
-
 
380
		xor	ecx, ecx
-
 
381
 
-
 
382
	@@:
-
 
383
		inc	ecx
-
 
384
		lodsb
-
 
385
		stosb
-
 
386
		test	al, al
-
 
387
		jnz	@b
-
 
388
 
-
 
389
		dec	ecx
-
 
390
		mov	[cmdline_pos], 0
-
 
391
		call    clear_cmdline_end
-
 
392
		mov	[cmdline_len], ecx
-
 
393
		mov	[cmdline_pos], ecx
-
 
394
		call	draw_cmdline
-
 
395
		call    draw_cursor
328
    .down:
396
 
Line 329... Line 397...
329
        jmp     waitevent
397
		jmp     waitevent
330
 
398
 
331
        ; We also trying to execute previous command, if empty command_line
399
        ; We also trying to execute previous command, if empty command_line
Line 344... Line 412...
344
    .exec_cur:
412
    .exec_cur:
345
        mov     esi, cmdline
413
        mov     esi, cmdline
Line 346... Line 414...
346
 
414
 
347
    .exec:
415
    .exec:
-
 
416
        mov     byte [esi+ecx], 0
-
 
417
 
-
 
418
        mov	eax, esi
-
 
419
        call	add_cmd_hist_line
-
 
420
        mov	[cmd_hist_buffer.n_flag], 0
348
        mov     byte [esi+ecx], 0
421
 
349
        and     [cmdline_pos], 0
422
        and     [cmdline_pos], 0
350
        push    esi
423
        push    esi
351
        call    clear_cmdline_end
424
        call    clear_cmdline_end
352
        call    draw_cursor
425
        call    draw_cursor
Line 436... Line 509...
436
 
509
 
437
;-----------------------------------------------------------------------------
510
;-----------------------------------------------------------------------------
Line 438... Line 511...
438
;                            Cmdline handling
511
;                            Cmdline handling
-
 
512
 
-
 
513
clear_cmdline_end:
439
 
514
	pusha
440
clear_cmdline_end:
515
 
441
        mov     ebx, [cmdline_pos]
516
        mov     ebx, [cmdline_pos]
442
        mov     ecx, [cmdline_len]
517
        mov     ecx, [cmdline_len]
443
        sub     ecx, ebx
518
        sub     ecx, ebx
Line 450... Line 525...
450
        mov     ecx, [cmdline_y_pos_dd]
525
        mov     ecx, [cmdline_y_pos_dd]
451
        mov     cx, CMD_Y_SIZE
526
        mov     cx, CMD_Y_SIZE
452
        mov     edx, COLOR_BG_NORMAL
527
        mov     edx, COLOR_BG_NORMAL
453
        ; draw container rectangle/box for cmdline
528
        ; draw container rectangle/box for cmdline
454
        mcall   13
529
        mcall   13
-
 
530
 
-
 
531
        popa
455
        ret
532
        ret
Line 456... Line 533...
456
 
533
 
457
draw_cmdline:
534
draw_cmdline:
458
        xor     ebx, ebx
535
        xor     ebx, ebx
Line 464... Line 541...
464
 
541
 
465
    @@:
542
    @@:
466
        mov     esi, [cmdline_len]
543
        mov     esi, [cmdline_len]
Line 467... Line 544...
467
        sub     esi, ebx
544
        sub     esi, ebx
468
 
545
 
469
        mov     ecx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
546
        mov     ecx, (FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
470
        lea     edx, [cmdline+ebx]
547
        lea     edx, [cmdline+ebx]
471
        imul    ebx, FONT_X_SIZE
548
        imul    ebx, FONT_X_SIZE
472
        add     ebx, CMD_X_POS
549
        add     ebx, CMD_X_POS
Line 585... Line 662...
585
        mov     cx, MSG_Y_SIZE
662
        mov     cx, MSG_Y_SIZE
586
        mcall   13, , , COLOR_BG_NORMAL
663
        mcall   13, , , COLOR_BG_NORMAL
587
        mov     edx, messages
664
        mov     edx, messages
588
        push    MSG_WIDTH
665
        push    MSG_WIDTH
589
        pop     esi
666
        pop     esi
590
        mov     ecx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
667
        mov     ecx, (FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
591
        mov     ebx, MSG_X_POS*10000h
668
        mov     ebx, MSG_X_POS*10000h
592
        mov     bx, word[messages_y_pos_dd+4]
669
        mov     bx, word[messages_y_pos_dd+4]
Line 593... Line 670...
593
 
670
 
594
    @@:
671
    @@:
Line 603... Line 680...
603
;-----------------------------------------------------------------------------
680
;-----------------------------------------------------------------------------
604
;                     Show/hide cursor in command line
681
;                     Show/hide cursor in command line
Line 605... Line 682...
605
 
682
 
606
; TODO: make it cursor.draw and cursor.hide ???
683
; TODO: make it cursor.draw and cursor.hide ???
-
 
684
draw_cursor:
-
 
685
	pusha
607
draw_cursor:
686
 
608
        mov     ecx, [cmdline_y_pos_dd+2]
687
        mov     ecx, [cmdline_y_pos_dd+2]
609
        add     cx, CMD_Y_SIZE-1
688
        add     cx, CMD_Y_SIZE-1
610
        mov     ebx, [cmdline_pos]
689
        mov     ebx, [cmdline_pos]
611
        imul    ebx, FONT_X_SIZE
690
        imul    ebx, FONT_X_SIZE
612
        add     ebx, CMD_X_POS
691
        add     ebx, CMD_X_POS
613
        mov     edx, ebx
692
        mov     edx, ebx
614
        shl     ebx, 16
693
        shl     ebx, 16
615
        or      ebx, edx
694
        or      ebx, edx
616
        mov     edx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
695
        mov     edx, (FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
617
        ; draw line
696
        ; draw line
-
 
697
        mcall   38
-
 
698
 
618
        mcall   38
699
        popa
Line 619... Line 700...
619
        ret
700
        ret
620
 
701
 
621
hide_cursor:
702
hide_cursor:
Line 631... Line 712...
631
        mcall   13
712
        mcall   13
632
        mov     ebx, [cmdline_pos]
713
        mov     ebx, [cmdline_pos]
633
        cmp     ebx, [cmdline_len]
714
        cmp     ebx, [cmdline_len]
634
        jae     .ret
715
        jae     .ret
635
        ; setting up text color scheme and attributes
716
        ; setting up text color scheme and attributes
636
        mov     ecx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
717
        mov     ecx, (FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
637
        lea     edx, [cmdline+ebx]
718
        lea     edx, [cmdline+ebx]
638
        imul    ebx, FONT_X_SIZE
719
        imul    ebx, FONT_X_SIZE
639
        add     ebx, CMD_X_POS
720
        add     ebx, CMD_X_POS
640
        shl     ebx, 16
721
        shl     ebx, 16
641
        mov     bx, word[cmdline_y_pos_dd+4]
722
        mov     bx, word[cmdline_y_pos_dd+4]
Line 684... Line 765...
684
        ; draw line with COLOR_LINE (in edx)
765
        ; draw line with COLOR_LINE (in edx)
685
        mcall
766
        mcall
686
        mov     al, 4
767
        mov     al, 4
687
        mov     ebx, TITLE_X_POS*10000h+TITLE_Y_POS
768
        mov     ebx, TITLE_X_POS*10000h+TITLE_Y_POS
688
        ; setting up text color scheme and attributes
769
        ; setting up text color scheme and attributes
689
        mov     ecx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
770
        mov     ecx, (FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
690
        mov     edx, NoPrgLoaded_str
771
        mov     edx, NoPrgLoaded_str
691
        cmp     [debuggee_pid], 0
772
        cmp     [debuggee_pid], 0
692
        jz      @f
773
        jz      @f
693
        mov     edx, [prgname_ptr]
774
        mov     edx, [prgname_ptr]
Line 708... Line 789...
708
        mov     edx, aPaused
789
        mov     edx, aPaused
709
        dec     esi
790
        dec     esi
Line 710... Line 791...
710
 
791
 
711
    @@:
792
    @@:
712
        ; draw line with COLOR_LINE (in edx) in one case
793
        ; draw line with COLOR_LINE (in edx) in one case
713
        ; and draw text string with color (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL (in ecx) in another
794
        ; and draw text string with color (FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL (in ecx) in another
714
        mcall
795
        mcall
Line 715... Line 796...
715
        ret
796
        ret
716
 
797
 
Line 740... Line 821...
740
 
821
 
Line 741... Line 822...
741
        mov     ebp, ecx
822
        mov     ebp, ecx
Line 742... Line 823...
742
 
823
 
743
        mov     eax, [esi]
824
        mov     eax, [esi]
744
 
825
 
745
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
826
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
746
        cmp     [debuggee_pid], 0
827
        cmp     [debuggee_pid], 0
Line 747... Line 828...
747
        jz      .cd
828
        jz      .cd
748
        cmp     [bSuspended], 0
829
        cmp     [bSuspended], 0
749
        jz      .cd
830
        jz      .cd
750
 
831
 
751
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
832
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
752
        cmp     eax, dword [esi+oldcontext-context]
833
        cmp     eax, dword [esi+oldcontext-context]
Line 753... Line 834...
753
        je      .cd
834
        je      .cd
754
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_CHANGED or 0x40000000)
835
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_CHANGED or 0x40000000)
Line 1023... Line 1104...
1023
        shl     dx,4
1104
        shl     dx,4
1024
        loop    .w_exp
1105
        loop    .w_exp
Line 1025... Line 1106...
1025
 
1106
 
Line 1026... Line 1107...
1026
.display:
1107
.display:
1027
 
1108
 
1028
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1109
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1029
        cmp     [debuggee_pid], 0
1110
        cmp     [debuggee_pid], 0
1030
        jz      .do_label
1111
        jz      .do_label
Line 1031... Line 1112...
1031
        cmp     [bSuspended], 0
1112
        cmp     [bSuspended], 0
Line 1032... Line 1113...
1032
        jz      .do_label
1113
        jz      .do_label
1033
 
1114
 
1034
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
1115
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
Line 1044... Line 1125...
1044
        mov     ax, word [_st0+ebp+8]
1125
        mov     ax, word [_st0+ebp+8]
1045
        cmp     ax, word [_st0+(oldcontext-context)+ebp+8]
1126
        cmp     ax, word [_st0+(oldcontext-context)+ebp+8]
1046
        je      .do_label
1127
        je      .do_label
Line 1047... Line 1128...
1047
 
1128
 
1048
.scol:
1129
.scol:
Line 1049... Line 1130...
1049
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_CHANGED or 0x40000000)
1130
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_CHANGED or 0x40000000)
1050
 
1131
 
1051
.do_label:
1132
.do_label:
1052
        ; draw a text string in the window
1133
        ; draw a text string in the window
Line 1089... Line 1170...
1089
        call    .hex_2_str
1170
        call    .hex_2_str
1090
        mov     al, ' '
1171
        mov     al, ' '
1091
        stosb
1172
        stosb
1092
        call    .hex_2_str
1173
        call    .hex_2_str
Line 1093... Line 1174...
1093
 
1174
 
1094
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1175
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1095
        cmp     [debuggee_pid], 0
1176
        cmp     [debuggee_pid], 0
1096
        jz      .cd
1177
        jz      .cd
1097
        cmp     [bSuspended], 0
1178
        cmp     [bSuspended], 0
Line 1098... Line 1179...
1098
        jz      .cd
1179
        jz      .cd
Line 1099... Line 1180...
1099
 
1180
 
1100
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
1181
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
1101
 
1182
 
Line 1102... Line 1183...
1102
        mov     eax, dword [_mm0+ebp]
1183
        mov     eax, dword [_mm0+ebp]
1103
        cmp     eax, dword [_mm0+(oldcontext-context)+ebp]
1184
        cmp     eax, dword [_mm0+(oldcontext-context)+ebp]
1104
        jne     .scol
1185
        jne     .scol
Line 1105... Line 1186...
1105
 
1186
 
1106
        mov     eax, dword [_mm0+ebp+4]
1187
        mov     eax, dword [_mm0+ebp+4]
1107
        cmp     eax, dword [_mm0+(oldcontext-context)+ebp+4]
1188
        cmp     eax, dword [_mm0+(oldcontext-context)+ebp+4]
1108
        je     .cd
1189
        je     .cd
Line 1109... Line 1190...
1109
 
1190
 
1110
.scol:
1191
.scol:
Line 1198... Line 1279...
1198
 
1279
 
1199
    .on:
1280
    .on:
Line 1200... Line 1281...
1200
        and     byte [edx], not 20h
1281
        and     byte [edx], not 20h
1201
 
1282
 
1202
    .onoff:
1283
    .onoff:
1203
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1284
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1204
        cmp     [debuggee_pid], 0
1285
        cmp     [debuggee_pid], 0
1205
        jz      .doit
1286
        jz      .doit
Line 1206... Line 1287...
1206
        cmp     [bSuspended], 0
1287
        cmp     [bSuspended], 0
1207
        jz      .doit
1288
        jz      .doit
1208
 
1289
 
1209
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
1290
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
1210
        bt      [_eflags], edi
1291
        bt      [_eflags], edi
1211
        lahf
1292
        lahf
1212
        bt      dword [_eflags + oldcontext - context], edi
1293
        bt      dword [_eflags + oldcontext - context], edi
1213
        rcl     ah, 1
1294
        rcl     ah, 1
Line 1214... Line 1295...
1214
        test    ah, 3
1295
        test    ah, 3
1215
        jp      .doit
1296
        jp      .doit
1216
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_CHANGED or 0x40000000)
1297
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_CHANGED or 0x40000000)
1217
 
1298
 
Line 1228... Line 1309...
1228
;                      Draw registers frame title
1309
;                      Draw registers frame title
Line 1229... Line 1310...
1229
 
1310
 
1230
; Also show current register set (common + MMX, SSE or AVX)
1311
; Also show current register set (common + MMX, SSE or AVX)
1231
draw_reg_title:
1312
draw_reg_title:
1232
        mov     edi, COLOR_BG_NORMAL
1313
        mov     edi, COLOR_BG_NORMAL
1233
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
1314
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
1234
        mov     esi, 7
1315
        mov     esi, 7
1235
        cmp     [reg_mode], REG_MODE_CPU
1316
        cmp     [reg_mode], REG_MODE_CPU
1236
        jz      @f
1317
        jz      @f
1237
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1318
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1238
    @@:
1319
    @@:
1239
        movzx   edx, [fpu_mode]
1320
        movzx   edx, [fpu_mode]
Line 1240... Line 1321...
1240
        mov     edx, [btn2_tab+edx*4]
1321
        mov     edx, [btn2_tab+edx*4]
Line 1244... Line 1325...
1244
        add     ebx, 4*10000h+REGISTERS_Y_POS
1325
        add     ebx, 4*10000h+REGISTERS_Y_POS
1245
        mcall   4
1326
        mcall   4
Line 1246... Line 1327...
1246
 
1327
 
1247
        cmp     [reg_mode], REG_MODE_SSE
1328
        cmp     [reg_mode], REG_MODE_SSE
1248
        jz      @f
1329
        jz      @f
1249
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1330
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1250
    @@:
1331
    @@:
1251
        mov     edx, aSSE
1332
        mov     edx, aSSE
1252
        ; draw a text string in the window
1333
        ; draw a text string in the window
1253
        mov     ebx, [registers_x_pos_dd]
1334
        mov     ebx, [registers_x_pos_dd]
1254
        add     ebx, (7*FONT_X_SIZE+4)*10000h+REGISTERS_Y_POS
1335
        add     ebx, (7*FONT_X_SIZE+4)*10000h+REGISTERS_Y_POS
Line 1255... Line 1336...
1255
        mcall   4
1336
        mcall   4
1256
 
1337
 
1257
        cmp     [reg_mode], REG_MODE_AVX
1338
        cmp     [reg_mode], REG_MODE_AVX
1258
        jz      @f
1339
        jz      @f
1259
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1340
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1260
    @@:
1341
    @@:
1261
        mov     edx, aAVX
1342
        mov     edx, aAVX
1262
        ; draw a text string in the window
1343
        ; draw a text string in the window
Line 1322... Line 1403...
1322
        call    draw_mmx_regs
1403
        call    draw_mmx_regs
1323
        jmp     @f
1404
        jmp     @f
1324
  .fpu:
1405
  .fpu:
1325
        call    draw_fpu_regs
1406
        call    draw_fpu_regs
1326
    @@:
1407
    @@:
1327
        mov     ecx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE
1408
        mov     ecx, (0 and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE
1328
        cmp     [debuggee_pid], 0
1409
        cmp     [debuggee_pid], 0
1329
        jz      @f
1410
        jz      @f
1330
        cmp     [bSuspended], 0
1411
        cmp     [bSuspended], 0
1331
        jz      @f
1412
        jz      @f
1332
        mov     ecx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
1413
        mov     ecx, (0 and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
1333
    @@:
1414
    @@:
1334
        mov     edx, aColon
1415
        mov     edx, aColon
1335
        xor     esi, esi
1416
        xor     esi, esi
1336
        inc     esi
1417
        inc     esi
1337
        mov     ebx, [registers_x_pos_dd]
1418
        mov     ebx, [registers_x_pos_dd]
Line 1402... Line 1483...
1402
        ; addresses
1483
        ; addresses
1403
        mov     ebx, 80100h
1484
        mov     ebx, 80100h
1404
        mov     edx, DATA_X_POS*10000h + DUMP_Y_POS
1485
        mov     edx, DATA_X_POS*10000h + DUMP_Y_POS
1405
        mov     ecx, [dumppos]
1486
        mov     ecx, [dumppos]
1406
        mov     edi, COLOR_BG_NORMAL
1487
        mov     edi, COLOR_BG_NORMAL
1407
        mov     esi, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1488
        mov     esi, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
1408
        cmp     [debuggee_pid], 0
1489
        cmp     [debuggee_pid], 0
1409
        jz      @f
1490
        jz      @f
1410
        cmp     [bSuspended], 0
1491
        cmp     [bSuspended], 0
1411
        jz      @f
1492
        jz      @f
1412
        mov     esi, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
1493
        mov     esi, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
1413
    @@:
1494
    @@:
1414
        ; draw a number in the window
1495
        ; draw a number in the window
1415
        mcall   47
1496
        mcall   47
1416
        add     ecx, 10h
1497
        add     ecx, 10h
1417
        add     edx, FONT_Y_SIZE + TEXT_Y_CLEARANCE
1498
        add     edx, FONT_Y_SIZE + TEXT_Y_CLEARANCE
Line 1539... Line 1620...
1539
        mov     ebx, [disasm_cur_str]
1620
        mov     ebx, [disasm_cur_str]
1540
        imul    ebx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE)
1621
        imul    ebx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE)
1541
        push    ebx
1622
        push    ebx
1542
        lea     ecx, [ebx+DISASM_Y_POS-1]
1623
        lea     ecx, [ebx+DISASM_Y_POS-1]
1543
        shl     ecx, 16
1624
        shl     ecx, 16
1544
        mov     cl, 11
1625
        mov     cl, FONT_Y_SIZE+TEXT_Y_CLEARANCE
1545
        ; setting up background color for disassembled text
1626
        ; setting up background color for disassembled text
1546
        mov     edx, COLOR_BG_NORMAL
1627
        mov     edx, COLOR_BG_NORMAL
1547
        ; draw container rectangle/box with color COLOR_BG_NORMAL (was 0xFFFFFF - white)
1628
        ; draw container rectangle/box with color COLOR_BG_NORMAL (was 0xFFFFFF - white)
1548
        mov     ebx, [data_x_size_dd+4]
1629
        mov     ebx, [data_x_size_dd+4]
1549
        add     ebx, DATA_X_POS*10000h
1630
        add     ebx, DATA_X_POS*10000h
Line 1560... Line 1641...
1560
        jnz     @b
1641
        jnz     @b
1561
        mov     byte [esi-1], ':'
1642
        mov     byte [esi-1], ':'
1562
        sub     esi, edx
1643
        sub     esi, edx
1563
        ; normal color
1644
        ; normal color
1564
        ; was 0x40000000
1645
        ; was 0x40000000
1565
        mov     ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_LABEL or 0x40000000)
1646
        mov     ecx, ((FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_LABEL or 0x40000000)
1566
        mov     al, 4
1647
        mov     al, 4
1567
        ; draw a text string in the window with color COLOR_TXT_NORMAL in ecx
1648
        ; draw a text string in the window with color COLOR_TXT_NORMAL in ecx
1568
        mcall
1649
        mcall
1569
        mov     byte [esi+edx-1], 0
1650
        mov     byte [esi+edx-1], 0
1570
        lea     esi, [esi*3]
1651
;         lea     esi, [esi*3]
1571
        movzx   ecx, bx
1652
;         movzx   ecx, bx
1572
        shr     ebx, 16
1653
;         shr     ebx, 16
1573
        lea     ebx, [ebx+esi*2]
1654
;         lea     ebx, [ebx+esi*2]
1574
        shl     ecx, 16
1655
;         shl     ecx, 16
1575
        mov     cl, 10
1656
;         mov     cl, 10
1576
        imul    ebx, 10001h
1657
;         imul    ebx, 10001h
1577
        sub     bx, DATA_X_POS
1658
;         sub     bx, DATA_X_POS
1578
        sub     bx, word[data_x_size_dd+4]
1659
;         sub     bx, word[data_x_size_dd+4]
1579
        neg     bx
1660
;         neg     bx
1580
        mov     al, 13
1661
;         mov     al, 13
1581
        ; copy color value from edi
1662
;         copy color value from edi
1582
        mov     edx, edi
1663
;         mov     edx, edi
1583
        ; draw container rectangle/box for disassembled text, color in edx
1664
;         draw container rectangle/box for disassembled text, color in edx
1584
        mcall
1665
;         mcall
1585
        inc     [disasm_cur_str]
1666
        inc     [disasm_cur_str]
1586
        mov     eax, [disasm_height_dd]
1667
        mov     eax, [disasm_height_dd]
1587
        cmp     [disasm_cur_str], eax
1668
        cmp     [disasm_cur_str], eax
1588
        jae     .loopend
1669
        jae     .loopend
Line 1591... Line 1672...
1591
        push    [disasm_cur_pos]
1672
        push    [disasm_cur_pos]
1592
        call    disasm_instr
1673
        call    disasm_instr
1593
        pop     ebp
1674
        pop     ebp
1594
        jc      .loopend
1675
        jc      .loopend
1595
        mov     edx, COLOR_BG_NORMAL
1676
        mov     edx, COLOR_BG_NORMAL
1596
        mov     esi, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
1677
        mov     esi, (FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
1597
        mov     ebx, DATA_X_POS*10000h
1678
        mov     ebx, DATA_X_POS*10000h
1598
        add     ebx, [data_x_size_dd+4]
1679
        add     ebx, [data_x_size_dd+4]
1599
        mov     ecx, [disasm_cur_str]
1680
        mov     ecx, [disasm_cur_str]
1600
        imul    ecx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE)*10000h
1681
        imul    ecx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE)*10000h
1601
        add     ecx, (DISASM_Y_POS-1)*10000h + (FONT_Y_SIZE+TEXT_Y_CLEARANCE)
1682
        add     ecx, (DISASM_Y_POS-1)*10000h + (FONT_Y_SIZE+TEXT_Y_CLEARANCE)
Line 1603... Line 1684...
1603
        pushad
1684
        pushad
1604
        call    find_enabled_breakpoint
1685
        call    find_enabled_breakpoint
1605
        popad
1686
        popad
1606
        jnz     .nobp
1687
        jnz     .nobp
1607
        mov     edx, COLOR_BG_BREAKPOINT
1688
        mov     edx, COLOR_BG_BREAKPOINT
1608
        mov     esi, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_BREAKPOINT
1689
        mov     esi, (FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_BREAKPOINT
1609
    .nobp:
1690
    .nobp:
Line 1610... Line 1691...
1610
 
1691
 
1611
        mov     eax, [_eip]
1692
        mov     eax, [_eip]
1612
        cmp     eax, ebp
1693
        cmp     eax, ebp
1613
        jnz     .notcurrent
1694
        jnz     .notcurrent
1614
        mov     edx, COLOR_BG_SELECTED
1695
        mov     edx, COLOR_BG_SELECTED
1615
        mov     esi, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_SELECTED
1696
        mov     esi, (FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_SELECTED
1616
    .notcurrent:
1697
    .notcurrent:
Line 1617... Line 1698...
1617
        push    esi     ; Save color value for disassembled text
1698
        push    esi     ; Save color value for disassembled text
1618
 
1699
 
Line 1638... Line 1719...
1638
        lea     edx, [ebx+2*FONT_X_SIZE*10000h]
1719
        lea     edx, [ebx+2*FONT_X_SIZE*10000h]
1639
        mov     ecx, ebp
1720
        mov     ecx, ebp
1640
        sub     ecx, [disasm_start_pos]
1721
        sub     ecx, [disasm_start_pos]
1641
        add     ecx, disasm_buffer
1722
        add     ecx, disasm_buffer
Line 1642... Line 1723...
1642
 
1723
 
1643
        mov     esi, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_HEX
1724
        mov     esi, (FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_HEX
1644
        mov     eax, [_eip]
1725
        mov     eax, [_eip]
1645
        cmp     eax, ebp
1726
        cmp     eax, ebp
1646
        jnz     @f
1727
        jnz     @f
1647
        mov     esi, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_SELECTED
1728
        mov     esi, (FONT) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_SELECTED
1648
  @@:
1729
  @@:
1649
    .drawhex:
1730
    .drawhex:
1650
        ; draw a number in the window, color in esi
1731
        ; draw a number in the window, color in esi
1651
        mcall   47, 20101h
1732
        mcall   47, 20101h
Line 1934... Line 2015...
1934
        ; end of window redraw
2015
        ; end of window redraw
1935
        mcall   12, 2
2016
        mcall   12, 2
1936
        ret
2017
        ret
Line 1937... Line 2018...
1937
 
2018
 
1938
; vim: ft=fasm tabstop=4
-