Programming Forums
User Name Password Register

RSS Feed

Thread Tools Display Modes
Old Jun 1st, 2013, 12:12 AM   #1
Join Date: Feb 2013
Posts: 6
Rep Power: 0 kayxxx is on a distinguished road
Hi guys can someone please explain this code for i will know what is the logic?

.model small
org 100
year db 10,13, "Year: $"
leapmsg db 10, 13, "That is a leap year! $"
notleapmsg db 10, 13, "That is not a leap year! $"


mov ax, @data
mov ds, ax

lea dx, year
mov ah, 09h
int 21h

call InputProc


lea dx, leapmsg
mov ah, 09h
int 21h
jmp close


lea dx, notleapmsg
mov ah, 09h
int 21h
jmp close


mov ah, 4ch
int 21h

Proc InputProc

mov ah, 01h
int 21h
cmp al, 0dh
je FirstTest

mov ah, 0
sub al, 30h
push ax
mov ax, 10d
mul bx
pop bx
add bx, ax
jmp inputProc

call FirstTest

Proc FirstTest

mov ax, bx
push ax
mov bx, 4
div bx
cmp dx, 0
je SecondTest
jmp leapFalse


Proc SecondTest
pop ax
push ax
mov bx, 100
div bx
cmp dx, 0
je ThirdTest
jmp leapTrue

Proc ThirdTest

pop ax
mov bx, 400
div bx
cmp dx, 0
je leapTrue
jmp leapFalse


end start
kayxxx is offline   Reply With Quote
Old Jun 1st, 2013, 10:55 AM   #2
Ancient Dragon
Achieved Level 70

Ancient Dragon's Avatar
Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 4,345
Rep Power: 10 Ancient Dragon will become famous soon enoughAncient Dragon will become famous soon enough
Re: Hi guys can someone please explain this code for i will know what is the logic?

Explain the logic? That's why is very very important to comment the code, more important in assembly than in other languages. Do you know assembly language at all? If yes, then just begin reading at the start: label and follow the program as if you were the processor.
PFO's FAQ is here
Forum Rules

There is no cow level (Diablo III)
If you never push yourself you will never improve (Diablo III)
Ancient Dragon is offline   Reply With Quote


« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can someone explain this code? JavaJunior Python 2 May 2nd, 2012 1:48 PM
Need to make code more efficient. weatherman0516 Bash / Shell Scripting 4 Sep 18th, 2011 8:17 AM
Open source C++ projects for a source code analyzer? david.dda C++ 1 Sep 28th, 2009 1:15 AM
String to Morse Code - Copying from string to string Xenon C 29 Nov 10th, 2005 3:30 PM

DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:17 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC