Scratching my head with this FSRW code... need some help
I am trying to write a block of data from dat to a uSD card. I can't seem to make this work. What am I doing wrong?
Forgot to mention that this is what I see:

Edit: Added screen shot of PST
con
_clkmode = xtal1 + pll16x
_clkfreq = 80_000_000
MS_001 = 80_000_000 / 1_000
SD_DO = 0 ' SD card pins
SD_CLK = 1
SD_DI = 2
SD_CS = 3
obj
term : "fullduplexserialplus" ' for terminal output
sd : "fsrw" ' SD card routines
var
pub main | b, i, l, m, num_bytes
term.start(31, 30, %0000, 115_200) ' start terminal (use PST)
pause(500)
term.tx(0) ' clear screen
m := \sd.mount(SD_DO) ' start sd object and mount card
if m == 0
term.str(string("SD card mounted OK", 13))
else
term.str(string("SD card failed to mount / not present", 13))
term.str(@version) ' display version on PST
l := \sd.popen(string("test.txt"),"w") ' open file for writing on sd card called test.txt
if l == 0
term.str(string("test.txt file opened", 13))
else
term.str(string("File failed to open", 13))
i := 0 ' initialize index
repeat i from 0 to 270 ' cycle through data and write to sd card
b := \sd.pwrite(data[i], 2)
term.dec(i) ' show index counter on PST
term.tx(32)
term.tx(13)
term.dec(b) ' show number of bytes written to card
term.tx(13)
pause(1000)
l := \sd.pclose ' close sd card file
if l == 0
term.str(string("File closed", 13))
else
term.str(string("File failed to close", 13))
pub pause(ms) | t
t := cnt
repeat ms
waitcnt(t += MS_001)
dat
version byte "sniff_playground", 13, 0
data byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00
byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00
byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00
byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00
byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00
byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00
byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00
byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00
byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00
byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00
Forgot to mention that this is what I see:

Edit: Added screen shot of PST

Comments
I should also mention I'm using Martins new DNA board and 2 GB sd card.
Here's my new code:
con _clkmode = xtal1 + pll16x _clkfreq = 80_000_000 MS_001 = 80_000_000 / 1_000 SD_DO = 0 ' SD card pins SD_CLK = 1 SD_DI = 2 SD_CS = 3 obj term : "fullduplexserialplus" ' for terminal output sd : "fsrw" ' SD card routines var pub main | b, i, l, m, num_bytes term.start(31, 30, %0000, 115_200) ' start terminal (use PST) pause(500) term.tx(0) ' clear screen m := \sd.mount(SD_DO) ' start sd object and mount card if m < 0 term.str(string("SD card failed to mount / not present", 13)) abort else term.str(string("SD card mounted OK", 13)) term.str(@version) ' display version on PST l := \sd.popen(string("test.txt"),"w") ' open file for writing on sd card called test.txt if l < 0 term.str(string("File failed to open", 13)) else term.str(string("test.txt file opened", 13)) i := 0 ' initialize index repeat i from 0 to 270 - 1 ' cycle through data and write to sd card b := \sd.pwrite(@data[i], 2) term.dec(i) ' show index counter on PST term.tx(32) term.tx(13) term.dec(b) ' show number of bytes written to card term.tx(13) pause(1000) l := \sd.pclose ' close sd card file if l < 0 term.str(string("File failed to close", 13)) else term.str(string("File closed", 13)) l := \sd.unmount if l < 0 term.str(string("Failed to unmount", 13)) else term.str(string("Card unmounted", 13)) pub pause(ms) | t t := cnt repeat ms waitcnt(t += MS_001) dat version byte "sniff_playground", 13, 0 data byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00PST screen shot:
Notepad screen shot:
How do I store it as hex data? I know this may seem elementary to some but it's confusing to me sometimes....
Here's my code:
con _clkmode = xtal1 + pll16x _clkfreq = 80_000_000 MS_001 = 80_000_000 / 1_000 SD_DO = 0 ' SD card pins SD_CLK = 1 SD_DI = 2 SD_CS = 3 obj term : "fullduplexserialplus" ' for terminal output sd : "fsrw2_6A" ' SD card routines var byte buf[500] pub main | b, i, l, m, num_bytes term.start(31, 30, %0000, 115_200) ' start terminal (use PST) pause(500) term.tx(0) ' clear screen m := \sd.mount(SD_DO) ' start sd object and mount card if m < 0 term.str(string("SD card failed to mount / not present", 13)) abort else term.str(string("SD card mounted OK", 13)) term.str(@version) ' display version on PST l := \sd.popen(string("test.txt"),"w") ' open file for writing on sd card called test.txt if l < 0 term.str(string("File failed to open", 13)) else term.str(string("test.txt file opened in write mode", 13)) sd.pwrite(@data{0}, 269) pause(1000) l := \sd.pclose ' close sd card file if l < 0 term.str(string("File failed to close", 13)) else term.str(string("File closed", 13)) pause(1000) l := \sd.popen(string("test.txt"),"r") ' open file for writing on sd card called test.txt if l < 0 term.str(string("File failed to open", 13)) else term.str(string("test.txt file opened in read mode", 13)) l := \sd.pread(@buf[0], 269) if l > -1 term.str(string("Done", 13)) pause(1000) l := \sd.unmount if l < 0 term.str(string("Failed to unmount", 13)) else term.str(string("Card unmounted", 13)) pause(1000) num_bytes := 270 repeat i from 0 to num_bytes - 1 term.hex((buf[i]), 2) i++ pub pause(ms) | t t := cnt repeat ms waitcnt(t += MS_001) dat version byte "sniff_playground", 13, 0 data byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 byte $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00, $0B, $0B, $00, $33, $33, $00, $10, $10, $00 data1 byte "0B0B003333001010000B0B003333001010000B0B00333300101000" byte "0B0B003333001010000B0B003333001010000B0B00333300101000" byte "0B0B003333001010000B0B003333001010000B0B00333300101000" byte "0B0B003333001010000B0B003333001010000B0B00333300101000" byte "0B0B003333001010000B0B003333001010000B0B00333300101000" byte "0B0B003333001010000B0B003333001010000B0B00333300101000" byte "0B0B003333001010000B0B003333001010000B0B00333300101000" byte "0B0B003333001010000B0B003333001010000B0B00333300101000" byte "0B0B003333001010000B0B003333001010000B0B00333300101000" byte "0B0B003333001010000B0B003333001010000B0B00333300101000"And here's what it prints out:
Any ideas?
That did it! Thanks. You're a genius! Thats what was causing it to skip over data.
Thanks again. Marking this solved.