• 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

Use the tools as provided and prove that you're an engineer not a whinging tart.

I compiled your code, the size is 60 bytes.

I run it now for like 10 mins on Win XP 32 bit system - black screen, no countdown or up - can anyone else who tried it confirm that this code does not do fk all?

Maybe that's the puzzle - fix it? :ind
 
Clearly you are trying to write directly to video memory (b800), but it does not seem to be working, more importantly - you are aware that historically writes to that are are not fast? This is effectively IO with video memory, so WTF are you asking people to optimise code that is likely to be bottlenecked by video writes?

The optimisation in this case (if it worked in the first place) is NOT to use video ram like this - only display FINAL result once.

I guess they don't teach stuff like this in Royal Marines courses, eh?

:ladybags:
 
Clearly you are trying to write directly to video memory (b800), but it does not seem to be working, more importantly - you are aware that historically writes to that are are not fast? This is effectively IO with video memory, so WTF are you asking people to optimise code that is likely to be bottlenecked by video writes?

The optimisation in this case (if it worked in the first place) is NOT to use video ram like this - only display FINAL result once.

I guess they don't teach stuff like this in Royal Marines courses, eh?

:ladybags:

If you'd have used "debug" as instructed you will have found that as a byproduct that the correct display mode would have been set on exit.

However, as you're such a gobby sh!te try the following which manually sets the correct mode on startup.

Code:
A 100
mov ax,2
int 10
mov ax,b800
mov ds,ax
mov ax,30
xor di,di
mov cx,10
ds:
mov [di],al
inc di
inc di
dec cx
cmp cx,0
jne 113
mov di,20
mov cx,10
mov al,[di]
inc al
cmp al,3a
je 12F
mov [di],al
jmp 11D
mov al,30
mov [di],al
dec di
dec di
cmp di,0
je 13C
jmp 123
mov ax,4c00
int 21

N test.COM
RCX
41
W
Q

If I'd wanted a program to display 9999999999999999 then that would be just what I would write.

Now, f**k off and learn to follow instructions - that's something they did teach me in the Marines.
 
As long as it takes. :tumble:

I need a point of reference, so can you please oblige - in its current form should I assume it can run 1 hour or 10 hours - with assembly when software does not run quick or has no visible signs of work done it may seen that it hung, especially since Ctrl-C won't work.
 
I need a point of reference, so can you please oblige - in its current form should I assume it can run 1 hour or 10 hours - with assembly when software does not run quick or has no visible signs of work done it may seen that it hung, especially since Ctrl-C won't work.

If you follow the instructions you will find it obvious that the code hasn't hung.

Code:
;********* File: test.com *************
;
    code     SEGMENT
             ASSUME CS:code, DS:code
             ORG 100h
  
    strt:

	MOV	AX ,0002h
	INT	10				; Video Function Call
	MOV	AX ,B800h
	MOV	DS,AX
	MOV	AX ,0030h
	XOR	DI,DI
	MOV	CX ,0010h
	MOV	DS:[DI],AL
	INC	DI 
	INC	DI 
	DEC	CX 
	CMP	CX,+00h
	JNZ	J00113
J0011D: MOV	DI ,0020h
	MOV	CX ,0010h
J00123: MOV	AL,[DI]
	INC	AL
	CMP	AL,3Ah
	JZ	J0012F
	MOV	[DI],AL
	JMP	J0011D
J0012F: MOV	AL ,30h
	MOV	[DI],AL
	DEC	DI 
	DEC	DI 
	CMP	DI,+00h
	JZ	J0013C
	JMP	J00123
J0013C: MOV	AX ,4C00h
	INT	21				; DOS Function Call

    code     ENDS
             END  strt
 
Alexi, after you have finished doing Churchill's work for him how do you fancy doing some of mine?

I quite fancy going to the pub for a few at lunch time but I have a deadline.

If it helps I can wrap my tasks up as a 'puzzle' and say it is just a bit of fun.
 

Advertisers

Back
Top