Friday, August 27, 2010

Assembly: Tambah Nombor Genap & Dapatkan purata

Kadang-kadang aku pun konpius tapi soalan mcm ni biasa keluar:
Write an assembly language program segment to add two even number N1 and N2. The average is computed and stored in a varible named AVG(Assume AVG has been declared as an 8 bit length)
jawapan(aku rasa x berapa bagus):
.MODEL SMALL
.STACK 64
.DATA
TWO db ?
i dw ?
count dw ?
Sum dw ?
AVG db ?
N1 dw ?
N2 dw ?
.CODE
main proc far
MOV Sum,0
MOV TWO,2
MOV count, 0
MOV i,0
start: INC i
Mov AX,i
Mov N2, AX ;AX to N2
DIV TWO
CMP AH, 1 ;Kalau nombor ganjil bahagi dua mesti dapat baki 1
JE start
ADD BX, i ;N1 + N2
Mov N1, BX
INC count ;Kira berapa kali nombor genap ditambah
CMP i, 10
JGE stop
JMP start
stop: MOV Sum, BX
Mov AX, Sum
DIV count ; Bahagi jumlah dengan bilangan tambah
MOV AVG, AL; Masuk nilai purata ke dalam AVG
INT 21h
main endp
end main

Mari kita fahamkan sesama:
Bila bahagi degan operasi DIV, AX akan ada dua nilai berbeza dekat AH & AL.
Dalam AL akan ada nilai bahagi, dalam AH akan ada baki.
Oleh itu, kita CMP(compare) AH dengan 1 sebab setiap nombor ganjil kalau dibahagi 2 akan ada baki 1.

P/S: Rasanya pos yang aku buat sebelum ni patut kena rombak.

Masih banyak lagi kena belajar. ......bersambung

Tuesday, August 17, 2010

Interior Monologue

I am Nothing and God is Everything.

Most of the time I am writing in the form of an 'interior monologue' or Stream-of-consciousness. It is in my logbook and diary, I do keep a yearly diary, one book per year. In which I prefer to convey my thought processes while reminiscing a particular incident.

I think what I see in my own view, yet in your point of view it might be said differently. We might get mutual understanding if you're persuaded to realize a common theme is happening for instance this written word. It is my way of conveying my understanding of reality to you, the reader. Do I reach the target of making you understand? I am not concerned upon it because most might skip reading this because reading this might be a waste of time for them. If you are willing, please continue reading this then its up to you, I am very democratic about it.

First, I would like to try my best to avoid the association of my perspective with absolute truth and reality. It mustn't be as such because it came out from my own mind which the source might be inspired from memory or instantaneous miracle. That previous statement was just my perception of what I am trying to convey for the time being.

I have personal concern like pain, but I realize that pain is just a mind game. Even a broken heart, I view it as not so different to an empty stomach. It all came to down to the component of the mind and emotion.
Most of the time we are beaten down by emotion. The mind just submit and creates all of this fairytale just to agree with emotion.

Since the mind so concern with logic and emotion concern with other's opinion, it will find facts which widely acceptable to compliment the low emotion so the guilt can be minimized. Usually, it requires us to demonize someone or something as the supreme evil which causes our bad emotion. Why a bad emotion? We just don't understand it.


So try to sit, not judge and wait. God will come out with an answer.

Yes, I am just jumbling it all apart, but I believe there's something good in this. Everyone have a decoder or compiler in their mind. Life is a mind game and the world worth nothing at all.

Friday, August 13, 2010

Contemplating Nothing

We conceptualize nothing so the sensation was a mere creation like a new word to describe the absence. Does it constitute nothing? Does it equal to zero, yet we can go beyond the negative infinitely. Just a mere conception, a mere method of measurement. Just another method to mention this and that like the word I am typing.

When we say we feel nothing, usually it constitute the unknown which in most cases physiological. We crave something and we perceive it as sustenance. All mere conception as we believe we need substitute for it. Drugs, sex and over eating were just sedative against reality. Numbing our perception which sometimes contribute illness.

Nothing never belong in this physical realm as there is something which create and administer it. To ever understand nothing will be unattainable as we begin with something which is GOD almighty.

I guess this can be constituted as nothing, so throw it in the dust bin. How can you throw something which doesn't exist?