|
PowerBASIC Forums
![]() Programming
![]() InLine Assembler (Page 1)
|
This topic is 3 pages long: 1 2 3 |
next newest topic | next oldest topic |
| Author | Topic: InLine Assembler |
|
Stavros A Petridis Member |
The questions are : a)When we write an inline assembler routine which of the registers that we use we MUST save ? b)The following subs are a small simple cipher routines i wrote using pb statements only in the Cipher sub and inline asm in the CipherAsm sub
This is a simple PB/CC code for benchmarks
Thank you Stavros ------------------ [This message has been edited by Stavros A Petridis (edited May 30, 2002).] IP: Logged |
|
Bern Ertl Member |
As I understood it, if you are using ASM within a SUB or FUNCTION, you do not need to PUSH any of the registers because PB will do that automatically when calling the SUB/FN. You should PUSH registers when mixing ASM code with PB code to ensure 1) your ASM code doesn't corrupt the values in the registers specified 2) any PB statements/functions mixed in with your ASM code don't change ------------------ IP: Logged |
|
Stavros A Petridis Member |
Bern, Thanks for your reply,for some reason i hadn't seen this chapter in the help file. Regards ------------------ IP: Logged |
|
Stavros A Petridis Member |
I don't know if its my computer or someone else can verify this but when i rem out the Pushes and Pops i get worst benchmarks than if i don't. Can someone verify this please ? Regards
[This message has been edited by Stavros A Petridis (edited May 29, 2002).] IP: Logged |
|
Brad D Byrne Member |
Push/pop rem out: w/ CipherASM secs: 1.8600... w/ Cipher secs: 2.0899... Push/pop in: PB/CC 2.10 on Win98 Brad ------------------ IP: Logged |
|
Stavros A Petridis Member |
Thanks Brad, That's strange, when we have the push-pop in, theoreticaly we have more machine cycles,but the benchmark is better !?! BTW on my computer the speed difference betwen Cipher and CipherAsm is biger: Stavros ------------------ [This message has been edited by Stavros A Petridis (edited May 29, 2002).] IP: Logged |
|
Brad D Byrne Member |
??? Big difference ? ------------------ IP: Logged |
|
Stavros A Petridis Member |
Brad, Your numbers are w/ CipherASM secs: 1.7699... w/ Cipher secs: 2.1399... and mine are In my case CipherAsm looks like its runing ~5 times faster than Chipher Stavros ------------------ IP: Logged |
|
Brad D Byrne Member |
yeah, I see, I'm using PBCC 2.10 w/ 98... maybe why? ------------------ IP: Logged |
|
Stavros A Petridis Member |
I am using win98 too,i don't know the inside differences of PC/CC 2.10 - 2.11 that may have any affect on the assembler, only God (call me Bob) can answer this. ![]() Stavros ------------------ IP: Logged |
|
Stavros A Petridis Member |
Brad, If i compile this code in PB/CC 2.0 then the benchmarks are: CipherAsm 0,720 sec Those numbers are familiar to yours.So i think that there is some kind ------------------ IP: Logged |
|
Semen Matusovski Member |
Stavros -- Your experiments are incorrect You declared three (!) register variables Meanwhile two only are possible (ESI/EDI). 2.0 and 2.1 can assign to registers different variables ------------------ IP: Logged |
|
Wayne Diamond Member |
Stavros, see this gem by Steve Hutchesson, at a glance it looks like you're working on the same sort of cipher ![]() Best of luck, Wayne ------------------ IP: Logged |
|
Stavros A Petridis Member |
Semen, About the register vars you are right,i remembered 4 regiter vars but that is for ext precision vars not integer. But this does not make any difference because the third declaration will be just ignored by the compiler. The fact is that CipherAsm runs ~5 times faster than Chipher when compiled with PB/CC 2.11 and just a little faster when compiled with 2.0 (because Chipher runs faster) If you see at the begining of the test program i have #REGISTER NONE so this should turn off any automatic register var assignment done by the compiler. Regards Stavros ------------------ IP: Logged |
|
Stavros A Petridis Member |
Wayne, You are right,this kind of simple encryption is a very common technique. BTW it looks like i implimented it a little diffrently in CipherAsm and i will benchmark it to see which is faster. ![]() Regards Stavros
[This message has been edited by Stavros A Petridis (edited May 29, 2002).] IP: Logged |
This topic is 3 pages long: 1 2 3 All times are EasternTime (US) | next newest topic | next oldest topic |
![]() |
|
Copyright © 1999-2005 PowerBASIC, Inc. All Rights Reserved.