Low Level Code For digitalRead and DigitalWrite

I have just started using the Due board and I am enjoying learning Arduino. I have tried to find the code underlying the digitalRead and digitalWrite functions, but no luck. Can someone point me in the right direction? Has anyone written a method for writing/reading to a specified memory address or register in the CPU? I need to write code to some of the registers in the Due CPU to set/read the timer/counters, PWM, etc.
Thank you!

Patrick

@pdwyer

Hi Patrick,

The Due versions of those 'digital' funcs are in files wiring_digital.c / .h in:

... arduino-1.5.1r2\hardware\arduino\sam\cores\arduino

HTH
Jim