Why is programming taking so dang long for me nowadays?

You can talk about almost anything that you want to on this board.

Moderator: Moderators

TOUKO
Posts: 288
Joined: Mon Mar 30, 2015 10:14 am

Re: Why is programming taking so dang long for me nowadays?

Post by TOUKO » Mon Jan 15, 2018 1:50 am

Why is programming taking so dang long for me nowadays?
Because you're alone,no deadlines, a project can become boring as time passes and if you want to make it best as possible, it takes time,you can add if you're like me,E.G to go in a endless optimisation you are not close to finish something easily . :wink:

I also think an original project is way more difficult(and long) to do alone rather than an adaptation.
Last edited by TOUKO on Sun Jan 21, 2018 6:56 am, edited 1 time in total.

psycopathicteen
Posts: 2901
Joined: Wed May 19, 2010 6:12 pm

Re: Why is programming taking so dang long for me nowadays?

Post by psycopathicteen » Fri Jan 19, 2018 12:16 pm

I just thought of another factor.

The more code you write, the more memory you use, and the more memory you use the more bank switching you need, and the more bank switching you do, the more complicated your code is, and the more complicated your code is, the more memory it takes up, and the more memory it takes up, the more you need bank switching.

calima
Posts: 1000
Joined: Tue Oct 06, 2015 10:16 am

Re: Why is programming taking so dang long for me nowadays?

Post by calima » Fri Jan 19, 2018 1:10 pm

-> set up trampolines -> bankswitching is no longer complicated -> cycle broken

User avatar
gauauu
Posts: 637
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re: Why is programming taking so dang long for me nowadays?

Post by gauauu » Fri Jan 19, 2018 1:21 pm

calima wrote:-> set up trampolines -> bankswitching is no longer complicated -> cycle broken
Even with trampolines, bankswitching still makes things a bit more complicated. You have to pay attention to whether a given routine or bit of data is in your current bank. Calling a trampoline'd routine is easy, but remembering whether you have to avoid a function that has no trampoline is more mental load.

psycopathicteen
Posts: 2901
Joined: Wed May 19, 2010 6:12 pm

Re: Why is programming taking so dang long for me nowadays?

Post by psycopathicteen » Fri Jan 19, 2018 1:39 pm

How would a trampoline code work in an SNES game?

calima
Posts: 1000
Joined: Tue Oct 06, 2015 10:16 am

Re: Why is programming taking so dang long for me nowadays?

Post by calima » Sat Jan 20, 2018 2:35 am

gauauu wrote:Even with trampolines, bankswitching still makes things a bit more complicated. You have to pay attention to whether a given routine or bit of data is in your current bank. Calling a trampoline'd routine is easy, but remembering whether you have to avoid a function that has no trampoline is more mental load.
Sure, but those are easily handled. Put all data a function accesses in the same file, and file-level organization now takes care of that mental load. You don't need to care about not going through a trampoline, that's needless micro-optimization until proven otherwise. Make it so that all functions are either in a common bank or trampolined, and nothing to remember.

As for SNES details, I'm not a SNES coder (yet), but if you look up my cc65 trampoline thread, RainWarrior's NES implementation may give some ideas.

psycopathicteen
Posts: 2901
Joined: Wed May 19, 2010 6:12 pm

Re: Why is programming taking so dang long for me nowadays?

Post by psycopathicteen » Sat Jan 20, 2018 12:47 pm

I just moved my background tile maps to another bank, and that seemed to work.

Oziphantom
Posts: 767
Joined: Tue Feb 07, 2017 2:03 am

Re: Why is programming taking so dang long for me nowadays?

Post by Oziphantom » Sun Jan 21, 2018 2:28 am

psycopathicteen wrote:How would a trampoline code work in an SNES game?
It wouldn't; there is 0 need for a trampoline on a 65816, unless you are dealing with a system that has more than 16MB and hence has "banks" as well. I'm sure there is some mapper system that could allow you to get into such a position if you really wanted to where you would need one, but its an edge of an edge on a vertex case ;)

But it speaks more to the general issues of complexity. Code is a Complex task that descends into Chaotic over time, so you need to spend a lot of time to "burn off the entropy" and get it back to Complex. You know those refactor periods where you rewrite a whole system or 6 over 3 weeks and then get it to the point it looks 100% the same as did before.
When you first add features, you can just hammer them in, as the goes on, you spend more time lookup existing code, making sure you havn't already made code to do a thing, make sure you don't accidentally trash something, make sure it works in all cases the game can present etc. The "checklist" for each new thing gets longer each time you add a new thing.

