diff --git a/23_day/a_nask.nas b/23_day/a_nask.nas index aec636e..7d87957 100644 --- a/23_day/a_nask.nas +++ b/23_day/a_nask.nas @@ -15,6 +15,7 @@ GLOBAL _api_point GLOBAL _api_refreshwin GLOBAL _api_linewin + GLOBAL _api_closewin [SECTION .text] @@ -170,3 +171,11 @@ _api_linewin: ; void api_linewin(int win, int x0, int y0, int x1, int y1, int c POP ESI POP EDI RET + +_api_closewin: ; void api_closewin(int win); + PUSH EBX + MOV EDX,14 + MOV EBX,[ESP+8] ; win + INT 0x40 + POP EBX + RET diff --git a/23_day/console.c b/23_day/console.c index b7d65ad..dbc9b30 100644 --- a/23_day/console.c +++ b/23_day/console.c @@ -373,6 +373,8 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int if ((ebx & 1) == 0) { sheet_refresh(sht, eax, ecx, esi + 1, edi + 1); } + } else if (edx == 14) { + sheet_free((struct SHEET *) ebx); } return 0; } diff --git a/23_day/lines.c b/23_day/lines.c index 8cef008..1b5d926 100644 --- a/23_day/lines.c +++ b/23_day/lines.c @@ -3,6 +3,7 @@ void api_initmalloc(void); char *api_malloc(int size); void api_refreshwin(int win, int x0, int y0, int x1, int y1); void api_linewin(int win, int x0, int y0, int x1, int y1, int col); +void api_closewin(int win); void api_end(void); void HariMain(void) @@ -17,5 +18,6 @@ void HariMain(void) api_linewin(win + 1, 88, 26, i * 9 + 88, 89, i); } api_refreshwin(win, 6, 26, 154, 90); + api_closewin(win); api_end(); }