Getting data to/from the X16

Chat about anything CX16 related that doesn't fit elsewhere
Elektron72
Posts: 137
Joined: Tue Jun 30, 2020 3:47 pm

Getting data to/from the X16

Post by Elektron72 »


According to the release notes in the x16-rom repo, some recent changes to the load routine (specifically, the addition of block-loading capabilities) have made it possible to load files from the SD card at 140 KB/s.

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

Getting data to/from the X16

Post by rje »


Thank you for pointing that out... I'll look thru the pull requests for comments.  140 k/s would certainly be plenty fast.

 

Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

Getting data to/from the X16

Post by Ed Minchau »



3 hours ago, Elektron72 said:




According to the release notes in the x16-rom repo, some recent changes to the load routine (specifically, the addition of block-loading capabilities) have made it possible to load files from the SD card at 140 KB/s.



Yeah, and because it loads through VERA, the load speeds directly to VRAM should be 2-3 times faster; I've been estimating 300kb/s.

Elektron72
Posts: 137
Joined: Tue Jun 30, 2020 3:47 pm

Getting data to/from the X16

Post by Elektron72 »



48 minutes ago, Ed Minchau said:




Yeah, and because it loads through VERA, the load speeds directly to VRAM should be 2-3 times faster; I've been estimating 300kb/s.



Could you explain why loading to VRAM would be faster? As far as I understand, the data would still need to pass through the CPU before being transferred to VRAM.

Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

Getting data to/from the X16

Post by Ed Minchau »



1 hour ago, Elektron72 said:




Could you explain why loading to VRAM would be faster? As far as I understand, the data would still need to pass through the CPU before being transferred to VRAM.



It's the other way around. The SD card goes to an IEC2SD implemented on VERA, which then has to push it through the CPU to RAM. Just loading directly to VRAM skips about eleven 8MHz cpu cycles per byte that would be required to push it to RAM and increment the RAM address, and VERA operates at 25MHz and can autoincrement. A 300kbps estimate is conservative, about eighty 25MHz cycles per byte. 

Elektron72
Posts: 137
Joined: Tue Jun 30, 2020 3:47 pm

Getting data to/from the X16

Post by Elektron72 »



48 minutes ago, Ed Minchau said:




It's the other way around. The SD card goes to an IEC2SD implemented on VERA, which then has to push it through the CPU to RAM. Just loading directly to VRAM skips about eleven 8MHz cpu cycles per byte that would be required to push it to RAM and increment the RAM address, and VERA operates at 25MHz and can autoincrement. A 300kbps estimate is conservative, about eighty 25MHz cycles per byte. 



While both VRAM and the SPI port are on VERA, the VERA documentation does not describe a mechanism by which a direct transfer between the SD card and VRAM could be performed. Looking at the kernal load routine (in kernal/cbm/channel/load.s), loading to VRAM involves the CPU manually loading bytes into VERA's DATA0 port. This doesn't use the block-loading API, so loading to VRAM will likely be slower than loading to RAM.

BruceMcF
Posts: 1336
Joined: Fri Jul 03, 2020 4:27 am

Getting data to/from the X16

Post by BruceMcF »



12 hours ago, Ed Minchau said:




It's the other way around. The SD card goes to an IEC2SD implemented on VERA, which then has to push it through the CPU to RAM.



Last time I read the Vera doc, it appeared to just be an SPI port with a 12.5MHz serial clock normally, fitting within the regular maximum 20MHz serial clock for accessing the SD card in SPI mode, and a slower serial clock for the phase of starting an SD card into SPI mode that is specified at a lower top speed limit.

It's not clear why it would be necessary to implement an IEC2SD on Vera when the byte to/from the SPI is directly addressed in the memory mapped I/O space, and the 65c02 is perfectly capable of doing SPI mode SD card operations, but in any event, I don't recall any mention of the coprocessor on Vera that would be required to go that route.

Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

Getting data to/from the X16

Post by Ed Minchau »



14 hours ago, Elektron72 said:




While both VRAM and the SPI port are on VERA, the VERA documentation does not describe a mechanism by which a direct transfer between the SD card and VRAM could be performed. Looking at the kernal load routine (in kernal/cbm/channel/load.s), loading to VRAM involves the CPU manually loading bytes into VERA's DATA0 port. This doesn't use the block-loading API, so loading to VRAM will likely be slower than loading to RAM.



That's definitely not what the emulator is doing. Data loaded directly to VRAM doesn't touch the CPU at all.

SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

Getting data to/from the X16

Post by SlithyMatt »



14 minutes ago, Ed Minchau said:




That's definitely not what the emulator is doing. Data loaded directly to VRAM doesn't touch the CPU at all.



Is that the case when using an SD card image, or just when using the host file system?

Elektron72
Posts: 137
Joined: Tue Jun 30, 2020 3:47 pm

Getting data to/from the X16

Post by Elektron72 »



40 minutes ago, SlithyMatt said:




Is that the case when using an SD card image, or just when using the host file system?



I usually use the emulator with an SD card image so I can access features that are not supported when using the host filesystem. I have used the debugger to step through the routine that handles loading to VRAM, and can confirm that when an SD card image is used, the CPU has to process each byte. On the other hand, loading to VRAM (or anywhere else) does not involve the CPU when the host filesystem is used, as the emulator itself handles calls to the load routine.

Post Reply