Actions

Difference between revisions of "Patch (utility)"

From Sonic Retro

(More stuff.)
(Added unified diff information.)
Line 3: Line 3:
  
 
The '''diff''' utility is used to create patches, which can then be applied by '''patch'''.
 
The '''diff''' utility is used to create patches, which can then be applied by '''patch'''.
 +
 +
== Unified Diff ==
 +
The most common format for patches is the unified diff. The unified diff shows both line additions and removals, which are indicated by '+' and '-' symbols at the front of each line, respectively.
 +
 +
Example unified diff:
 +
<pre>
 +
--- a/pyl.asm
 +
+++ b/pyl.asm
 +
@@ -55,9 +55,9 @@ START:
 +
        jsr    draw_active_square
 +
 +
main:
 +
-      ; Wait 16 frames. (1/3 second)
 +
-      ; TODO: Support PAL timing.
 +
-      moveq  #15, d0
 +
+      ; Wait a bit to advance the square.
 +
+      moveq  #0, d0
 +
+      move.b  RAM_Frames_SquareAdvance, d0
 +
.vsync_loop:
 +
                jsr    VSync
 +
                dbf    d0, .vsync_loop
 +
</pre>
  
 
== Downloads ==
 
== Downloads ==

Revision as of 16:16, 23 February 2009

Sonicretro-round.svg This short article is in need of work. You can help Sonic Retro by adding to it.

patch is a utility used to apply source code patches to a source code tree. Source code patches are commonly used to distribute code changes to developers working on an open-source project.

The diff utility is used to create patches, which can then be applied by patch.

Unified Diff

The most common format for patches is the unified diff. The unified diff shows both line additions and removals, which are indicated by '+' and '-' symbols at the front of each line, respectively.

Example unified diff:

--- a/pyl.asm
+++ b/pyl.asm
@@ -55,9 +55,9 @@ START:
        jsr     draw_active_square
 
 main:
-       ; Wait 16 frames. (1/3 second)
-       ; TODO: Support PAL timing.
-       moveq   #15, d0
+       ; Wait a bit to advance the square.
+       moveq   #0, d0
+       move.b  RAM_Frames_SquareAdvance, d0
 .vsync_loop:
                jsr     VSync
                dbf     d0, .vsync_loop

Downloads