diff --git a/src/a2.asm b/src/a2.asm index dd8bcec..16e80e1 100644 --- a/src/a2.asm +++ b/src/a2.asm @@ -18,15 +18,39 @@ ;E=01111001=79 ;F=01110001=71 +INPUT equ 0h +LED equ 0h +SEGM equ 90h -; 0 1 2 3 4 5 6 7 8 9 A B C D E F -SEG db 0x3F, 0x6, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x7, 0x7F, 0x6F, 0x77, 0xFF, 0x39, 0xBF, 0x79, 0x71 + +; 0 1 2 3 4 5 6 7 8 9 A B C D E F +segtext db 0x3F, 0x6, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x7, 0x7F, 0x6F, 0x77, 0xFF, 0x39, 0xBF, 0x79, 0x71 +res db 0x0 jmp WDH +WDH: in ax, INPUT + mov res, ax + and ax, 00001111b;get second nibble + out LED, ax;debug, output to leds + push ax;write result to stack -WDH: in ax, 0 - out 90h, ax - out 0, ax + + mov ax, res + mov cl, 4 + shr ax, cl;shift right 4 times + and ax, 00001111b;might not be needed + out LED, ax;debug, output to leds + push ax;write result to stack + + + pop ax;get from stack + pop bx;get from stack + + sub ax, bx + + out LED, ax;output to led + + out SEGM, al;output to seven segment display jmp WDH