Author Topic: WARNING! usb8x crossing  (Read 10032 times)

0 Members and 2 Guests are viewing this topic.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: WARNING! usb8x crossing
« Reply #15 on: June 26, 2010, 08:14:29 pm »
SirCmpwn: did 8 minutes kill you? well, let's get back on topic, shall we?
Excuse you?

Also, FAT32 would be a nice feature, although I would just reformat it as FAT.
FAT and FAT32 are the same thing. However, msd8x supports only FAT16 at the moment, which means most modern flash drives won't work with it.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline BrandonW

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +38/-1
    • View Profile
Re: WARNING! usb8x crossing
« Reply #16 on: June 26, 2010, 08:16:28 pm »
"FAT" in Windows is actually FAT16 (or it could be FAT12, Microsoft doesn't distinguish). FAT32 is FAT32.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: WARNING! usb8x crossing
« Reply #17 on: June 26, 2010, 08:18:12 pm »
"FAT" in Windows is actually FAT16 (or it could be FAT12, Microsoft doesn't distinguish). FAT32 is FAT32.

Oh whoops, I got a little mixed up there :P
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline yoman82

  • LV3 Member (Next: 100)
  • ***
  • Posts: 71
  • Rating: +1/-1
    • View Profile
Re: WARNING! usb8x crossing
« Reply #18 on: June 26, 2010, 08:28:43 pm »
Yep, so we can mess around with Blue8x, like I've asked for several times :)
Yeah, did a working demo of blue8x ever come out? It was intriguing.

Offline quasi_Phthalo

  • LV3 Member (Next: 100)
  • ***
  • Posts: 90
  • Rating: +1/-1
    • View Profile
Re: WARNING! usb8x crossing
« Reply #19 on: June 26, 2010, 08:38:58 pm »
ok, i've tried breaking the read up into 3 256-bytes chunks with error checks in between, still to no avail.
can anyone else see anything i might have overlooked? if not, i'll have to assume the issue is outside my program, and either in USB8x or the flash drive itself. Seeing as the drive works fine with my computer, all fingers are pointing to USB8x
« Last Edit: June 26, 2010, 08:39:21 pm by quasi_Phthalo »

Offline BrandonW

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +38/-1
    • View Profile
Re: WARNING! usb8x crossing
« Reply #20 on: June 26, 2010, 08:45:00 pm »
I point to you, because msd8x can read and write large variables for myself and many others.

Programs have also been written (not publicly released) that stream video from a flash drive, which it seems like that's what you're doing. They read 512 bytes at a time, which is the size of one sector, and it means the driver doesn't have to span sectors to read a chunk of data.

You might want to post a little more of your code, specifically setting up usb8x itself and where all the equates are.

usb8x can be quirky from an assembly program (versus a Flash application)...perhaps there's some assumption the driver(s) are making that doesn't work in your situation.

Offline quasi_Phthalo

  • LV3 Member (Next: 100)
  • ***
  • Posts: 90
  • Rating: +1/-1
    • View Profile
Re: WARNING! usb8x crossing
« Reply #21 on: June 26, 2010, 11:20:25 pm »
what does MSD_cacheOn do? I might be overlooking the page, but there seems to be a lack of documentation on that U_CALL. MSD8x uses it, but i see it was only recently added to usb8x.

anyway, here's the code with init. i'm pretty sure i modeled it after msd8x pretty well:
Code: [Select]
#define numFrames 6360
#define fileName  "/bwmov.bin",0

.org $9D95

Initialize:
xor a
out (28h),a
inc a
out (20h),a
call U_CALL_INIT
jp c,NotInstalled
ld hl,USBDriverBuf
u_call(uDriverInit)
ld hl,appBackUpScreen
ld de,appBackUpScreen+256
u_call(uMSD_Initialize)
jr nc,_success

u_call(uHostKill)
u_call(uDriverKill)
b_call(_ClrLCDFull)
b_call(_HomeUp)
ld hl,sReconnect
call IPutS
call IGetKey
cp kClear
jp z,Exit
jr Initialize

fileHandle: .block 27

_success:
u_call(uUFI_Initialize)
jp c,USBError
u_call(uFAT_Initialize)
jp c,USBError
b_call(_RunIndicOff)
ld hl,sName
ld de,fileHandle
u_call(uDOS_openFile)
jp c,NoFile
NextFrame:
ld hl,fileHandle
ld de,plotSScreen
ld bc,768
u_call(uDOS_fileRead)
jp c,FileReadError
ld hl,768
sbc hl,bc
ld a,l
cp 0
jp nz,FileReadError
ld a,h
cp 0
jp nz,FileReadError
b_call(_GrBufCpy)
b_call(_GetCSC)
cp skClear
jp z,Exit
ld de,(FramesLeft)
dec de
ld (FramesLeft),de
ld a,e
cp 0
jr nz,NextFrame
ld a,d
cp 0
jp nz,NextFrame
jp Exit

USBDriverCall: .block 32

FramesLeft: ;not static
.dw numFrames

sName:
.db fileName

Exit:
u_call(uHostKill)
u_call(uDriverKill)
b_call(_GrBufClr)
b_call(_ClrScrnFull)
b_call(_HomeUp)
CallBack:
ret

USBDriverBuf: .block 128

U_CALL_INIT:
ld hl,uuAppName
.db rMOV9TOOP1
b_call(_FindApp)
jr c,uuDone
ld de,USBDriverCall
ld hl,uuDriverCode
ld bc,uuDriverSize-uuDriverCode
ldir
ld (USBDriverCall+uuMod1-uuDriverCode+1),a
in a,(6)
ld (USBDriverCall+uuMod3-uuDriverCode+1),a
or a
jr uuDone
uuAppName:
.db $14,"USBDRV8X",0
uuDriverCode:
push af
in a,(6)
ld (USBDriverCall+uuMod2-uuDriverCode+1),a
call USBDriverCall+uuCall1-uuDriverCode
pop af
call USBDriverEntryPoint
push af
uuMod2:
ld a,0
out (6),a
pop af
ret
uuCallBack:
uuMod3:
ld a,0
out (6),a
call CallBack
uuCall1:
uuMod1:
ld a,0
out (6),a
ret
uuDriverSize:
uuDone:
ret

« Last Edit: June 26, 2010, 11:54:15 pm by quasi_Phthalo »

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: WARNING! usb8x crossing
« Reply #22 on: June 27, 2010, 11:41:14 am »
I attempted to hack in FAT32 support long ago but failed. It would require a from-scratch rewrite of all the code, which probably needs to happen anyway.

Yep, so we can mess around with Blue8x, like I've asked for several times :)
I don't remember you asking for that, but yeah, that's the main priority for getting an update out.

I'd love a rewrite to usb8x.  I just got my adapter and am about to try it out on a newer 84+se.  I'll let you know how it turns out. ;D

Quasi, good luck getting this to work!  Oh, and don't worry about those 8 minutes. :)
« Last Edit: June 27, 2010, 11:41:51 am by ztrumpet »

Offline BrandonW

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +38/-1
    • View Profile
Re: WARNING! usb8x crossing
« Reply #23 on: June 27, 2010, 11:50:36 am »
Not rewriting usb8x, just the mass storage driver (the part I wrote).

Why doesn't your code have $BB, $6D at the start? Nothing else jumps out at me at first glance.

EDIT: MSD_CacheOn attempts to enable sector read caching so that if you try to read the same sector more than once, it won't go to the drive first. If I remember correctly, this uses the extra RAM pages, so it should probably be revisited because of the newer 84+/SEs.

A working demo of Blue8x is mostly dependent on the usb8x update.

You might want to try reading 512 bytes at a time instead just to see if you get the right data. There could be some issue with reading 768 bytes at a time, but it's sounding more like there's memory corruption going on. You might also want to display the contents of the file handle memory both before and after each call, pausing for a keypress each time, and see if it goes wonky while in the call to DOS_fileRead.
« Last Edit: June 27, 2010, 11:57:47 am by BrandonW »

Offline quasi_Phthalo

  • LV3 Member (Next: 100)
  • ***
  • Posts: 90
  • Rating: +1/-1
    • View Profile
Re: WARNING! usb8x crossing
« Reply #24 on: June 27, 2010, 02:18:08 pm »
Quote
Why doesn't your code have $BB, $6D at the start? Nothing else jumps out at me at first glance.
i'm a purist: i don't want to mar my program with a TI token. i let my 8xp packer to do that for me.

so, i took your advice, and watched the file handle. I HIGHLY doubt that it's coincidence that the garbage data comes in on the very frame at which the seek pointer carries to the second third byte (editted). Also, the 'type' of garbage changes at every carry.

and i took you other advice to only read 512 at a time: same issue in the same place

editted
« Last Edit: June 27, 2010, 04:01:44 pm by quasi_Phthalo »

Offline BrandonW

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +38/-1
    • View Profile
Re: WARNING! usb8x crossing
« Reply #25 on: June 27, 2010, 02:22:06 pm »
so, i took your advice, and watched the file handle. I HIGHLY doubt that it's coincidence that the garbage data comes in on the very frame at which the seek pointer carries to the second byte. Also, the 'type' of garbage changes at every carry.

I didn't catch that you said this was happening. That certainly sounds like a usb8x bug...I'll look into it.
Perhaps as a temporary workaround, you could change the seek pointer yourself (I can't remember how simple or complex DOS_fileSeek actually is).

Offline quasi_Phthalo

  • LV3 Member (Next: 100)
  • ***
  • Posts: 90
  • Rating: +1/-1
    • View Profile
Re: WARNING! usb8x crossing
« Reply #26 on: June 27, 2010, 02:26:33 pm »
Quote
you could change the seek pointer yourself
i've tried that (See one of my earlier code postings) and it works for the most part (sometimes a single frame will be half garbage)
except, since the file i'm using is large, the seek time gets longer and longer the farther you go, until it's eventually impractical to try to play a movie.

i've editted an earlier post. the garbage was actually happening when the seek pointer carried to the THIRD byte, not second
« Last Edit: June 27, 2010, 04:05:28 pm by quasi_Phthalo »

Offline mapar007

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 550
  • Rating: +28/-5
  • The Great Mata Mata
    • View Profile
Re: WARNING! usb8x crossing
« Reply #27 on: June 28, 2010, 05:05:52 am »
msd8x is just an interface to the MSD driver in usb8x. The MSD driver is only in usb8x. There was a time when the driver was in msd8x itself, but it has since been shifted and integrated into usb8x itself.

So msd8x is just the interface (and it uses the extra RAM pages, which is why it doesn't work on newer 84+/SEs -- the MSD driver itself still works on those models).

Thanks for reminding me, seems I was wrong :)

Offline quasi_Phthalo

  • LV3 Member (Next: 100)
  • ***
  • Posts: 90
  • Rating: +1/-1
    • View Profile
Re: WARNING! usb8x crossing
« Reply #28 on: June 28, 2010, 10:37:24 pm »
ok, so i've made it so that it re-seeks on the reads that would carry the seek pointer to the third byte as a temporary work around. i hope this can be fixed eventually, because the seek delay every 33ish frames starts to get really annoying towards the end when it's the longest