DataTalk Protocol between Aladin and PC/MemoMouse


1. Introduction

Aladin dive computer uses a CPU in uPD75308 family made by NEC. My friend told me that in an old Aladin Pro (without PC communicating function) he actually found uPD75308 on the board inside the Aladin. Therefore, I suspect that current models of Aladins also use the same family of CPU, more specifically, uPD75316.

uPD75316 is a four bits CPU and has two separate memory spaces of ROM (program memory; 16256 words x 8 bits) and RAM (data memory; 1024 words x 4bits). I/O ports and CPU registers are mapped to RAM. And for PC communicating function I think Aladin has an SRAM (2048 words x 8 bits) connected to I/O port outside of the CPU. All the contents but the last 8 bytes of this SRAM are sent to PC when Aladin changes its mode from [logbook] to [logbook1] (by user touching moisten fingers).

Note: A copy of the datasheet uPD75308

DataTalk can do the following:

  1. Read and modify the contents of SRAM,
  2. Read and modify the contents of RAM.
Unfortunately, there seems to be no facility to read the contents of ROM so we cannot dump the program of Aladin dive computer...

This document is devoted to explain how DataTalk communicates with Aladin and does the functions (1) and (2) above.


2. Hardware, Baudrate, Bit Order

Aladin and PC (or MemoMouse) are connected by RS232C protocol logically. Physically, however, since Aladin has only two pins, one signal line (connected to the "minus" contact of Aladin) is used to carry signals for both directions. Note: The other line that is connected to the "base" contact of Aladin is the signal ground.

Aladin sends 2050 bytes of data to PC (or MemoMouse) at

      19200 baud, 8 bits, No parity and 1 stopbit,
when either of the following condition is met:
  1. Just before "logbook mode" turned into "1st logbook mode", after moist fingers touch to the two contacts of Aladin.
  2. SOS mode (every one minute).
The format of these 2050 bytes of data is described in the other documentation entitled "Protocol and Data Structure of Uwatec Aladin Dive Computers", so please refer it if necessary.

After sending 2050 bytes of data, Aladin changes its input/output serial port settings to

      4800 baud, 8 bits, No parity and 1 stopbit,
and wait for
      0x55, 0xdd, 0x33  (three bytes sequence).
If Aladin successfully received the byte pattern, it responds to the sequence by sending a byte 0x3f (the '?' character) to PC (or MemoMouse), and then it enters to "Interpreter Mode", which is explained in the next section.

If the sequence is not received in a certain (very short) period of time Aladin goes into 1st logbook data display.


3. Interpreter Mode

First, please note that all the bytes on the serial line are bit reversed, i.e., if

   received/sent bit order from Aladin: b0 b1 b2 b3 b4 b5 b6 b7
then
   ordinary bit order of PC:            b7 b6 b5 b4 b3 b2 b1 b0.
So we must rearrange every received byte before proceeding further data processing. And similarly, we must do so to every byte before sending to Aladin.

In this interpreter mode, Aladin does the following:

       (1) Receive one byte from PC (or MemoMouse).
       (2) Execute the received byte.  (If the byte is "EXIT (0xe7)" then
           Aladin exits from "Interpreter Mode" and goes into 1st 
           logbook data display.)
       (3) If there are some return value(s) after execution, send the 
           byte(s) to PC (or MemoMouse).
       (4) Send a byte 0x84 (= bit reverse of 0x21, the ASCII '!')
           to PC (or MemoMouse).
       (5) Go to step (1).

In order to understand the mechanism of how Aladin executes received bytes, we introduce a model of an assembly language with a virtual CPU explained below.

The virtual CPU is a 4-bits CPU, and has only one index register.

                      +--------+--------+
Index register HL :   |   H    |   L    |
                      +--------+--------+

The register HL has 8 bits width, and higher nibble is called 'H' and lower 'L'.

The memory map for this virtual CPU is the same to the real data memory map of 4-bits CPU (uPD75316) of Aladin. Some addresses have special meanings to some CPU instructions: We assign a symbol to each of these addresses in order to simplify the explanation.

                      +--------+--------+ 
                Y :   | 0x011  | 0x010  |
                      +--------+--------+

                      +--------+--------+
                A :   | 0x013  | 0x012  |
                      +--------+--------+

                               +--------+
               DP :            | 0x014  |
                               +--------+

                      +--------+--------+
               BR :   | 0x015  | 0x014  |
                      +--------+--------+

Note: The CPU is 4-bits and big-endian, i.e., every address can hold 4 bits and every byte (8 bits) is stored in even address (higher nibble is located in higher address).

Next is the table of instruction set of the virtual CPU. Detailed explanation follows.

Mnemonic    Operand      Instruction Code
================================================
LD          H,#n4        I3 I2 I1 I0 1  0  0  1
            L,#n4        I3 I2 I1 I0 1  1  1  0
------------------------------------------------
PRINT       (HL+)        0  0  0  0  0  1  0  1
            (DP:HL+)     0  0  0  0  1  0  1  0
------------------------------------------------
ST          (HL+),#n4    I3 I2 I1 I0 0  0  1  1
            (DP:HL+),#n4 I3 I2 I1 I0 1  1  0  0
------------------------------------------------
OUT         (BR:Y),A     0  1  1  0  0  1  1  1
------------------------------------------------
IN          A,(BR:Y)     1  0  1  0  0  1  1  1
------------------------------------------------
EXIT                     1  1  1  0  0  1  1  1
------------------------------------------------
NOP                      1  1  1  1  1  1  1  1  
================================================

LD    H,#n4
          Load the immediate 4 bits value n4 = I3:I2:I1:I0 to register H.

LD    L,#n4
          Load the immediate 4 bits value n4 = I3:I2:I1:I0 to register L.

PRINT (HL+)
          Returns the 4 bits content of the address pointed by index 
          register HL.  The return value is sent to PC (or MemoMouse) 
          as an 8 bits value
                  I3 I2 I1 I0 0  1  1  0
          where I3:I2:I1:I0 is the content of the address.
          After the value was sent, the index register HL is incremented 
          by 1.

PRINT (DP:HL+)
          Returns the 4 bits content of the address designated by index
          register HL and memory location DP (0x0014). The address is
          calculated as
                  (DP << 8) + HL
          The return value is sent to PC (or MemoMouse) as an 8 bits value
                  I3 I2 I1 I0 0  1  1  0
          where I3:I2:I1:I0 is the content of the address.
          After the value was sent, the index register HL is incremented 
          by 1.  (Note: If index register HL overflows, it just becomes 
          zero and makes no influence to the content of DP.)

ST    (HL+),#n4
          Stores the immediate 4 bits value n4 = I3:I2:I1:I0 to the address
          pointed by index register HL.
          After storing the 4 bits, the index register HL is incremented 
          by 1.
          
ST    (DP:HL+),#n4
          Stores the immediate 4 bits value n4 = I3:I2:I1:I0 to the address
          designated by index register HL and memory location DP (0x0014).
          The address is calculated as
                  (DP << 8) + HL
          After storing the 4 bits, the index register HL is incremented 
          by 1.  (Note: If index register HL overflows, it just becomes 
          zero and makes no influence to the content of DP.)

OUT   (BR:Y),A
          Output a byte (8 bits) to the SRAM connected to I/O port.  
          The address in SRAM is calculated as
                  (BR & 0x0e) << 7 + Y
          and the byte to output is the content of memory location A.
          The value of BR should be in the form
                  BR = 0  0  1  0  I2 I1 I0 0
          i.e., higher nibble must be 0x2, and lsb of the byte must be zero.

IN    A,(BR:Y)
          Input a byte (8 bits) from the SRAM connected to I/O port.  
          The address in SRAM is calculated as
                  (BR & 0x0e) << 7 + Y.
          The value of BR should be in the form
                  BR = 0  0  1  0  I2 I1 I0 0
          i.e., higher nibble must be 0x2, and lsb of the byte must be zero.
          The input byte is stored at memory location A.  And also,
          the input byte is sent to PC (or MemoMouse) as two bytes
          sequence.  First, lower nibble I3:I2:I1:I0 is sent to PC (or 
          MemoMouse) as a byte
                  I3 I2 I1 I0 0  1  1  0
          and next, higher nibble I7:I6:I5:I4 is sent to PC (or MemoMouse)
          as a byte
                  I7 I6 I5 I4 0  1  1  0

EXIT
          Exit from "Interpreter Mode" and go to "1st logbook" display.

