• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • 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

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    #41
    Originally posted by Churchill View Post
    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?

    Comment


      #42
      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?

      Comment


        #43
        Did you learn how to program assembly in Uni AtW?

        Comment


          #44
          Originally posted by AtW View Post
          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?

          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.

          Comment


            #45
            But how long is it supposed to run, 10 mins, 1 hour?

            Comment


              #46
              Originally posted by AtW View Post
              But how long is it supposed to run, 10 mins, 1 hour?
              As long as it takes.

              Optimise it and it'll be quicker.

              Comment


                #47
                Originally posted by Churchill View Post
                As long as it takes.
                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.

                Comment


                  #48
                  Originally posted by AtW View Post
                  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

                  Comment


                    #49
                    Not so much a code puzzle then, more the trigger for WWIII.

                    Comment


                      #50
                      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.

                      Comment

                      Working...
                      X