From c719c06a444845d1627aa84185b8cc09769243af Mon Sep 17 00:00:00 2001 From: Dpbm Date: Sun, 7 Apr 2024 19:15:19 -0300 Subject: [PATCH] added some asm tests --- terceiro-ano/asm/test.asm | 39 ++++++++++++++++++++++++++++++++++ terceiro-ano/asm/test2.asm | 43 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 terceiro-ano/asm/test.asm create mode 100644 terceiro-ano/asm/test2.asm diff --git a/terceiro-ano/asm/test.asm b/terceiro-ano/asm/test.asm new file mode 100644 index 0000000..d80ebb6 --- /dev/null +++ b/terceiro-ano/asm/test.asm @@ -0,0 +1,39 @@ +loop: + ;read from keyboard + ;mov ah, 0h + xor ah, ah + int 16h + + ; scape key pressed + cmp ah, 1 + je exit ;end game + + jmp draw + +draw: + + ;vga mode + mov ax, 13h + ;mov ah, 0h + xor ah, ah + int 10h + + mov edi, 0A0000h + mov al, 4h ;color of the pixel + mov [edi], al + + mov edi, 0A0001h + mov al, 4h ;color of the pixel + mov [edi], al + + + mov edi, 0A0002h + mov al, 4h ;color of the pixel + mov [edi], al + + jmp loop + +exit: + mov ah, 2 + int 3 + ret diff --git a/terceiro-ano/asm/test2.asm b/terceiro-ano/asm/test2.asm new file mode 100644 index 0000000..1e636e8 --- /dev/null +++ b/terceiro-ano/asm/test2.asm @@ -0,0 +1,43 @@ +line_size db 10 + + +loop: + ;read from keyboard + ;mov ah, 0h + xor ah, ah + int 16h + + ; scape key pressed + cmp ah, 1 + je exit ;end game + + jmp draw + +draw: + + ;vga mode + mov ax, 13h + ;mov ah, 0h + xor ah, ah + int 10h + + ; draw a pixel at x=100 y=100 color=red + mov ah, 0Ch + mov al, 4 + mov cx, 100+line_size + mov dx, 100+line_size + int 10h + + mov bx, [line_size] + dec bx + mov [line_size], bx + + jmp loop + +exit: + mov ax, 3 + int 10h + + mov ax, 4C00h + int 21h +