NOP
          Do nothing.  (This opcode is used by "WakeUp" function of DataTalk
          to detect whether Aladin is in "Interpreter Mode" or not.)


4. Special addresses in data memory of Aladin

There are special addresses in data memory of Aladin. If you change some contents of these addresses you can change the behavior of Aladin. The following are the addresses I know so far.

address  size (bits)   description
------------------------------------------------------------------------------
0x174    4             bit 3: always 1
                       bit 2: Unit (0: Metric, 1: Imperial)
                       bit 1: always 0
                       bit 0: always 0

0x2c0    8             Reserve (Air series only)  [0x2c0] (bar).

0x2e2    8             Breath warning sensitivity (Air series only).
                       Ranges are from 0x19 (insensitive) to 0x61 (sensitive).
                       The value is the same to the content of 0x7eb in 
                       Aladin download.

0x300    8             Aladin selftest status for DataTalk for DOS.
                       0x300 == 0 : Service necessary.
                             != 0 : Aladin is OK.
                       Note: MemoMouse or DataTalk for Windows seems not to 
                       use this info anymore.

0x31e    4             bit 3: always 0
                       bit 2: always 0
                       bit 1: Beep (0: Off, 1: On)
                       bit 0: Unit (0: Metric, 1: Imperial)

0x31f    4             Constant (0).

0x329    4             Maximum O2 partial pressure ppO2 (Aladin O2 only)
                       [0x329] * 0.05 + 1.2 (bar)
                       Warning!  All Aladin Nitroxen but O2 store this 
                       information in a different place (0x32b).

0x32b    4             Maximum O2 partial pressure ppO2 (All Aladin Nitroxen
                       but O2 only)
                       [0x32b] * 0.05 + 1.2 (bar)
                       Warning!  Aladin O2 store this information in a 
                       different place (0x329).

0x349    4             Premix reset after XX hours.  (Aladin O2 only)
                       The value is the same to the higher nibble of address
                       0x7d3 in Aladin download.

0x350    4             Maximum of vvO2 and SCR sensitivity (Aladin O2 only)
                       The value is the same to the higher nibble of address
                       0x7d2 in Aladin download.
------------------------------------------------------------------------------


5. Examples

All the following examples except Example 6 are actual sequences that Uwatec softwares (DOS or Windows versions of DataTalk) send to Aladin. There seems some "dead code" or unnecessary parts in the sequences but I recorded them here as they are.

---
Example 1.  DOS DataTalk -> Aladin Pro
            (Setting to metric and to beep off.)

;  Set 8 bits at address 0x7d2 of "download" to 0
19        LD    H,#1
0e        LD    L,#0               ; HL <- address of memory location Y (0x10)
23        ST    (HL+),#2
d3        ST    (HL+),#0xd         ; Y (0x10)  <- 0xd2
03        ST    (HL+),#0
03        ST    (HL+),#0           ; A (0x12)  <- 0
e3        ST    (HL+),#0xe
23        ST    (HL+),#2           ; BR (0x14) <- 0x2e
67        OUT   (BR:Y),A           ; (0x7d2) <- 0
;  Set 4 bits at data memory address 0x174 to 8
19        LD    H,#1
4e        LD    L,#4               ; HL <- address of memory location DP (0x14)
13        ST    (HL+),#1           ; DP (0x14) <- 1
79        LD    H,#7
4e        LD    L,#4               ; HL <- 0x74
8c        ST    (DP:HL+),#8        ; (0x174) <- 8
;  Set 8 bits at data memory address 0x31e to 0
19        LD    H,#1
4e        LD    L,#4               ; HL <- address of memory location DP (0x14)
33        ST    (HL+),#3           ; DP (0x14) <- 3
19        LD    H,#1
ee        LD    L,#0xe             ; HL <- 0x1e
0c        ST    (DP:HL+),#0        ; (0x31e) <- 0
0c        ST    (DP:HL+),#0        ; (0x31f) <- 0
;  Set 8 bits at address 0x7de of "download" to 0x28 
19        LD    H,#1
0e        LD    L,#0               ; HL <- address of memory location Y (0x10)
e3        ST    (HL+),#0xe
d3        ST    (HL+),#0xd         ; Y (0x10) <- 0xde
83        ST    (HL+),#8
23        ST    (HL+),#2           ; A (0x12) <- 0x28
e3        ST    (HL+),#0xe
23        ST    (HL+),#2           ; BR (0x14) <- 0x2e
67        OUT   (BR:Y),A           ; (0x7de) <- 0x28
;  Set 8 bits at data memory address 0x2c0 to 0x28
19        LD    H,#0x1
4e        LD    L,#0x4             ; HL <- address of memory location DP (0x14)
23        ST    (HL+),#2           ; DP (0x14) <- 2
c9        LD    H,#0xc
0e        LD    L,#0               ; HL <- 0xc0
8c        ST    (HL+),#8           ; (0x2c0) <- 8
2c        ST    (HL+),#2           ; (0x2c1) <- 2
;  Input 8 bits from address 0x7f1 of "download"
19        LD    H,#1
0e        LD    L,#0               ; HL <- address of memory location Y (0x10)
13        ST    (HL+),#1
f3        ST    (HL+),#0xf         ; Y (0x10) <- 0xf1
19        LD    H,#1
4e        LD    L,#4               ; HL <- address of memory location BR (0x14)
e3        ST    (HL+),#0xe
23        ST    (HL+),#2           ; BR (0x14) <- 0x2e
a7        IN    A,(BR:Y)           ; A <- (0x7f1)
;  Print the input value (4 bits only)
19        LD    H,#1
2e        LD    L,#2               ; HL <- address of memory location A (0x12)
05        PRINT (HL+)              ; content of A is printed
;  Print the 8 bits content of data memory address 0x300
19        LD    H,#1
4e        LD    L,#4               ; HL <- address of memory location DP (0x14)
33        ST    (HL+),#3           ; DP (0x14) <- 3
09        LD    H,#0
0e        LD    L,#0               ; HL <- 0
0a        PRINT (DP:HL+)           ; content of 0x300 is printed
0a        PRINT (DP:HL+)           ; content of 0x301 is printed
;  Exit from interpreter mode
e7        EXIT

---
Example 2.  DOS DataTalk -> Aladin Pro Ultra 
            (Setting to imperial, beep on and ppO2 = 1.50bar.)

;  Set 8 bits at address 0x7d3 of "download" to 6
19        LD    H,#1
0e        LD    L,#0
33        ST    (HL+),#3
d3        ST    (HL+),#0xd
63        ST    (HL+),#6
03        ST    (HL+),#0
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
67        OUT   (BR:Y),A
;  Set 4 bits at data memory address 0x32b to 6
19        LD    H,#1
4e        LD    L,#4
33        ST    (HL+),#3
29        LD    H,#2
be        LD    L,#0xb
6c        ST    (DP:HL+),#6
;
;  The following is the same as Example 1.
;
19        LD    H,#1
0e        LD    L,#0
23        ST    (HL+),#2
d3        ST    (HL+),#0xd
33        ST    (HL+),#3
03        ST    (HL+),#0
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
67        OUT   (BR:Y),A
19        LD    H,#1
4e        LD    L,#4
13        ST    (HL+),#1
79        LD    H,#7
4e        LD    L,#4
cc        ST    (DP:HL+),#0xc
19        LD    H,#1
4e        LD    L,#4
33        ST    (HL+),#3
19        LD    H,#1
ee        LD    L,#0xe
3c        ST    (DP:HL+),#3
0c        ST    (DP:HL+),#0
19        LD    H,#1
0e        LD    L,#0
e3        ST    (HL+),#3
d3        ST    (HL+),#0xd
83        ST    (HL+),#8
23        ST    (HL+),#2
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
67        OUT   (BR:Y),A
19        LD    H,#1
4e        LD    L,#4
23        ST    (HL+),#2
c9        LD    H,#0xc
0e        LD    L,#0
8c        ST    (HL+),#8
2c        ST    (HL+),#2
19        LD    H,#1
0e        LD    L,#0
13        ST    (HL+),#1
f3        ST    (HL+),#0xf
19        LD    H,#1
4e        LD    L,#4
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
a7        IN    A,(BR:Y)
19        LD    H,#1
2e        LD    L,#2
05        PRINT (HL+)
19        LD    H,#1
4e        LD    L,#4
33        ST    (HL+),#3
09        LD    H,#0
0e        LD    L,#0
0a        PRINT (DP:HL+)
0a        PRINT (DP:HL+)
;  Exit from interpreter mode
e7        EXIT


---
Example 3.  DOS DataTalk -> Aladin Pro 
            (Wakeup.)

;  Reset
ff        NOP
; Input 8 bits from address 0x7bc of "download"
19        LD    H,#1
0e        LD    L,#0
c3        ST    (HL+),#0xc
b3        ST    (HL+),#0xb
19        LD    H,#1
4e        LD    L,#4
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
a7        IN    A,(BR:Y)
; Print the input value (lower nibble)
19        LD    H,#1
2e        LD    L,#2
05        PRINT (HL+)
; Print the input value (higher nibble)
05        PRINT (HL+)
; Input 8 bits from address 0x7d2 of "download"
19        LD    H,#1
0e        LD    L,#0
23        ST    (HL+),#2
d3        ST    (HL+),#0xd
19        LD    H,#1
4e        LD    L,#4
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
a7        IN    A,(BR:Y)
; Print the input value (lower nibble)
19        LD    H,#1
2e        LD    L,#2
05        PRINT (HL+)
; Print the input value (higher nibble)
05        PRINT (HL+)
; Input 8 bits from address 0x7d2 of "download"
; Note: These are not wrong.  DataTalk for DOS actually do like the following. 
; Very strange... The address 0x7d2 is read again...
19        LD    H,#1
0e        LD    L,#0
23        ST    (HL+),#2
d3        ST    (HL+),#0xd
19        LD    H,#1
4e        LD    L,#4
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
a7        IN    A,(BR:Y)
; Print the input value (lower nibble)
19        LD    H,#1
2e        LD    L,#2
05        PRINT (HL+)
; Print the input value (higher nibble)
05        PRINT (HL+)
; Input 8 bits from address 0x7de of "download"
19        LD    H,#1
0e        LD    L,#0
e3        ST    (HL+),#0xe
d3        ST    (HL+),#0xd
19        LD    H,#1
4e        LD    L,#4
e3        ST    (HL+),#0xe
23        ST    (HL+),#0x2
a7        IN    A,(BR:Y)
; Print the input value (lower nibble)
19        LD    H,#1
2e        LD    L,#2
05        PRINT (HL+)
; Print the input value (higher nibble)
05        PRINT (HL+)
; Input 8 bits from address 0x7eb of "download"
19        LD    H,#1
0e        LD    L,#0
b3        ST    (HL+),#0xb
e3        ST    (HL+),#0xe
19        LD    H,#1
4e        LD    L,#4
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
a7        IN    A,(BR:Y)
; Print the input value (lower nibble)
19        LD    H,#1
2e        LD    L,#2
05        PRINT (HL+)
; Print the input value (higher nibble)
05        PRINT (HL+)
; Input 8 bits from address 0x7d3 of "download"
19        LD    H,#1
0e        LD    L,#0
33        ST    (HL+),#3
d3        ST    (HL+),#0xd
19        LD    H,#1
4e        LD    L,#0xe
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
a7        IN    A,(BR:Y)
; Print the input value (lower nibble)
19        LD    H,#1
2e        LD    L,#2
05        PRINT (HL+)
; Print the input value (higher nibble)
05        PRINT (HL+)
; Input 8 bits from address 0x7e1 of "download"
19        LD    H,#1
0e        LD    L,#0
13        ST    (HL+),#1
e3        ST    (HL+),#0xe
19        LD    H,#1
4e        LD    L,#4
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
a7        IN    A,(BR:Y)
; Print the input value (lower nibble)
19        LD    H,#1
2e        LD    L,#2
05        PRINT (HL+)
; Print the input value (higher nibble)
05        PRINT (HL+)
; Input 8 bits from address 0x7f0 of "download"
19        LD    H,#1
0e        LD    L,#0
03        ST    (HL+),#0
f3        ST    (HL+),#0xf
19        LD    H,#1
4e        LD    L,#4
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
a7        IN    A,(BR:Y)
; Print the input value (lower nibble)
19        LD    H,#1
2e        LD    L,#2
05        PRINT (HL+)
; Print the input value (higher nibble)
05        PRINT (HL+)
; Input 8 bits from address 0x7f1 of "download"
19        LD    H,#1
0e        LD    L,#0
13        ST    (HL+),#1
f3        ST    (HL+),#0xf
19        LD    H,#1
4e        LD    L,#4
e3        ST    (HL+),#0xe
23        ST    (HL+),#0x2
a7        IN    A,(BR:Y)
; Print the input value (lower nibble)
19        LD    H,#1
2e        LD    L,#2
05        PRINT (HL+)
; Print the input value (higher nibble)
05        PRINT (HL+)
; Input 8 bits from address 0x7f3 of "download"
19        LD    H,#1
0e        LD    L,#0
33        ST    (HL+),#3
f3        ST    (HL+),#0xf
19        LD    H,#1
4e        LD    L,#4
e3        ST    (HL+),#0xe
23        ST    (HL+),#0x2
a7        IN    A,(BR:Y)
; Print the input value (lower nibble)
19        LD    H,#1
2e        LD    L,#2
05        PRINT (HL+)
; Print the input value (higher nibble)
05        PRINT (HL+)
; Input 8 bits from address 0x7f2 of "download"
19        LD    H,#1
0e        LD    L,#0
23        ST    (HL+),#2
f3        ST    (HL+),#0xf
19        LD    H,#1
4e        LD    L,#4
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
a7        IN    A,(BR:Y)
; Print the input value (lower nibble)
19        LD    H,#1
2e        LD    L,#2
05        PRINT (HL+)
; Print the input value (higher nibble)
05        PRINT (HL+)
; Input 8 bits from address 0x7f1 of "download"
; Note: These are not wrong.  DataTalk for DOS actually do like the following. 
; Very strange... The address 0x7f1 is read again and higher nibble is 
; discarded...
19        LD    H,#1
0e        LD    L,#2
13        ST    (HL+),#1
f3        ST    (HL+),#0xf
19        LD    H,#1
4e        LD    L,#4
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
a7        IN    A,(BR:Y)
; Print the input value (lower nibble)
19        LD    H,#1
2e        LD    L,#2
05        PRINT (HL+)
; Print the 8 bit content of data memory address 0x300
19        LD    H,#1
4e        LD    L,#4
33        ST    (HL+),#3
09        LD    H,#0
0e        LD    L,#0
0a        PRINT (DP:HL+)
0a        PRINT (DP:HL+)
; Exit from interpreter mode
e7        EXIT


---
Example 4.  MemoMouse -> Aladin AirX O2 
            (Setting to metric, beep on, ppO2 = 1.50bar, premix reset after
             48 hours, reserve = 40bar, breath sensitivity = 0, 
             vvO2 = very high, and SCR sensitivity = 1.)

;  Set 4 bits at data memory address 0x174 to 8
19        LD    H,#1
4e        LD    L,#4
13        ST    (HL+),#1
79        LD    H,#7
4e        LD    L,#4
8c        ST    (DP:HL+),#8
;  Set 4 bits at data memory address 0x31e to 2
19        LD    H,#1
4e        LD    L,#4
33        ST    (HL+),#3
19        LD    H,#1
ee        LD    L,#0xe
2c        ST    (DP:HL+),#2
;  Set 8 bits at address 0x7d2 of "download" to 0xf2
19        LD    H,#1
0e        LD    L,#0
23        ST    (HL+),#2
d3        ST    (HL+),#0xd
23        ST    (HL+),#2
f3        ST    (HL+),#0xf
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
67        OUT   (BR:Y),A
;  Set 4 bits at data memory address 0x2c0 to 8
19        LD    H,#1
4e        LD    L,#4
23        ST    (HL+),#2
c9        LD    H,#0xc
0e        LD    L,#0
8c        ST    (DP:HL+),#8
;  Set 4 bits at data memory address 0x2c1 to 2
19        LD    H,#1
4e        LD    L,#4
23        ST    (HL+),#2
c9        LD    H,#0xc
1e        LD    L,#1
2c        ST    (DP:HL+),#2
;  Set 8 bits at address 0x7de of "download" to 0x28
19        LD    H,#1
0e        LD    L,#0
e3        ST    (HL+),#0xe
d3        ST    (HL+),#0xd
83        ST    (HL+),#8
23        ST    (HL+),#2
e3        ST    (HL+),#0xe
23        ST    (HL+),#0x2
67        OUT   (BR:Y),A
;  Set 4 bits at data memory address 0x2e2 to 4
19        LD    H,#1
4e        LD    L,#4
23        ST    (HL+),#2
e9        LD    H,#0xe
2e        LD    L,#2
4c        ST    (DP:HL+),#4
;  Set 4 bits at data memory address 0x2e3 to 3
19        LD    H,#1
4e        LD    L,#4
23        ST    (HL+),#3
e9        LD    H,#0xe
3e        LD    L,#3
3c        ST    (DP:HL+),#3
;  Set 8 bits at address 0x7eb of "download" to 0x34
19        LD    H,#1
0e        LD    L,#0
b3        ST    (HL+),#0xb
e3        ST    (HL+),#0xe
43        ST    (HL+),#4
33        ST    (HL+),#3
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
67        OUT   (BR:Y),A
;  Set 4 bits at data memory address 0x329 to 6
19        LD    H,#1
4e        LD    L,#4
33        ST    (HL+),#3
29        LD    H,#2
9e        LD    L,#9
6c        ST    (DP:HL+),#6
;  Set 8 bits at address 0x7d3 of "download" to 0xe6
19        LD    H,#1
0e        LD    L,#0
33        ST    (HL+),#3
d3        ST    (HL+),#0xd
63        ST    (HL+),#6
e3        ST    (HL+),#0xe
e3        ST    (HL+),#0xe
23        ST    (HL+),#2
67        OUT   (BR:Y),A
;  Set 4 bits at data memory address 0x349 to 0xe
19        LD    H,#1
4e        LD    L,#4
33        ST    (HL+),#3
49        LD    H,#4
9e        LD    L,#9
ec        ST    (DP:HL+),#0xe
;  Set 4 bits at data memory address 0x350 to 0xf
19        LD    H,#1
4e        LD    L,#4
33        ST    (HL+),#3
59        LD    H,#5
0e        LD    L,#0
fc        ST    (DP:HL+),#0xf
;  Exit from interpreter mode
e7        EXIT


---
Example 5.  MemoMouse -> Aladin Pro (or Aladin AirX O2)
            (Wakeup.)

;
ff        NOP
;  Print the 4 bits content of data memory address 0x300.
19        LD    H,#1
4e        LD    L,#4
33        ST    (HL+),#3
09        LD    H,#0
0e        LD    L,#0
0a        PRINT (DP:HL+)
;
e7        EXIT


---
Example 6.  Read all the contents of Aladin data memory

;  Read addresses 0x000 -- 0x0ff
19        LD    H,#1
4e        LD    L,#4
03        ST    (HL+),#0
09        LD    H,#0
0e        LD    L,#0
0a        PRINT (DP:HL+)
0a        PRINT (DP:HL+)
    ... (repeat this for 256 times) ...
0a        PRINT (DP:HL+)
;  Read addresses 0x100 -- 0x1ff
19        LD    H,#1
4e        LD    L,#4
13        ST    (HL+),#1
09        LD    H,#0
0e        LD    L,#0
0a        PRINT (DP:HL+)
0a        PRINT (DP:HL+)
    ... (repeat this for 256 times) ...
0a        PRINT (DP:HL+)
;  Read addresses 0x200 -- 0x2ff
19        LD    H,#1
4e        LD    L,#4
23        ST    (HL+),#2
09        LD    H,#0
0e        LD    L,#0
0a        PRINT (DP:HL+)
0a        PRINT (DP:HL+)
    ... (repeat this for 256 times) ...
0a        PRINT (DP:HL+)
;  Read addresses 0x300 -- 0x3ff
19        LD    H,#1
4e        LD    L,#4
23        ST    (HL+),#3
09        LD    H,#0
0e        LD    L,#0
0a        PRINT (DP:HL+)
0a        PRINT (DP:HL+)
    ... (repeat this for 256 times) ...
0a        PRINT (DP:HL+)
;  Read I/O ports 0xf80 -- 0xfff
19        LD    H,#1
4e        LD    L,#4
f3        ST    (HL+),#f
89        LD    H,#8
0e        LD    L,#0
0a        PRINT (DP:HL+)
0a        PRINT (DP:HL+)
    ... (repeat this for 128 times) ...
0a        PRINT (DP:HL+)
;  Exit from interpreter mode
e7        EXIT