Skip to content

Instantly share code, notes, and snippets.

@draganczukp
Created April 9, 2018 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save draganczukp/53b27d54d4cfc518bb92e99f561fc5f2 to your computer and use it in GitHub Desktop.
Save draganczukp/53b27d54d4cfc518bb92e99f561fc5f2 to your computer and use it in GitHub Desktop.
.model tiny
.386
.data
pytanie db "Podaj znak: $"
newline db 10,13,'$'
podzielne db 10,13,"Podzielne$"
niepodz db 10,13,"Nie podzielne$"
.stack 100h
.code
start:
mov ax, @data
mov ds, ax
; Pytaj
mov dx, offset pytanie
mov ah, 09h
int 21h
; Wczytaj
mov ah, 01h
int 21h
mov bl, 10
mul bl
mov cx,ax
mov ah, 01h
int 21h
mov bl, al
add cx, bx
; nowa linia
mov dx, offset newline
mov ah, 09h
int 21h
; zeruj ah
xor ah,ah
; zamien na liczbe
mov ax,cx
sub al,'0'
; przez co dzieli
mov bl,4
; dzieli
div bl
; zapamietaj reszte
mov dl, ah
; if(dl%4==0)
cmp dl, 0
je _podzielne
; else
mov dx, offset niepodz
mov ah, 09h
int 21h
jmp koniec
_podzielne:
mov dx, offset podzielne
mov ah, 09h
int 21h
jmp koniec
koniec:
mov ah, 4Ch
int 21h
end start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment