Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. CAOTD (*): JavaScript is the new Assembly

CAOTD (*): JavaScript is the new Assembly

Scheduled Pinned Locked Moved The Lounge
javascriptdebugging
30 Posts 11 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    It would be better to say that JavaScript is the new C64 BASIC. It's just as fast, efficient and fun to debug as any old interpreter and allows any {place insulting word of choice here] who was too dumb to understand object orientation or get used to data types to freely create programing horrors. (*) Cool-Aid of the day. Have a big cup. :)

    Sent from my BatComputer via HAL 9000 and M5

    OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #6

    Wash your keyboard out with SOAP! I quite like Assembly code...

    The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    L 1 Reply Last reply
    0
    • OriginalGriffO OriginalGriff

      Just guessing, but I think he has started a Javascript maintenance project. His is the normal reaction as far as I can see...either that or he's getting ready to flood "The Weird and The Wonderful" with examples of "how to do it if you are terminally brain dead". Again, that is a perfectly normal reaction to a Javascript maintenance project! ;)

      The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #7

      Close. Very close.

      Sent from my BatComputer via HAL 9000 and M5

      1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        Wash your keyboard out with SOAP! I quite like Assembly code...

        The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #8

        OriginalGriff wrote:

        Wash your keyboard out with SOAP!

        Good idea. I have downloaded Apache Axis and wanted to take a look at it.

        Sent from my BatComputer via HAL 9000 and M5

        1 Reply Last reply
        0
        • L Lost User

          It would be better to say that JavaScript is the new C64 BASIC. It's just as fast, efficient and fun to debug as any old interpreter and allows any {place insulting word of choice here] who was too dumb to understand object orientation or get used to data types to freely create programing horrors. (*) Cool-Aid of the day. Have a big cup. :)

          Sent from my BatComputer via HAL 9000 and M5

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #9

          Well, it is a scripting language, after all: the one having even the very name misleading. :-D

          Veni, vidi, vici.

          In testa che avete, signor di Ceprano?

          1 Reply Last reply
          0
          • A AlphaDeltaTheta

            JavaScrrrrrrrrrrrrrrrripppppppt!!!!! If I had a time machine, I would have gone to past and burnt the blueprints!!!:mad:

            Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

            CPalliniC Offline
            CPalliniC Offline
            CPallini
            wrote on last edited by
            #10

            Amitosh S.M. wrote:

            blueprints

            Blueprints? :-)

            Veni, vidi, vici.

            In testa che avete, signor di Ceprano?

            R K 2 Replies Last reply
            0
            • A AlphaDeltaTheta

              JavaScrrrrrrrrrrrrrrrripppppppt!!!!! If I had a time machine, I would have gone to past and burnt the blueprints!!!:mad:

              Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

              M Offline
              M Offline
              Marc Clifton
              wrote on last edited by
              #11

              Amitosh S.M. wrote:

              If I had a time machine, I would have gone to past and burnt the blueprints!!!

              I would go back even further and burned the original implementation of HTML! Marc

              Day 1: Spider Database Navigator Unit Testing Succinctly

              R K 2 Replies Last reply
              0
              • L Lost User

                It would be better to say that JavaScript is the new C64 BASIC. It's just as fast, efficient and fun to debug as any old interpreter and allows any {place insulting word of choice here] who was too dumb to understand object orientation or get used to data types to freely create programing horrors. (*) Cool-Aid of the day. Have a big cup. :)

                Sent from my BatComputer via HAL 9000 and M5

                R Offline
                R Offline
                Roger Wright
                wrote on last edited by
                #12

                Okay, BASIC I'll go for, but don't impugn Assembly. It takes far more knowledge of hardware, and programming skill, to build a useful program using Assembly than any of the modern languages. And yes, sometimes it has to be done...

                Will Rogers never met me.

                L 1 Reply Last reply
                0
                • R Roger Wright

                  Okay, BASIC I'll go for, but don't impugn Assembly. It takes far more knowledge of hardware, and programming skill, to build a useful program using Assembly than any of the modern languages. And yes, sometimes it has to be done...

                  Will Rogers never met me.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #13

                  Does this assembly stuff look like this? :)

                  ; =========================================================================================
                  ; Parameters:
                  ; RE.0 X coordinate of the sprite
                  ; RE.1 Y coordinate of the sprite
                  ; RF Pointer to sprite
                  ; RD Size of the sprite in bytes
                  ;
                  ; Internal:
                  ; RC Pointer to video memory
                  ; =========================================================================================

                  DrawSprite: DEC R2
                  LDI hi(DisplayBuffer) ; calculate the offset in the video buffer
                  PHI RC ; DisplayBuffer + Y * 8 + X / 8
                  GHI RE ; result goes to RC

                  		IF Resolution == 20H
                  		ANI  1FH			; between 0 - 31
                  		ENDIF
                  			
                  		IF Resolution == 40H
                  		ANI  3FH			; or 0 - 63
                  		ENDIF
                  
                  		IF Resolution == 80H
                  		ANI  7FH			; or 0 - 127
                  		ENDIF
                  
                  		SHL
                  		SHL
                  		SHL
                  		PLO  RC
                  		BNF  DSP\_SkipIncrement
                  		GHI  RC
                  		ADI  01H
                  		PHI  RC
                  

                  DSP_SkipIncrement: GLO RC
                  STR R2
                  GLO RE
                  ANI 3FH
                  SHR
                  SHR
                  SHR
                  ADD
                  PLO RC
                  GLO RE ; calculate the number of required shifts
                  ANI 07H ; result to RE.1, replacing the Y coordinate
                  PHI RE ; RE.0 will be used later to count the shifts

                  DSP_ByteLoop: GLO RD ; exit if all bytes of the sprite have been drawn
                  BZ DSP_Exit

                  		IF Resolution == 20H		; or if we are about to draw outside the video buffer
                  		LDI  hi(DisplayBuffer)		; only one page at 64 x 32
                  		ENDIF
                  
                  		IF Resolution == 40H
                  		LDI   hi(DisplayBuffer) + 1	; two pages at 64 x 64
                  		ENDIF
                  
                  		IF Resolution == 80H
                  		LDI   hi(DisplayBuffer) + 3	; four pages at 64 x 128
                  		ENDIF
                  
                  		STR  R2
                  		GHI  RC
                  		SD
                  		BNF  DSP\_Exit
                  		LDN	 RF			; load the next byte of the sprite into RB.0
                  		PLO  RB
                  		LDI  00H		; set RB.1 to OOH
                  		PHI  RB
                  		DEC  RD				; decrement the sprite's byte counter
                  		INC  RF				; increment the pointer to the sprite's bytes
                  		GHI  RE				; prepare the shift counter
                  		PLO  RE
                  

                  DSP_ShiftLoop: GLO RE ; exit the loop if all shifts have been performed
                  BZ DSP_ShiftExit
                  DEC RE ; decrement the shift counter
                  GLO RB ; shift the values in RB
                  SHR
                  PLO RB
                  GHI RB
                  RSHR
                  PHI RB
                  BR DSP_ShiftLoop
                  DSP_ShiftExit: SEX RC ; store the shifted bytes in the video buffer
                  GLO RB
                  XOR
                  STR RC
                  INC RC
                  GHI RB
                  XOR
                  STR RC
                  SEX R2
                  GLO RC ; advance the video buffer pointer to the next line
                  ADI 07H
                  PLO RC
                  GHI RC
                  ADCI 00H
                  PHI RC
                  BR DSP_ByteLoop
                  DSP_Ex

                  R 1 Reply Last reply
                  0
                  • L Lost User

                    Does this assembly stuff look like this? :)

                    ; =========================================================================================
                    ; Parameters:
                    ; RE.0 X coordinate of the sprite
                    ; RE.1 Y coordinate of the sprite
                    ; RF Pointer to sprite
                    ; RD Size of the sprite in bytes
                    ;
                    ; Internal:
                    ; RC Pointer to video memory
                    ; =========================================================================================

                    DrawSprite: DEC R2
                    LDI hi(DisplayBuffer) ; calculate the offset in the video buffer
                    PHI RC ; DisplayBuffer + Y * 8 + X / 8
                    GHI RE ; result goes to RC

                    		IF Resolution == 20H
                    		ANI  1FH			; between 0 - 31
                    		ENDIF
                    			
                    		IF Resolution == 40H
                    		ANI  3FH			; or 0 - 63
                    		ENDIF
                    
                    		IF Resolution == 80H
                    		ANI  7FH			; or 0 - 127
                    		ENDIF
                    
                    		SHL
                    		SHL
                    		SHL
                    		PLO  RC
                    		BNF  DSP\_SkipIncrement
                    		GHI  RC
                    		ADI  01H
                    		PHI  RC
                    

                    DSP_SkipIncrement: GLO RC
                    STR R2
                    GLO RE
                    ANI 3FH
                    SHR
                    SHR
                    SHR
                    ADD
                    PLO RC
                    GLO RE ; calculate the number of required shifts
                    ANI 07H ; result to RE.1, replacing the Y coordinate
                    PHI RE ; RE.0 will be used later to count the shifts

                    DSP_ByteLoop: GLO RD ; exit if all bytes of the sprite have been drawn
                    BZ DSP_Exit

                    		IF Resolution == 20H		; or if we are about to draw outside the video buffer
                    		LDI  hi(DisplayBuffer)		; only one page at 64 x 32
                    		ENDIF
                    
                    		IF Resolution == 40H
                    		LDI   hi(DisplayBuffer) + 1	; two pages at 64 x 64
                    		ENDIF
                    
                    		IF Resolution == 80H
                    		LDI   hi(DisplayBuffer) + 3	; four pages at 64 x 128
                    		ENDIF
                    
                    		STR  R2
                    		GHI  RC
                    		SD
                    		BNF  DSP\_Exit
                    		LDN	 RF			; load the next byte of the sprite into RB.0
                    		PLO  RB
                    		LDI  00H		; set RB.1 to OOH
                    		PHI  RB
                    		DEC  RD				; decrement the sprite's byte counter
                    		INC  RF				; increment the pointer to the sprite's bytes
                    		GHI  RE				; prepare the shift counter
                    		PLO  RE
                    

                    DSP_ShiftLoop: GLO RE ; exit the loop if all shifts have been performed
                    BZ DSP_ShiftExit
                    DEC RE ; decrement the shift counter
                    GLO RB ; shift the values in RB
                    SHR
                    PLO RB
                    GHI RB
                    RSHR
                    PHI RB
                    BR DSP_ShiftLoop
                    DSP_ShiftExit: SEX RC ; store the shifted bytes in the video buffer
                    GLO RB
                    XOR
                    STR RC
                    INC RC
                    GHI RB
                    XOR
                    STR RC
                    SEX R2
                    GLO RC ; advance the video buffer pointer to the next line
                    ADI 07H
                    PLO RC
                    GHI RC
                    ADCI 00H
                    PHI RC
                    BR DSP_ByteLoop
                    DSP_Ex

                    R Offline
                    R Offline
                    Roger Wright
                    wrote on last edited by
                    #14

                    Yup.. That's the stuff. :-D

                    Will Rogers never met me.

                    L 1 Reply Last reply
                    0
                    • R Roger Wright

                      Yup.. That's the stuff. :-D

                      Will Rogers never met me.

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #15

                      Ahh, good morning (at leat it is early morning here). I got this drivel from here[^]. While I don't enjoy JavaScript very much, I still have some assembly which I occasionally work on. The code I have posted is used to draw a bitmap patten at any screen coordinates. I use it for text output, but also can be used to draw sprites in a game. That's why ther also collison detection. :)

                      Sent from my BatComputer via HAL 9000 and M5

                      1 Reply Last reply
                      0
                      • CPalliniC CPallini

                        Amitosh S.M. wrote:

                        blueprints

                        Blueprints? :-)

                        Veni, vidi, vici.

                        R Offline
                        R Offline
                        Rob Grainger
                        wrote on last edited by
                        #16

                        In the UK they are planning plain packaging on cigarette packets - just think of all the extra space for sketching designs such as these.

                        "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                        CPalliniC 1 Reply Last reply
                        0
                        • M Marc Clifton

                          Amitosh S.M. wrote:

                          If I had a time machine, I would have gone to past and burnt the blueprints!!!

                          I would go back even further and burned the original implementation of HTML! Marc

                          Day 1: Spider Database Navigator Unit Testing Succinctly

                          R Offline
                          R Offline
                          Rob Grainger
                          wrote on last edited by
                          #17

                          Hear hear! (I could go into a similar rant about failing to learn from existing technologies to my SQL one they other day. In this case forerunners such as Doug Englebart (The Mother of all Demos), Ted Nelson (who coined the phrase Hypertext) and Apple's HyperCard. They really should stop these scientists hacking.

                          "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                          M 1 Reply Last reply
                          0
                          • R Rob Grainger

                            In the UK they are planning plain packaging on cigarette packets - just think of all the extra space for sketching designs such as these.

                            "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                            CPalliniC Offline
                            CPalliniC Offline
                            CPallini
                            wrote on last edited by
                            #18

                            E. Majorana would have been happy.

                            Veni, vidi, vici.

                            In testa che avete, signor di Ceprano?

                            1 Reply Last reply
                            0
                            • L Lost User

                              It would be better to say that JavaScript is the new C64 BASIC. It's just as fast, efficient and fun to debug as any old interpreter and allows any {place insulting word of choice here] who was too dumb to understand object orientation or get used to data types to freely create programing horrors. (*) Cool-Aid of the day. Have a big cup. :)

                              Sent from my BatComputer via HAL 9000 and M5

                              A Offline
                              A Offline
                              Andrei Straut
                              wrote on last edited by
                              #19

                              CDP1802 wrote:

                              allows any {place insulting word of choice here]

                              I believe that code block is not properly closed. I don't think you would want to debug that kind of error in a Javascript file...

                              This isn't a signature

                              K 1 Reply Last reply
                              0
                              • R Rob Grainger

                                Hear hear! (I could go into a similar rant about failing to learn from existing technologies to my SQL one they other day. In this case forerunners such as Doug Englebart (The Mother of all Demos), Ted Nelson (who coined the phrase Hypertext) and Apple's HyperCard. They really should stop these scientists hacking.

                                "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                                M Offline
                                M Offline
                                Marc Clifton
                                wrote on last edited by
                                #20

                                Rob Grainger wrote:

                                and Apple's HyperCard.

                                I actually wish HyperCard was still around - I guess we have PowerPoint nowadays, but it's really not the same thing. One day I'll get back to working on http://app.intertexti.com/[^], my resurrection attempt (sort of.) ;) Marc

                                Day 1: Spider Database Navigator Unit Testing Succinctly

                                1 Reply Last reply
                                0
                                • CPalliniC CPallini

                                  Amitosh S.M. wrote:

                                  blueprints

                                  Blueprints? :-)

                                  Veni, vidi, vici.

                                  K Offline
                                  K Offline
                                  KP Lee
                                  wrote on last edited by
                                  #21

                                  CPallini wrote:

                                  Blueprints?

                                  Something used in Medieval times (My sophomore year of college) to make inexpensive copies of plans. Huge sheets of paper were used to create drawings of a design. (Written by hand, in pencil. Computers did exist, but were rather mythical. The head office was rumored to have one!) Another sheet the same size was immersed in chemicals was placed up to the plan, a special light was shined through both. The pencil marks blocked the light, the rest of the paper reacted to the light and turned blue, while the blocked portions remained white. In ancient times, this was the way structures were built. To this day, any kind of plan in any kind of medium is still called a blueprint by a fair segment of the population. (Mostly by people who have actually seen a blueprint or were infected by the people who still call it that.)

                                  CPalliniC 1 Reply Last reply
                                  0
                                  • M Marc Clifton

                                    Amitosh S.M. wrote:

                                    If I had a time machine, I would have gone to past and burnt the blueprints!!!

                                    I would go back even further and burned the original implementation of HTML! Marc

                                    Day 1: Spider Database Navigator Unit Testing Succinctly

                                    K Offline
                                    K Offline
                                    KP Lee
                                    wrote on last edited by
                                    #22

                                    Marc Clifton wrote:

                                    I would go back even further

                                    Hate to tell you this, but blueprints predate HTML about a hundred years. You would have to go back even sooner.

                                    M 1 Reply Last reply
                                    0
                                    • K KP Lee

                                      CPallini wrote:

                                      Blueprints?

                                      Something used in Medieval times (My sophomore year of college) to make inexpensive copies of plans. Huge sheets of paper were used to create drawings of a design. (Written by hand, in pencil. Computers did exist, but were rather mythical. The head office was rumored to have one!) Another sheet the same size was immersed in chemicals was placed up to the plan, a special light was shined through both. The pencil marks blocked the light, the rest of the paper reacted to the light and turned blue, while the blocked portions remained white. In ancient times, this was the way structures were built. To this day, any kind of plan in any kind of medium is still called a blueprint by a fair segment of the population. (Mostly by people who have actually seen a blueprint or were infected by the people who still call it that.)

                                      CPalliniC Offline
                                      CPalliniC Offline
                                      CPallini
                                      wrote on last edited by
                                      #23

                                      I know that. However it would imply there were a plan behind JavaScript. :-D

                                      Veni, vidi, vici.

                                      In testa che avete, signor di Ceprano?

                                      K 1 Reply Last reply
                                      0
                                      • K KP Lee

                                        Marc Clifton wrote:

                                        I would go back even further

                                        Hate to tell you this, but blueprints predate HTML about a hundred years. You would have to go back even sooner.

                                        M Offline
                                        M Offline
                                        Marc Clifton
                                        wrote on last edited by
                                        #24

                                        KP Lee wrote:

                                        but blueprints predate HTML about a hundred years.

                                        Harhar. Well, then we might as well go back to the discovery of the wheel. Or better yet, fire. ;) Marc

                                        Day 1: Spider Database Navigator Unit Testing Succinctly

                                        K 1 Reply Last reply
                                        0
                                        • A Andrei Straut

                                          CDP1802 wrote:

                                          allows any {place insulting word of choice here]

                                          I believe that code block is not properly closed. I don't think you would want to debug that kind of error in a Javascript file...

                                          This isn't a signature

                                          K Offline
                                          K Offline
                                          KP Lee
                                          wrote on last edited by
                                          #25

                                          Andrei Straut wrote:

                                          I believe that code block is not properly closed

                                          For a computer compiler probably, but even there you could code "{]" or "[}" as a pair of opening and closing braces.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups