Back in the days of Intel 80386, PC XT, MS-DOS, Turbo Pascal, I could develop projects and bring them to products, involving self-designed electronics boards for data acquisition and control, either attached externally to the serial port, parallel port, or internally, directly inserted into the bus slots. I could manage to get basically full direct access to the complete address map of all internals, down to controller ports and even access the individual signals at the bus, serial and parallel ports, keyboard controller ports, mapped video card memory, direct memory access, disk management, real-time clock, etc., some of which became obsolete later with the introduction of USB and newer wired or wireless technologies.
All that was possible back then thanks to the open architecture literature, and read/write access to the internals was possible. Besides, all schematics of the IBM PC XT mainboard and peripherals and the internals port addresses were public, BIOS was fully documented with all assembler instructions available; besides, there was an excellent book on internals by Peter Norton. That was like, we could do almost every imaginable project to interface a PC down from custom designed equipment up to the user interface level using a single programming language (i.e. Turbo Pascal and some inline assembler).
Then I took a different route in my career, which does not involve programming, but only electronics. Getting closer to my retirement age, I am planning on getting back to my R&D basics at the software/hardware level, but things have changed a lot since the introduction of the Protected Mode, the PC architectures, and the evolution of all Graphic OS's starting with Windows, Linux, Ubuntu, etc.
My question is on how deep can we dive safely using Nim, either running Windows or Linux, and be able to read/write directly into the PC internals nowadays? I know this is very OS and hardware dependent, but my intention is not developing portable software/hardware, instead, those that involve research on a specific platform and OS.
Can we use Nim without making the system crash (for sure it will if we don't know what we're doing) to:
... and, is there any available documentation that may guide me on how to achieve these goals?
Thanks
PicoSDK4Nim wraps Raspberry Pi Pico SDK and these example code calls C functions in the SDK.
I have never tried to directly access memory mapped hardware registers on Pico. But I think Nim can do so because Nim has Volatile pragma and probably can do the same things as C functions in this header file: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_base/include/hardware/address_mapped.h
And Nim has Assembler statement in case you need to use CPU instructions C compiler doesn't emit.
Raspberry Pi Pico has good documentations: