Rev 8729 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8729 | Rev 8734 | ||
---|---|---|---|
Line 35... | Line 35... | ||
35 | mov eax, esi |
35 | mov eax, esi |
36 | mov ecx, GFX_COLS |
36 | mov ecx, GFX_COLS |
37 | div ecx ; eax = row index, edx = col index |
37 | div ecx ; eax = row index, edx = col index |
38 | mov dword [row_ind], eax |
38 | mov dword [row_ind], eax |
39 | mov dword [col_ind], edx |
39 | mov dword [col_ind], edx |
40 | mov dword [color], 0x80FFFFFF ; white |
40 | mov dword [color], COLOR_CELL ; white |
41 | cmp byte [esi + gfx], 0 ; check if cell is 0 or not 0 |
41 | cmp byte [esi + gfx], 0 ; check if cell is 0 or not 0 |
42 | jne @f |
42 | jne @f |
43 | mov dword [color], 0x80000000 ; black |
43 | mov dword [color], COLOR_BACK ; black |
44 | @@: |
44 | @@: |
45 | mov ebx, dword [col_ind] |
45 | mov ebx, dword [col_ind] |
46 | imul ebx, GFX_PIX_SIZE |
46 | imul ebx, GFX_PIX_SIZE ; now ebx - x coord of rect |
47 | ;add ebx, WINDOW_BORDER |
- | |
48 | shl ebx, 16 |
- | |
49 | add ebx, GFX_PIX_SIZE |
- | |
50 | - | ||
51 | mov ecx, dword [row_ind] |
47 | mov ecx, dword [row_ind] |
52 | imul ecx, GFX_PIX_SIZE |
48 | imul ecx, GFX_PIX_SIZE ; now ecx - y coord of rect |
53 | ;add ecx, WINDOW_BORDER |
- | |
54 | shl ecx, 16 |
- | |
55 | add ecx, GFX_PIX_SIZE |
- | |
56 | - | ||
57 | mov eax, 13 |
- | |
58 | mov edx, dword [color] |
49 | mov edx, dword [color] |
59 | int 0x40 |
50 | stdcall imgbuf_draw_rect, ebx, ecx, edx |
Line 60... | Line 51... | ||
60 | 51 | ||
61 | inc esi |
52 | inc esi |
Line 62... | Line 53... | ||
62 | jmp .loop1 |
53 | jmp .loop1 |
- | 54 | ||
63 | 55 | .loop1_end: |
|
64 | .loop1_end: |
56 | stdcall imgbuf_send_to_window |
65 | popad |
57 | popad |
66 | ret |
58 | ret |
- | 59 | endp |
|
- | 60 | ||
- | 61 | ; copy imgbuf contents to the emulator window |
|
- | 62 | align 4 |
|
- | 63 | proc imgbuf_send_to_window stdcall |
|
- | 64 | DEBUGF DBG_INFO, "sending to window...\n" |
|
- | 65 | push eax ebx ecx edx |
|
- | 66 | mov eax, 7 |
|
- | 67 | mov ebx, dword [imgbuf_ptr] |
|
- | 68 | mov ecx, IMGBUF_WIDTH |
|
- | 69 | shl ecx, 16 |
|
- | 70 | add ecx, IMGBUF_HEIGHT |
|
- | 71 | xor edx, edx |
|
- | 72 | int 0x40 |
|
- | 73 | pop edx ecx ebx eax |
|
- | 74 | ret |
|
- | 75 | endp |
|
- | 76 | ||
- | 77 | ||
- | 78 | ; in internal buffer draw rect filled with given color at position (rect_x, rect_y) within window |
|
- | 79 | align 4 |
|
- | 80 | proc imgbuf_draw_rect stdcall, rect_x: dword, rect_y: dword, rect_color: dword |
|
- | 81 | DEBUGF DBG_INFO, "imgbuf_draw_rect(%u, %u, %x)\n", [rect_x], [rect_y], [rect_color] |
|
- | 82 | push eax ebx ecx edx esi edi ebp |
|
- | 83 | ||
- | 84 | mov ebx, dword [rect_y] |
|
- | 85 | imul ebx, IMGBUF_WIDTH |
|
- | 86 | add ebx, dword [rect_x] ; now ebx - index of first pixel of rect |
|
- | 87 | ||
- | 88 | mov edi, dword [imgbuf_ptr] |
|
- | 89 | mov ebp, dword [rect_color] |
|
- | 90 | ||
- | 91 | xor ecx, ecx |
|
- | 92 | .for_i: |
|
- | 93 | cmp ecx, GFX_PIX_SIZE |
|
- | 94 | jae .ret |
|
- | 95 | ||
- | 96 | xor edx, edx |
|
- | 97 | .for_j: |
|
- | 98 | cmp edx, GFX_PIX_SIZE |
|
- | 99 | jae .for_j_end |
|
- | 100 | ||
- | 101 | mov esi, edx |
|
- | 102 | ||
- | 103 | add edx, ebx |
|
- | 104 | mov eax, ecx |
|
- | 105 | imul eax, IMGBUF_WIDTH |
|
- | 106 | add edx, eax ; now edx is index of edx'th pixel of ecx'th row of rect |
|
- | 107 | ||
- | 108 | lea edx, [edx*3] |
|
- | 109 | add edx, edi |
|
- | 110 | ||
- | 111 | mov dword [edx], ebp ; put color to pixel |
|
- | 112 | ||
- | 113 | mov edx, esi |
|
- | 114 | inc edx |
|
- | 115 | jmp .for_j |
|
- | 116 | .for_j_end: |
|
- | 117 | ||
- | 118 | inc ecx |
|
- | 119 | jmp .for_i |
|
- | 120 | ||
- | 121 | .ret: |
|
- | 122 | pop ebp edi esi edx ecx ebx eax |
|
- | 123 | ret |