SoldiersOfFortune

Clan forum
 
HomeFAQSearchRegisterMemberlistUsergroupsLog in

Share | 
 

 calculator in assebmler

Go down 
AuthorMessage
Ohtar
Game God
Game God
avatar

Posts : 109
Join date : 2007-08-31
Age : 29
Location : Sweden

PostSubject: calculator in assebmler   Fri Oct 12, 2007 11:21 am

If you ever wanna program an calculator in assembler.. here it is.

P4 EQU 0E8h

Org 8250
Begin:
;mov P4,#0
mov R3, #0
borja:
mov DPTR, #8500
CLR P1.4
ACALL kolla
SETB P1.4
CLR P1.5
ACALL kolla
SETB P1.5
CLR P1.6
ACALL kolla
SETB P1.6
AJMP borja

kolla:
JNB P1.0, Vardet
JNB P1.1, Vardet
JNB P1.2, Vardet
JNB P1.3, Vardet
RET

Vardet:
mov A,P1
CPL A

movc A,@A+DPTR
mov R2,A

CJNE A, #0FFh, inte1
ACALL plus
inte1:
CJNE A, #0FEh, inte2
ACALL minus
inte2:
mov P4,A

RET

plus:

mov R2,P4
mov A,R3
JNZ taltvå
mov R3, R2
test1:
JNB P1.0, test1
JNB P1.1, test1
JNB P1.2, test1
JNB P1.3, test1
AJMP borja

taltvå:
mov R4,R2
mov A, R4
Add A,R3
DA A
mov P4,A

test2:
JNB P1.0, test2
JNB P1.1, test2
JNB P1.2, test2
JNB P1.3, test2

AJMP Begin


minus:
mov R2,P4
mov A,R3
JNZ talett
mov R3,R2
test3:
JNB P1.0, test3
JNB P1.1, test3
JNB P1.2, test3
JNB P1.3, test3
AJMP borja

talett:
mov R4,R2
mov A,R3
CLR C
SUBB A,R4
DA A
mov P4,A
test4:
JNB P1.0, test4
JNB P1.1, test4
JNB P1.2, test4
JNB P1.3, test4
AJMP Begin

Org 8517
DB 1
Org 8518
DB 4
Org 8520
DB 7
Org 8524
DB 0FFh
Org 8533
DB 2
Org 8534
DB 5
Org 8536
DB 8
Org 8540
DB 0
Org 8565
DB 3
Org 8566
DB 6
Org 8568
DB 9
Org 8572
DB 0FEh

ds 15,5
End Begin

Razz
Back to top Go down
View user profile
Nucturnal
Wannabee Pro
Wannabee Pro
avatar

Posts : 23
Join date : 2007-08-31
Age : 29
Location : Sweden!

PostSubject: Re: calculator in assebmler   Fri Oct 12, 2007 11:44 am

I feel kinda guilty to this, but hey this is something everyone can enjoy! Wink
Back to top Go down
View user profile
Ellyen
Game God
Game God
avatar

Posts : 118
Join date : 2007-08-29
Age : 23
Location : R0mania

PostSubject: Re: calculator in assebmler   Fri Oct 12, 2007 8:17 pm

Hmm ... yea ... it's sounds quite simple ... thnx thnx thnx thnx bounce
Back to top Go down
View user profile
Ohtar
Game God
Game God
avatar

Posts : 109
Join date : 2007-08-31
Age : 29
Location : Sweden

PostSubject: Re: calculator in assebmler   Sat Oct 13, 2007 1:34 am

Ellyen wrote:
Hmm ... yea ... it's sounds quite simple ... thnx thnx thnx thnx bounce

Well aslong as you don't forget the # infront of some numbers its ok... if you forget it.. it will take you like hours to find the error:P

And you are welcome... use this knowledge wisely rendeer
Back to top Go down
View user profile
Wiggletphyre
Admin
Admin
avatar

Posts : 113
Join date : 2007-08-29
Location : The Netherlands

PostSubject: Re: calculator in assebmler   Sun Oct 21, 2007 9:29 pm

Uhhm you lost me after "If"
confused
Back to top Go down
View user profile
Ohtar
Game God
Game God
avatar

Posts : 109
Join date : 2007-08-31
Age : 29
Location : Sweden

PostSubject: Re: calculator in assebmler   Sun Oct 21, 2007 9:41 pm

hehehe Razz
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: calculator in assebmler   

Back to top Go down
 
calculator in assebmler
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
SoldiersOfFortune :: General Discussion :: spam spam-
Jump to: