התגובות שלי בפורום
-
מאתתגובות
-
Alonמשתתף
כותרת: you are right but slow
hii
you answer with push and pop , nice but slower …if you compare it to xchg or to Venndigram´s answer:
the problem with Venndigram´s answer that you need another register… the problem with your answer that pop is kinda slow … , another thing . size bytes .: xchg 2 bytes
the moves answer – 3 mov , every mov 2 bytes = 6 bytes
push and pop each one of them 1 byte * 4 =4 bytes ,.bye
Alon
Alonמשתתףכותרת: my answer
strange , when i did the test i thougth it does cx=-bx , i dont know why i thought so . when i checked it again(today ) i was notice that its just exchange between cx and bx (wired – probably there is a trick. when there is overflow or something )
but if there is not trick
just do XCHG cx,bx (takes 3 clocks . doesnt change the flags) so you dont need to push and pop.)Bye
AlonAlonמשתתףכותרת: i got 68 , in the top 20
Alonמשתתףכותרת: "small is beatifual"!
זאת הבעיה של העולם היום , חושבים שיש הרבה מקום ומהירות גדולה
אז יש רשות לכתוב קוד גרוע(קצת הגזמתי עם הקוד הגרוע ) !!!!
תבדוק את האתר שהופסתי ותקרא את מה שכתוב באנגלית למטה.
???????בקשר למשתנים ואוגרים בשפה עלית כמו C – יכול להיות שהcompiler
משנה את התוכן של הלולאה והלולאה עצמה שתשמש רק באוגרים ( דבר שלא יכול לקרות ברוב המקרים ) אבל , עדיין יש לך את השימוש במשתנה
ברגע שרשמת
int i;
תפסת שני בייט בזיכרון( if globaly) או על המחסנית( if local)My Kind of Software:
You may have noticed that you didn´t need to "install" this
Windows program. Instead, you just ran it . . . like in the
good old DOS days when programs were carefully written and lovingly crafted.
You may have also noticed that this program is quite small
(considering all the text that´s built-in) and that it´s quick to
download and run.How did I accomplish all this?
This program was hand crafted — byte by byte — in 100%
pure 32-bit Intel assembly language. Assembly language is
the raw and true language of the processor running inside your computer.
But almost no one uses assembly language any longer.
Instead they use "easy" languages like Visual Basic or C++ because
they´re in a hurry, they lack any real understanding of the
computers they are programming (they don´t know how to program in the machine´s real language),
and they and their managers don´t really need to care about the size,
performance, or real quality of what they are producing.
They know you´ll just buy a bigger hard drive and a faster computer.
And you and I both know they´re probably right.But I don´t care how much free space you have on your hard drive or
how fast your machine runs.
I won´t create bloated and slow software in VB or C for anyone . . .
not while assembly language exists — and it always will!This program is a single standalone independent executable
file that is not dependent upon any other DLL file.
So there´s no bloat, no setup, nothing to install or remove.
Nothing to conflict with other things and crash your system.Do you have any idea how much time and trouble that saves you?
How many typical crashing problems of Windows you´ll never have
with my software? And this program is just the beginning.Hmmmm . . . perhaps you do care after all.
I hope so, because I will only create the best programs possible.
That´s all that matters to me.I believe it matters to you too. I welcome your judgement.
— Steve Gibson http://www.grc.com
About Message from OptOut v0.999999999
ביי
אלוןAlonמשתתףכותרת: asm vs c or c+asm
היי
הכל סבבה
מה איתך?אני מסכים איתך, שבדרך כלל שלוקח יותר זמן לכתוב באסמבלי , אבל בשביל לכתוב חלון פשוט , או meesagebox אני אכתוב את זה באסמלי .(ויקח לנו אותו זמן לכתוב את זה )
בדברים כאלה פשוטים הההבדל לא מורגש, אבל אם אתה כותב אלגוריתם
למשל,חישוב,חיפוש וכו´ אתה חייב לשים לב למהירות של הקוד – דבר שאתה לא יוכל לשלוט כל כך ב C .יכול להיות שכדי לתכנת רק את הפונקציות של הלגוריתם ב ASM ולכתוב את שאר התוכנה ב C , אבל אם כבר כתבתה את החלק המורכב ב ASM למה לא להמשיך לכתוב את כל התוכנה .0
על visual basic אין בכלל מה לדבר, קוד איטי וסתם גדול ועוד שצריך את קבצי ה RUNTIME OF VISUAL BASIC
אני יודע שחלק לא מסכימים איתי אבל יש הרבה אנשים שכן – אני פשוט אוהב את הרעיון שתיהיה לי שליטה על הקוד שיצא – שזה תולי בי אם הוא יהיה קטן,גדול,מהיר או איטי , ולא תלוי ב Compiler
שאני משתמשביי
נ.ב
אחד מההבדלים הרבים:
כשמתכנתים בwindows אתה צריך להשתמש ב API – בכל השפות ה ערך החוזר חייב לחזור לתוך משתנה(דבר שלוקח יותר זמן) לעומת זאת באסמבלי אני יכול להשאיר את הערך בeax ולעשות את השימוש שאני רוצה .Alonמשתתףכותרת: vb,vc and delphi
hi
first of all delphi isnot vb+vc . the new language microsoft built – C# – they say the power of visual c with the simplesti if visual basic.2nd written program in visual ISNOT a waste of time you just have more control on your program (thing you realy dont have in VISUAL BASIC and DELPHI) . – but still in visual c you dont have full control (but alot more than the others(but asm)
i dont understand what do you want from pascal ? , turbo pascal produces somenice code . if you remove all the runtime codein the begining you will have something nice – maybe even better optimez than some of the c compilers
BUT still i wont code something that i care about his speed ( and size) in those language
Alonמשתתףכותרת: asm
hiii
like i said before . i program with asm for windows too !!!
you should check win32asm.cjb.net . did you go to http://www.grc.com ?? you should have a look in this too .visual basic. very very easy language to use BUT , very very slow. i dont know why microsoft built it like that .they could do it much faster and smaller, those runtime SUCKS ,.1 and something MB of runtime. to be short visual basic SUCKS!!!!!! but i still use it when i need to debug small things. but I NEVER wrote a program in that,. if i need to write something i´m writting it in asm (yes for windows too )
about visual c. . yeah you can say that its a good language but you need to understand something. if you code something in visaul c and compiled it with visual and then compiled it with lets say borland c . the code will be diffrent and probably that code from borland will be slower!!
from this you can learn that YOU DONT HAVE REALY CONTROL ON YOUR CODE!!!!!!!!!!
bye
ALONAlonמשתתףכותרת: asm
hiiijust for the record i agree with TheWizard. there is lot of people program in asm . ( i one of them )
have you hear about "SpinSite" – goto http://www.grc.com . another one that program in 100% asm
asm is the best language !!1 .. you have FULL control on your code.(something that doesnot exist in c,pascal,basic and etc…) ,of course there is special cases that its not worth to code something in asm . becuase it will take to much time to code it, but if you care about speed and size and you are GOOD programer you should write in asm !!!!Alonמשתתףכותרת: % question 69
hii didnt find any mathematical way to solves this problem , but solving it by logical can be done :
you take the right digit and check
1^3 = 1 , 1^2 = 1 . so 1 cant be the right digit
2^3 = 8 , 2^2 = 4 . can be
3^3 = 27 , 3^2 = 9 can be
……and so on . the number 0,1,5,6, cant be at the right digit
in this way you can check the 2nd digit too . and thats itbythway . in the test i built a scanner ( program . but i had small miskate in the algorithm . so i didnt get anynumber .;[
Alonמשתתףכותרת: the 1 before the last question
זה יוצא ככה:
MOV CX,BX
MOV BX,0
נכון?why ?
thefunction set bx into cx and makes it negative
example;
bx=2
cx=8
in the end cx will be -2 if i´m remeber correctlyso you can do
neg cx .
or
xor cx,cx
sub cx,bx ; but this modifies some of the flagsAlonמשתתףכותרת: the 1 before the last question
זה יוצא ככה:
MOV CX,BX
MOV BX,0
נכון?why ?
thefunction set bx into cx and makes it negative
example;
bx=2
cx=8
in the end cx will be -2 if i´m remeber correctlyso you can do
neg cx .
or
xor cx,cx
sub cx,bxAlonמשתתףכותרת: just Pascal!? what about asm?
-
מאתתגובות