# set-iomap command

The set-iomap BASIC program allows translatable
input and output for each port on the system.

## Syntax

```
set-iomap port.number{,item-ID} ([i|o|ri|ro]
```

## Parameter(s)

| port.number | Specifies the number of the port for which the iomap is being set. |
| --- | --- |
| item-ID | Item-ID of the user-defined keyboard item. It must be numeric, and is not required when used with any of these options: ir, ri, or, or ro. |
| i | Installs input keyboard. Character translation occurs before reaching input handling code, such as BASIC in. |
| o | Installs output keyboard. Character translation occurs before reaching output handling code, such as BASIC print. |
| ir or ri | Removes an installed input keyboard. |
| or or ro | Removes an installed output keyboard. |
There is a file in the dm account called iomap-file. This
file contains keyboard items that are defined by users. The item-ID
should be numeric and should be in the range of 0 <= item-ID <=
2147483647. The keyboard item has 34 attributes and has this format:

| attr 0 | Item-ID |
| --- | --- |
| attr 1 | User comments |
| attr 2 to 33 | ASCII code of characters from 0 to 127 in ASCII hexadecimal format. For example: character a has its ASCII code as x'41' and should be entered in the item as '41'. Each attribute from 2 to 33 has exactly eight entries each. Each entry must be two characters and there should be no quotes or spaces surrounding any number. In other words, each entry should look like a 16 digit hexadecimal number. User can put their comments after the eighth entry on that attribute. |
The example below shows how to translate the character
A to B:

- ASCII code of A is x'41' = d'65'

- ASCII code of B is x'42' = d'66'

- 65 mod 8 = 8 with remainder 1

- Translated character, which is B, should be entered at attribute 8+2= 10 and at column 1*2+1=3 as 42. The reason that 2 is added to 8 is because counting begins at 0 and attribute 1 is used for comments.

## Example(s)

```
open "iomap-file" then
 a = "Sample IOMap"
 for b = 0 to 127
 a < 0 + int( b / 8 ) > := dtx( b ) "r%2"
 next b
 write a on "12345"
 close
end
```

## See also

- [iomap-file file](https://d3codex.com/systemfiles/iomap-file-file/)
- [keyboards file](https://d3codex.com/systemfiles/keyboards-file/)
- [set-imap command](https://d3codex.com/tcl/set-imap-command/)

---
Source: https://d3codex.com/tcl/set-iomap-command/ - part of the D3Codex reference.
