• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Code Puzzle

Code? You write code? I was pretty sure you were reporting monkey - shush from the thread when real programming languages are used! :mad

Sorry when I mean commercial, I mean code that people pay for as opposed to pishmercial which seems to consistent of a wall,a marker relating to memory and a worthless exercise in assembler one up man ship

sorry should have been clearer
 
Well, AtW's code seems fine, apart from the mode setting (line 2) which looks like a sneaky hack - I'd want some confirmation that it works reliably before putting that into production.

Apart from that, a very nice bit of work :yay:

You did pretty well too...

:hug:

It's undocumented but works for me - considering our dog's insistence that his magical "requirements" were that it runs from debug and therefore setting text video mode isn't even necessary - if this is true then 2 bytes can be saved by removing INT 10H :laugh

I can do it in 43 bytes with guaranteed video mode set - just use: xor ax,ax - 0 mode is valid text mode :tongue
 
a worthless exercise in assembler one up man ship

It wasn't worthless for me actually, not so much as putting the dog in his place (well below cats and squirrels in evolutionary ladder) but brushing up on old stuff - I was planning to rewrite one tight C code using assembly but with new SSE opcodes - frankly Spod could have picked much better ASM example to optimise.

From all possible choices he picked up 16-bit real mode, and code itself is so trivial that there is no good scope for optimisation other than its size (which is what I had to focus on).

For a few decades now assembly language was used primarily for speed, not space savings - sometimes these are the same when you try to optimise tight loop to get it to fit into prefetch buffers.
 
...a worthless exercise in assembler one up man ship

  1. It's "One-upmanship" - if you're going to make allusions to Stephen Potter's work, at least get it right, or you immediately put yourself one-down;

  2. No exercise in assembly language programming is worthless.

Quick test: given the following values in the address space:

Code:
0800 f0
---
08FF dc
0900 ac

where and how will the following 6502 code fail:

Code:
0FF0 6C FF 08 JMP (08FF)

This 6502 processor bug actually bit me once, so this is not a theoretical question. Understanding it helped make me a better programmer.

Mind you, that chap who caught the floating-point division bug in the Pentium has to get the prize for alerting the world to the fact that the leaky abstractions can extend down into the silicon. A high-level reporting language really stands no chance of truly insulating you from the bitter reality of bits and bytes :ohwell
 
Well done everyone who contributed - even AtW when he stopped whinging like a fairy.

As was originally mentioned this wasn't a competition but AtW, Nick I owe you both a beer.

MarillionFan - I wouldn't expect you to understand.
 
Well done everyone who contributed - even AtW when he stopped whinging like a fairy.

:banana:

As was originally mentioned this wasn't a competition but AtW, Nick I owe you both a beer.

ta, it's better be a big one - I've spent whole of yesterday evening doing it instead of playing my favourite game, by the time I finished with code Valve's servers were down :mad

:tongue
 
Last edited: 09:56
:banana:



ta, it's better be a big one - I've spent whole of yesterday evening doing it instead of playing my favourite game, by the time I finished with code Valve's servers were down :mad

:tongue

Yeah, I charged 'em to keep you off the servers last night! I can't believe how easy it was! :banana:
 
Yeah, I charged 'em to keep you off the servers last night! I can't believe how easy it was! :banana:

They were working fine whilst I was coding, they failed AFTER I finished and thought I finally can get a quick game :eyes
 
Excellent thread this !!

Wish there were more threads like this.

Never coded in assembly language so I have no clue what those numbers mean except it proved AtW and Nick are pretty good at what they do. :yay:
 

Advertisers

Back
Top