diff --git a/Hardware.md b/Hardware.md index a9bb1c8..3e9705e 100644 --- a/Hardware.md +++ b/Hardware.md @@ -1,9 +1,28 @@ -* Support up to 65535 hardware devices -* HWQ -* HWI -* HWN +The game's microprocessor can handle up to 65535 hardware devices connected to addresses 0x0000-0xFFFF. Hardware devices can interact with the CPU, its memory and its registers. -- Drill +The **HWQ** (Hardware Query) instruction can be used to get information about the hardware connected at an address. + +Exemple: +```assembly +MOV A, 0x0005 +HWQ A +; The hardware id of the hardware at address 0x0005 is stored in the B register +; If there is no hardware device connected at this address, B = 0 +``` + +The **HWI** (Hardware Interupt) instruction sends an interrupt to the hardware device at the specified address +```assembly +; Get the current held item id +INVENTORY_HW equ 0x0006 ; An inventory module is connected at address 0x006 +MOV A, 1 ; The Inventory hardware expects 1 (POLL) or 2 (CLEAR) +HWI INVENTORY_HW +; B = current held item id +``` + +### Hardware Devices: + + +- [Drill](https://github.com/simon987/Much-Assembly-Required/wiki/Hardware:-Drill) - Inventory - Laser - Legs