Click here to Skip to main content
15,905,229 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Please be clear with your prompts... Pin
TheGreatAndPowerfulOz27-Sep-19 4:34
TheGreatAndPowerfulOz27-Sep-19 4:34 
GeneralRe: Please be clear with your prompts... Pin
dandy7227-Sep-19 5:09
dandy7227-Sep-19 5:09 
GeneralRe: Please be clear with your prompts... Pin
Sander Rossel27-Sep-19 5:19
professionalSander Rossel27-Sep-19 5:19 
GeneralRe: Please be clear with your prompts... Pin
dandy7227-Sep-19 7:13
dandy7227-Sep-19 7:13 
GeneralRe: Please be clear with your prompts... Pin
BillWoodruff27-Sep-19 19:55
professionalBillWoodruff27-Sep-19 19:55 
GeneralRe: Please be clear with your prompts... Pin
Gary Wheeler27-Sep-19 7:08
Gary Wheeler27-Sep-19 7:08 
GeneralRe: Please be clear with your prompts... Pin
dandy7227-Sep-19 7:14
dandy7227-Sep-19 7:14 
GeneralGOTO is evil! Pin
CodeWraith27-Sep-19 2:58
CodeWraith27-Sep-19 2:58 
Not that I have anything against that, but now I have a problem. I'm preparing to write some code for a 41 year old computer. Without an OS I will never be able to retain all oldschool features and at the same time slightly modernizing the hardware.

The problem is that the old processor has two types of branching instructions: Long branches and short branches. Long branches need three bus cycles to execute and have the full address which is copied into the program counter when the branch is executed.

Short branches take only two bus cycles, but have only the lower half of the address to jump to. This 8 bit address is copied into the lower half of the program counter, the upper half remains the same. This leads to a mild segmentation of the memory for your code, each segment 256 bytes long.

Problems come when your code runs over the boundary from one page to the next in the middle of a loop. You can't loop back to the previous page with a short branch. So I should just use a long branch instead, right? That's the easy way out which compilers like to use. They simply don't use short branches at all and generate long branches instead. Problem solved.

Or not. Of course there may be a performance problem when long branches are used, which take one bus cycle more. That's only a thing in very short loops which are executed very often.

The real problem comes from a different direction. The old graphics chip relies on carefully timed interrupts and DMA to get its video data for every frame. The one extra bus cycle when the video interrupt comes during the execution of a long branch causes the graphics to fall apart for the following frame. If the code is full of long branches, you don't get to see very much at all, because that happens all the time.

Now, how do I get the compiler to generate long branches only if it finds no other way. Relocating the code is the linker's job and not code generation. And I don't see any efficient way how the linker can stitch the code together in the optimal way to avoid loops running over page boundaries other than building a tree of solutions and then taking the one with the least problems. That's going to be slow.
I have lived with several Zen masters - all of them were cats.

His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.

GeneralRe: GOTO is evil! Pin
Marc Clifton27-Sep-19 3:05
mvaMarc Clifton27-Sep-19 3:05 
GeneralRe: GOTO is evil! Pin
CodeWraith27-Sep-19 3:13
CodeWraith27-Sep-19 3:13 
GeneralRe: GOTO is evil! Pin
Mike Hankey27-Sep-19 3:47
mveMike Hankey27-Sep-19 3:47 
GeneralRe: GOTO is evil! Pin
CodeWraith27-Sep-19 3:56
CodeWraith27-Sep-19 3:56 
GeneralRe: GOTO is evil! Pin
MarkTJohnson27-Sep-19 3:07
professionalMarkTJohnson27-Sep-19 3:07 
GeneralRe: GOTO is evil! Pin
CodeWraith27-Sep-19 3:21
CodeWraith27-Sep-19 3:21 
GeneralRe: GOTO is evil! Pin
Sander Rossel27-Sep-19 3:40
professionalSander Rossel27-Sep-19 3:40 
GeneralRe: GOTO is evil! Pin
PeejayAdams27-Sep-19 4:17
PeejayAdams27-Sep-19 4:17 
GeneralRe: GOTO is evil! Pin
CodeWraith27-Sep-19 4:31
CodeWraith27-Sep-19 4:31 
GeneralRe: GOTO is evil! Pin
TheGreatAndPowerfulOz27-Sep-19 4:40
TheGreatAndPowerfulOz27-Sep-19 4:40 
GeneralRe: GOTO is evil! Pin
TheGreatAndPowerfulOz27-Sep-19 4:37
TheGreatAndPowerfulOz27-Sep-19 4:37 
GeneralRe: GOTO is evil! Pin
glennPattonWork327-Sep-19 4:50
professionalglennPattonWork327-Sep-19 4:50 
GeneralRe: GOTO is evil! Pin
CodeWraith27-Sep-19 5:08
CodeWraith27-Sep-19 5:08 
GeneralRe: GOTO is evil! Pin
Gary Wheeler27-Sep-19 7:15
Gary Wheeler27-Sep-19 7:15 
GeneralRe: GOTO is evil! Pin
CodeWraith27-Sep-19 7:58
CodeWraith27-Sep-19 7:58 
GeneralRe: GOTO is evil! Pin
Gary Wheeler27-Sep-19 8:12
Gary Wheeler27-Sep-19 8:12 
GeneralRe: GOTO is evil! Pin
CodeWraith27-Sep-19 8:28
CodeWraith27-Sep-19 8:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.