Yosikuma Posted June 13, 2016 Share Posted June 13, 2016 Okay, I have seen repeated references to bus stuffing in this forum. My question is: what exactly is this? How does one achieve it, in terms of programming for the VCS? Pardon the rather "newbie" set of questions as of late! 1 Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted June 13, 2016 Share Posted June 13, 2016 Basically an external CPU (such as the ARM in the Harmony, or whatever was in The Graduate) and the internal CPU put data on the data bus at the same time. If done correctly, the external CPU will override the internal CPU. A possible Kernel for bus stuffing would look like this: ldx #$FF KernelLoop: sta WSYNC stx GRP0 ; reads from DS_GRP0 stx COLUP0 ; reads from DS_COLUP0 stx COLUP1 ; reads from DS_COLUP1 stx COLUPF ; reads from DS_COLUPF stx ENABL ; reads from DS_ENABL stx ENAM0 ; reads from DS_ENAM0 stx ENAM1 ; reads from ENAM1 stx PF0 ; reads from DS_PF0 stx PF1 ; reads from DS_PF1 stx PF2 ; reads from DS_PF2 lda #<DS_CONTROL ; datastream like bne KernelEvent ; end-of-kernel, reposition object stx GRP1 ; reads from DS_GRP1 - GRP1 on VDEL so it is not time critical SLEEP ?? ; delay before updating playfield for right side of screen stx PF0 ; reads from DS_PF0 for other half of screen stx PF1 ; reads from DS_PF1 stx PF2 ; reads from DS_PF2 jmp KernelLoop where the extern CPU would override the stx instructions, making it possible to update a TIA register in just 3 cycles. 1 Quote Link to comment Share on other sites More sharing options...
Yosikuma Posted June 13, 2016 Author Share Posted June 13, 2016 Thank you so much for being so helpful! I had seen this term floating about, and now I can finally understand what is going on. I guess I'll have to look into just how the ARM on the Harmony works... Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted June 13, 2016 Share Posted June 13, 2016 where the extern CPU would override the stx instructions, making it possible to update a TIA register in just 3 cycles. Did you (or anyone else) manage to get it working on Harmony yet? Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted June 13, 2016 Share Posted June 13, 2016 Did you (or anyone else) manage to get it working on Harmony yet? batari's done some tests that prove it will work. I've worked on a spec for a new BUS bankswitching format. I've implemented it in Stella, but haven't looked at it since last September so don't recall where I left off. I've been feeling the urge to work on it again, though it'll be after my home issues are taken care of. Once I'm done somebody else will need to implement it for the Harmony/Melody as I'm not familiar with ARM assembly. Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted June 13, 2016 Share Posted June 13, 2016 Why no C/C++? Maybe I should eventually learn ARM Assembler. Quote Link to comment Share on other sites More sharing options...
cd-w Posted June 14, 2016 Share Posted June 14, 2016 (edited) I've worked on a spec for a new BUS bankswitching format. I've implemented it in Stella, but haven't looked at it since last September so don't recall where I left off. I've been feeling the urge to work on it again, though it'll be after my home issues are taken care of. Once I'm done somebody else will need to implement it for the Harmony/Melody as I'm not familiar with ARM assembly. Darrell - Can you send me the BUS bank-switching spec that you have produced - I'm interested in coding it up for the Harmony/Melody? Why no C/C++? Maybe I should eventually learn ARM Assembler. Thomas - The bank-switching/bus-stuffing code is timing critical so it is better to code it up in ARM assembly. You should definitely learn ARM assembler - it is very friendly for coding directly by hand. The 16-bit THUMB instruction set is quite close to 6502 and will take you about a day to learn. The 32-bit ARM instruction set is great for short fragments of high performing code as you can do a lot with each instruction. The new Cortex THUMB2 instruction set combines the best aspects of THUMB/ARM but isn't applicable to the Harmony/Melody (which is an ARM7TDMI chip). A very quick tour of ARM assembly written by a friend of mine can be found here: http://www.davespace.co.uk/arm/introduction-to-arm/ The best references for ARM programming are the official ARM manuals and Gameboy Advance programming resources: ARM/THUMB quick reference: http://infocenter.arm.com/help/topic/com.arm.doc.qrc0001l/QRC0001_UAL.pdf ARM7 Manual: https://ece.uwaterloo.ca/~ece222/ARM/ARM7-TDMI-manual-pt3.pdf GBATEK ARM CPU guide: http://problemkaputt.de/gbatek.htm#armcpureference ARM Whirlwind tour: http://www.coranac.com/tonc/text/asm.htm Chris Edited June 14, 2016 by cd-w 2 Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted June 14, 2016 Share Posted June 14, 2016 Darrell - Can you send me the BUS bank-switching spec that you have produced - I'm interested in coding it up for the Harmony/Melody? Sure thing! Give me a few days so I can review what I was doing, write up some notes about it, and migrate my Stella BUS driver from 4.6.1 to the current version of Stella so we have something to compare against. 1 Quote Link to comment Share on other sites More sharing options...
cd-w Posted June 17, 2016 Share Posted June 17, 2016 Sure thing! Give me a few days so I can review what I was doing, write up some notes about it, and migrate my Stella BUS driver from 4.6.1 to the current version of Stella so we have something to compare against. Thanks Darrell - looking forward to it. Chris Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.