On 7/9/06, Jared Putnam <[EMAIL PROTECTED]> wrote:
A few days ago, Timothy mentioned that he had a modification that allowed top-level return to jump to the beginning of the program. He then claimed that this would entail double returns, which are indeed bad. Is that mod still part of the design? If it is, and the JUMP instruction is retained, it allows his original program to be simplified to
Actually, I figured out a way to do it. Once cycle into the start of the subroutine, I can determine if I'm in the last loop of the call at the top level and that that call has the return flag set; in that case, I substitute the starting address in place of the return address so that when the return in the subroutine happens, it restarts at the top of the vertical routine.
; Vertical program ADDR [-v,-h,-d] 0 ; vid addr = start of framebuffer CALL [-v,-h,-d] #1 vsync+1 CALL [-v,-h,-d] #2 vsync CALL [+v,-h,-d] #2 vblank ; back porch FETCH [+v,-h,-d] #640 ; Fetch for first scanline CALL [+v,-h,-d] #1 vbp+1 CALL [+v,-h,-d] #1 vbp CALL [+v,-h,-d] #479 vactive NOOP [+v,-h,-d] ; Already fetched last scanline CALL [+v,-h,-d] #1 vactive+1 CALL [+v,-h,-d] #2 vblank ; front porch JUMP [+v,-h,-d] #1 vblank ; tail call Thus banishing the double return bug. Since the last call is actually a JUMP, the return on the end of vblank will just go back to the beginning of the program. The win here is that vblank_short isn't needed anymore, which is good for maintenance. The trick works for Diego's program as well.
Actually, this is a very elegant solution to the problem! It reminds me of tail-recursion and some things I've seen done in assembly programming when you know you're going to do a double return. For the moment, I'm may leave the double-return capability in. But if I find that I'm having trouble meeting timing, or I want to shrink the design, I'll take out the double-return and require your solution. (It's really not much logic.) Actually, any case where you can pull a software trick to save on hardware is good thing. Having the double-return saves one instruction slot, but since I doubt any video programs will get close to 512 words, the savings doesn't help. The double-return solution also allows for the compiler to be slightly simpler in one place, but again, that's a software problem and a relatively trivial one at that. Also, we should make sure that what I did to make double-return work doesn't cause any side-effects. Should I just go ahead and rip out the double-return capability? BTW, thanks for having a look at this! _______________________________________________ Open-graphics mailing list [email protected] http://lists.duskglow.com/mailman/listinfo/open-graphics List service provided by Duskglow Consulting, LLC (www.duskglow.com)
