<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Catzie.net Blog &#187; odd or even number</title>
	<atom:link href="http://blog.catzie.net/tag/odd-or-even-number/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.catzie.net</link>
	<description>Programming, Networking, and other Downloads by Catzie</description>
	<lastBuildDate>Tue, 07 Feb 2012 15:19:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Assembly Language: check if a one-digit input number is odd or even</title>
		<link>http://blog.catzie.net/assembly-language-check-if-a-one-digit-input-number-is-odd-or-even/</link>
		<comments>http://blog.catzie.net/assembly-language-check-if-a-one-digit-input-number-is-odd-or-even/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 14:54:25 +0000</pubDate>
		<dc:creator>Catzie</dc:creator>
				<category><![CDATA[Assembly Language]]></category>
		<category><![CDATA[assembly language]]></category>
		<category><![CDATA[odd or even number]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://blog.catzie.net/?p=62</guid>
		<description><![CDATA[I coded this back when I was taking up Computer System Organization. It was a homework that I decided to share in my old blog. The program accepts a one-digit number as the input, and then shows whether that number is ODD or EVEN. The program uses the attribute byte to highlight ODD or EVEN [...]]]></description>
			<content:encoded><![CDATA[<p><center><img src="http://img.photobucket.com/albums/v209/catzie/oe.jpg" alt="assembly programming odd even number" /></center></p>
<p>I coded this back when I was taking up Computer System Organization. It was a homework that I decided to share in my old blog.</p>
<p>The program accepts a one-digit number as the input, and then shows whether that number is ODD or EVEN.</p>
<p>The program uses the attribute byte to highlight ODD or EVEN with a color.<br />
<span id="more-62"></span></p>
<div class="code">
;&#8212;Program coded by Catzie Keng of http://catzie.net</p>
<p>.model small<br />
.code<br />
org 100h</p>
<p>start: jmp main</p>
<p>;&#8212;&#8212;&#8211; VARS &#8212;&#8212;&#8212;<br />
header db &#8220;Input a number (0-9): $&#8221;<br />
footer db &#8220;Press Q to quit.$&#8221;<br />
vOdd db &#8220;O D D $&#8221;<br />
vEven db &#8220;E V E N $&#8221;</p>
<p>main proc near<br />
	mov ax,03			;clear screen<br />
	int 10h</p>
<p>repeat:<br />
	call cursor			;header<br />
	mov dl,0<br />
	mov dh,0<br />
	int 10h<br />
	mov ah,9<br />
	lea dx,header<br />
	int 21h</p>
<p>	call cursor 		;footer<br />
	mov dl,4<br />
	mov dh,8<br />
	int 10h<br />
	mov ah,9<br />
	lea dx,footer<br />
	int 21h</p>
<p>	call dispODD<br />
	call dispEVEN</p>
<p>	call cursor		;input<br />
	mov dl,23<br />
	mov dh,0<br />
	int 10h<br />
	call input</p>
<p>	cmp al,30h		;0<br />
	je pEven<br />
	cmp al,31h		;1<br />
	je pOdd<br />
	cmp al,32h		;2<br />
	je pEven<br />
	cmp al,33h		;3<br />
	je pOdd<br />
	cmp al,34h		;4<br />
	je pEven<br />
	cmp al,35h		;5<br />
	je pOdd<br />
	cmp al,36h		;6<br />
	je pEven<br />
	cmp al,37h		;7<br />
	je pOdd<br />
	cmp al,38h		;8<br />
	je pEven<br />
	cmp al,39h		;9<br />
	je pOdd<br />
	cmp al,&#8217;Q&#8217;<br />
	je terminate<br />
	cmp al,&#8217;q&#8217;<br />
	je terminate</p>
<p>	pEven:<br />
		call prEven<br />
		jmp repeat<br />
		call exit</p>
<p>	pOdd:<br />
		call prOdd<br />
		jmp repeat<br />
		call exit</p>
<p>	terminate:<br />
		call endCursor<br />
		call exit</p>
<p>	dispODD proc<br />
		call cursor			;display ODD<br />
		mov dl,10<br />
		mov dh,3<br />
		int 10h<br />
		mov ah,9<br />
		lea dx,vOdd<br />
		int 21h<br />
		ret<br />
	dispODD endp</p>
<p>	dispEVEN proc<br />
		call cursor			;display EVEN<br />
		mov dl,9<br />
		mov dh,5<br />
		int 10h<br />
		mov ah,9<br />
		lea dx,vEven<br />
		int 21h<br />
		ret<br />
	dispEVEN endp	</p>
<p>	prEven proc<br />
		mov al,&#8217; &#8216;<br />
		mov cx,1<br />
		mov bl,2fh<br />
		mov dh,5<br />
		x:	mov dl,8<br />
			mov ah,2<br />
			int 10h<br />
			push cx<br />
			mov ah,9<br />
			mov cx,9<br />
			int 10h<br />
			pop cx<br />
			inc dh<br />
			loop x<br />
		call dispEVEN</p>
<p>		mov al,&#8217; &#8216;				;cover odd<br />
		mov cx,1<br />
		mov bl,07h<br />
		mov dh,3<br />
		a: 	mov dl,8<br />
			mov ah,2<br />
			int 10h<br />
			push cx<br />
			mov ah,9<br />
			mov cx,9<br />
			int 10h<br />
			pop cx<br />
			inc dh<br />
			loop a<br />
		call dispODD<br />
		ret<br />
	prEven endp</p>
<p>	prOdd proc<br />
		mov al,&#8217; &#8216;<br />
		mov cx,1<br />
		mov bl,2fh<br />
		mov dh,3<br />
		y:	mov dl,8<br />
			mov ah,2<br />
			int 10h<br />
			push cx<br />
			mov ah,9<br />
			mov cx,9<br />
			int 10h<br />
			pop cx<br />
			inc dh<br />
			loop y<br />
		call dispODD	</p>
<p>		mov al,&#8217; &#8216;				;cover even<br />
		mov cx,1<br />
		mov bl,07h<br />
		mov dh,5<br />
		b: 	mov dl,8<br />
			mov ah,2<br />
			int 10h<br />
			push cx<br />
			mov ah,9<br />
			mov cx,9<br />
			int 10h<br />
			pop cx<br />
			inc dh<br />
			loop b<br />
		call dispEVEN<br />
		ret<br />
	prOdd endp<br />
main endp</p>
<p>;&#8212;Program coded by Catzie Keng of http://catzie.net</p>
<p>cursor proc<br />
	mov ah,2<br />
	mov bh,0<br />
	ret<br />
cursor endp</p>
<p>input proc<br />
	mov ah,1<br />
	int 21h<br />
	ret<br />
input endp</p>
<p>endCursor proc<br />
	call cursor<br />
	mov dl,0<br />
	mov dh,15<br />
	int 10h<br />
endCursor endp</p>
<p>exit proc<br />
	int 20h<br />
exit endp</p>
<p>end start<br />
;&#8212;Program coded by Catzie Keng of http://catzie.net
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.catzie.net/assembly-language-check-if-a-one-digit-input-number-is-odd-or-even/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

