l = p_get_size (0, 4)
a = p_get_adr (0, 4)
m = 1024
off = 0
v = wr_reg (0x602, 0x05, 1) // reset mcu
v = wr_reg (0x0d, 0x01, 1) // set csn high
v = wr_reg (0x0d, 0x00, 1) // set csn low
v = wr_reg (0x0c, 0x03, 1) // send read command
v = p_get_adr(2, 1) // get address byte2
v = wr_reg (0x0c, v, 1) // send a2
v = p_get_adr(1, 1) // get address byte1
v = wr_reg (0x0c, v, 1) // send a1
v = p_get_adr(0, 1) // get address byte0
v = wr_reg (0x0c, v, 1) // send a0
v = wr_reg (0x0c, 0x00, 1) // launch first read
v = wr_reg (0x0d, 0x0a, 1) // set auto read mode
while (l>0)
if (l>m) then
n = m
else
n = l
endif
t = rd_fifo (0x0c, off, n) // read n byte from address 0x0c
v = p_dis_buf(off, n)
l = l - n
a = a + n
wend
a = wr_reg (0x0d, 0x01, 1) // set csn high