Fresh IDE . Diff
Not logged in

This repository is a mirror!

The original is located on: https://fresh.flatassembler.net/fossil/repo/fresh
If you want to follow the project, please update your remote-url

Differences From Artifact [74bc8e3944]:

To Artifact [45eb87184e]:


239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
        mov     ecx, [esi+DRAWITEMSTRUCT.rcItem.right]
        mov     [.rectL.left], eax
        mov     [.rectL.right], ecx
        mov     [.rectR.left], ecx
        mov     [.rectR.right], ecx

        sub     ecx, eax
        shr     ecx, 2          ; 1/4 of the field for the value.
        sub     [.rectL.right], ecx
        sub     [.rectR.left], ecx

        mov     eax, [esi+DRAWITEMSTRUCT.rcItem.top]
        mov     ecx, [esi+DRAWITEMSTRUCT.rcItem.bottom]
        mov     [.rectL.top], eax
        mov     [.rectL.bottom], ecx







|







239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
        mov     ecx, [esi+DRAWITEMSTRUCT.rcItem.right]
        mov     [.rectL.left], eax
        mov     [.rectL.right], ecx
        mov     [.rectR.left], ecx
        mov     [.rectR.right], ecx

        sub     ecx, eax
        shr     ecx, 1          ; 1/2 of the field for the value.
        sub     [.rectL.right], ecx
        sub     [.rectR.left], ecx

        mov     eax, [esi+DRAWITEMSTRUCT.rcItem.top]
        mov     ecx, [esi+DRAWITEMSTRUCT.rcItem.bottom]
        mov     [.rectL.top], eax
        mov     [.rectL.bottom], ecx
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328



























































































































































































































329
330
331
332
333
334
335
        mov     edi, [eax+TArray.array + 4*edi]

        mov     eax, [edi+TLabel.iName]
        add     eax, [ptrNames]
        lea     ecx, [.rectL]
        invoke  DrawTextA, [esi+DRAWITEMSTRUCT.hDC], eax, -1, ecx, DT_SINGLELINE or DT_LEFT or DT_VCENTER or DT_END_ELLIPSIS

  cNotDefined text 'undefined'
  cVirtual    text 'virtual'

; then write the value

        test    [edi+TLabel.flags], lfDefined
        jz      .notdefined

        cmp     [edi+TLabel.SIBEx], 0
        jne     .virtual

        stdcall NumToStr, [edi+TLabel.ValueLo], ntsHex or ntsSigned
        jmp     .printvalue

.notdefined:
        stdcall StrDup, cNotDefined
        jmp     .printvalue

.virtual:
        stdcall StrDup, cVirtual

.printvalue:
        push    eax
        stdcall StrPtr, eax
        lea     ecx, [.rectR]
        invoke  DrawTextA, [esi+DRAWITEMSTRUCT.hDC], eax, -1, ecx, DT_SINGLELINE or DT_LEFT or DT_VCENTER
        stdcall StrDel ; from the stack.

.cleanup:
        invoke  DeleteObject, [.bkbrush]
        or      eax, -1
        clc
        return

endwp


































































































































































































































winproc CCListProc
begin







<
<
<


<
<
<
<
<
<
<
<
<
<
<
<
<
<
|

<















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







285
286
287
288
289
290
291



292
293














294
295

296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
        mov     edi, [eax+TArray.array + 4*edi]

        mov     eax, [edi+TLabel.iName]
        add     eax, [ptrNames]
        lea     ecx, [.rectL]
        invoke  DrawTextA, [esi+DRAWITEMSTRUCT.hDC], eax, -1, ecx, DT_SINGLELINE or DT_LEFT or DT_VCENTER or DT_END_ELLIPSIS




; then write the value















        stdcall SymbolToStr, edi


        push    eax
        stdcall StrPtr, eax
        lea     ecx, [.rectR]
        invoke  DrawTextA, [esi+DRAWITEMSTRUCT.hDC], eax, -1, ecx, DT_SINGLELINE or DT_LEFT or DT_VCENTER
        stdcall StrDel ; from the stack.

.cleanup:
        invoke  DeleteObject, [.bkbrush]
        or      eax, -1
        clc
        return

endwp



cVirtual    text 'virtual'


proc SymbolToStr, .ptrLabel
begin
        pushad
        mov     edi, [.ptrLabel]

        test    [edi+TLabel.flags], lfDefined
        jz      .notdefined

        stdcall StrNew
        mov     ebx, eax

        mov     cl, [edi+TLabel.DataSize]

        mov     eax, 'b '
        cmp     cl, 1
        je      .sz_ok

        mov     eax, 'w '
        cmp     cl, 2
        je      .sz_ok

        mov     eax, 'dw '
        cmp     cl, 4
        je      .sz_ok

        mov     eax, 'pw '
        cmp     cl, 6
        je      .sz_ok

        mov     eax, 'qw '
        cmp     cl, 8
        je      .sz_ok

        mov     eax, 'tw '
        cmp     cl, 10
        jne     .prefix_ok

.sz_ok:
        stdcall StrCharCat, ebx, eax

.prefix_ok:
; type:
        cmp     [edi+TLabel.type], ltAbsolute
        je      .type_ok

        stdcall StrCharCat, ebx, 'r '

.type_ok:
; registers

        xor     edx, edx
        cmp     [edi+TLabel.SIBEx], 0
        je      .reg_ok2

        or      edx, 1                  ; close the bracket
        stdcall StrCharCat, ebx, '['

        movzx   eax, byte [edi+TLabel.SIBEx+2]
        cmp     eax, 1
        je      .mul_ok1
        test    eax, eax
        jz      .reg_ok1

        add     eax, '0'
        stdcall StrCharCat, ebx, eax
        stdcall StrCharCat, ebx, '*'
        or      edx, 2      ; at lease one register

.mul_ok1:
        movzx   eax, byte [edi+TLabel.SIBEx]
        test    eax, eax
        jz      .reg_ok1

        stdcall GetRegisterName, eax
        stdcall StrCharCat, ebx, eax
        or      edx, 2      ; at lease one register

.reg_ok1:
        movzx   eax, byte [edi+TLabel.SIBEx+3]
        cmp     eax, 1
        je      .mul_ok2
        test    eax, eax
        jz      .reg_ok2

        add     eax, '0'
        test    edx, 2
        jz      @f
        stdcall StrCharCat, ebx, '+'
@@:
        stdcall StrCharCat, ebx, eax
        stdcall StrCharCat, ebx, '*'

.mul_ok2:
        movzx   eax, byte [edi+TLabel.SIBEx+1]
        test    eax, eax
        jz      .reg_ok2

        stdcall GetRegisterName, eax
        stdcall StrCharCat, ebx, eax

.reg_ok2:
        mov     ecx, ntsHex or ntsUnsigned

        test    edx, 2   ; is there at least one register?
        jz      .add_number

        mov     eax, [edi+TLabel.ValueHi]
        test    eax, eax
        jns     .add_sign

        mov     ecx, ntsHex or ntsSigned
        jmp     .add_number

.add_sign:
        stdcall StrCharCat, ebx, '+'

.add_number:
        stdcall NumToStr64, [edi+TLabel.ValueLo], [edi+TLabel.ValueHi], ecx
        stdcall StrCharCat, eax, 'h'
        stdcall StrCat, ebx, eax
        stdcall StrDel, eax

        test    edx, 1
        jz      .value_ok

        stdcall StrCharCat, ebx, ']'

.value_ok:
        mov     eax, ebx
        jmp     .finish

.notdefined:
        stdcall StrDup, 'undefined'
        jmp     .finish

.finish:
        mov     [esp+4*regEAX], eax
        popad
        return
endp



proc GetRegisterName, .index
begin
        push    ecx

        mov     ecx, [.index]
        cmp     ecx, $f4
        je      .eip

        cmp     ecx, $f8
        je      .rip

        and     ecx, $0f

        mov     eax, [cSIBStrings+4*ecx]

        mov     ecx, [.index]
        shr     ecx, 4          ; 2, 4 or 8
        mov     ch,  byte [.index]
        and     ch, $0f

        cmp     cl, 2
        je      .finish

        cmp     cl, 4
        jne     .qword

;dword
        cmp     ch, 8
        jb      .e_prefix

        mov     ecx, 'd' shl 16
        cmp     ch, 10
        jb      @f
        shl     ecx, 8
@@:
        or      eax, ecx
        jmp     .finish

.e_prefix:
        shl     eax, 8
        mov     al, 'e'
        jmp     .finish

.qword:
        cmp     ch, 8
        jae     .finish

        shl     eax, 8
        mov     al, 'r'

.finish:
        pop     ecx
        return

.eip:
        mov     eax, 'eip'
        jmp     .finish

.rip:
        mov     eax, 'rip'
        jmp     .finish

endp


iglobal
  cSIBStrings dd 'ax',  'cx',  'dx',  'bx'
              dd 'sp',  'bp',  'si',  'di'
              dd 'r8',  'r9',  'r10', 'r11'
              dd 'r12', 'r13', 'r14', 'r15'

endg





winproc CCListProc
begin