calima
Posts: 1000
Joined: Tue Oct 06, 2015 10:16 am

Re: Why is programming taking so dang long for me nowadays?

Post by calima » Sun Jan 21, 2018 2:55 am

What of the data bank and program bank then? You can avoid the data bank by always using long loads, but you can't avoid the program bank. Not having to think about what jump is long and what jump is short is one of the key points of trampolines. edit: Always using long jumps and long loads is certainly possible, but I would think a trampoline design would be faster.

Oziphantom
Posts: 767
Joined: Tue Feb 07, 2017 2:03 am

Re: Why is programming taking so dang long for me nowadays?

Post by Oziphantom » Sun Jan 21, 2018 3:49 am

If something is long or short - mostly the assemblers job. Working out an address based upon data bank, also the assemblers job.
Yes you will need to think, do I want this function to RTS or RTL, you could use a trampoline to do a conversion for you, but that is more a VECTOR table rather than a trampoline.
Bank 03

Code: Select all

jLMyFunc 
    jsr myFunc
    rtl

myFunc
    stuff
    rts
So if you are in Bank 02 you would do jsl jLMyFunc and if you are in Bank 03 you would do jsr myFunc not really a trampoline as you don't jump out and then bank in.
JSL takes 1 clock more than JSR
RTL takes the same number of cycles as RTS
The trampoline method eats 12 extra clocks. So if you rarely use the function out of bank, sure JUMP Vector it. If you use it 50/50 then always JSL and take the 1 clock hit.
However most of the time you can just JSR/RTS and let the assembler handle the JSL/R RTS/L conversion for you, I would think. On a SNES 32K banks are large, that is a whole C64 or NES game in one shot, In days of yore each bank would have been a "system" and had a VECTOR entry table so you could just assemble each ROM 1 by 1 and not have to sit through the whole lot each time. These days you can one shot the whole ROM and let the assembler handle it.

TOUKO
Posts: 288
Joined: Mon Mar 30, 2015 10:14 am

Re: Why is programming taking so dang long for me nowadays?

Post by TOUKO » Sun Jan 21, 2018 6:55 am

psycopathicteen wrote:I just thought of another factor.

The more code you write, the more memory you use, and the more memory you use the more bank switching you need, and the more bank switching you do, the more complicated your code is, and the more complicated your code is, the more memory it takes up, and the more memory it takes up, the more you need bank switching.
:lol:

psycopathicteen
Posts: 2901
Joined: Wed May 19, 2010 6:12 pm

Re: Why is programming taking so dang long for me nowadays?

Post by psycopathicteen » Tue Jan 23, 2018 1:08 pm

I was thinking today, if Super Mario Bros was able to fit in 32kB, I should be able to fit the game engine code within 32kB too.

TOUKO
Posts: 288
Joined: Mon Mar 30, 2015 10:14 am

Re: Why is programming taking so dang long for me nowadays?

Post by TOUKO » Wed Jan 24, 2018 1:28 am

psycopathicteen wrote:I was thinking today, if Super Mario Bros was able to fit in 32kB, I should be able to fit the game engine code within 32kB too.
For 65xxx 32 kB represent a lot of space for code, so i'll say yes you can easily .
I think the good things to do is to take the game engine and all the main code in permanent mapped banks if possible, and the other stuffs (intro, menu,game over, datas ,etc ..) on classic banks which can be mapped at any times.
i don't know if this help for snes ,but i use that scheme for PCE,but it's probably more easy as PCE banks are 8kB .

93143
Posts: 1104
Joined: Fri Jul 04, 2014 9:31 pm

Re: Why is programming taking so dang long for me nowadays?

Post by 93143 » Wed Jan 24, 2018 3:04 am

Why 32 kB? I can't think of a reason not to put the program bank in a HiROM region, so you can have 64 kB of solid code with no long jumps if you want.

psycopathicteen
Posts: 2901
Joined: Wed May 19, 2010 6:12 pm

Re: Why is programming taking so dang long for me nowadays?

Post by psycopathicteen » Wed Jan 24, 2018 9:19 am

If a routine uses a small LUT, I would like to keep it in the same bank as the routine, and be able to access it with short absolute addressing.

Post Reply