answersLogoWhite

0


Best Answer

Backpatching June, 1999 Use mostly-sequential output streams by fixing them later.

You're generating a stream of output. Everything is mostly fine, except that you have some information that really belongs at the front of the file or at a few places in the middle.

Forces
  • Generating an output stream (mostly sequential).
  • Information occasionally must go in earlier places in the stream.
ResolutionRather than treating the whole file as random access, use backpatching.

Generate the stream sequentially. When you get to a place where you don't know the value, insert a placeholder value. Keep a list of these "unresolved references".

As processing continues, keep track of the proper value as it becomes known. At the end, close the sequential stream. Sort the tracked values (if necessary) into the order they should have appeared. Re-open the stream for overwriting. (The access won't be random, but rather sequential but non-contiguous.) Move through the list, seek to the position, and overwrite the placeholder value with the true value. Close the stream.

In this way, we've replaced what could have been random access with two sets of sequential access.

Usage
  • This is a classical assembler technique. When compiling assembler code, you know the values for instructions, and references to already-defined symbols, so write them directly. When you see a forward reference (to an unknown label), store it.

    This fits very well when you have a tape-based system (where sequential access is *strongly* favored): you can sort the values while the tape is rewinding.

  • Compilers often work like this even when random access files are available. Much of the object file can be generated sequentially, but there are often header areas that must be defined once code characteristics are known. (For example, you may have to write the size of the code space into bytes 20 through 23 of the file.)
  • Protocol formats are often conveniently handled by building the output directly into a buffer, and keeping a list of places to patch.
Note[Assembler example recalled - any real reference?] A variation in the assembler example: if random access is just as fast as sequential on the second pass: instead of writing a 0 for the unreferenced value, write the address of the previous entry that should have been updated. Then, the in-memory list need only keep track of the last entry in the file (each entry in the file will point to the preceding one). [Written 3-22-99.]
User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do one pass assemblers use Backpatching?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between one pass and two pass assembler?

The difference between one pass and two pass assemblers is basically in the name. A one pass assembler passes over the source file exactly once, in the same pass collecting the labels, resolving future references and doing the actual assembly. The difficult part is to resolve future label references and assemble code in one pass. A two pass assembler does two passes over the source file ( the second pass can be over a file generated in the first pass ). In the first pass all it does is looks for label definitions and introduces them in the symbol table. In the second pass, after the symbol table is complete, it does the actual assembly by translating the operations and so on.


Why you use assembler?

Assemblers are used to convert a specific assembly language into bytecode.


Why use assembler?

Assemblers are used to convert a specific assembly language into bytecode.


What digits do you use in assembly language?

Most assemblers support binary, decimal, hexadecimal and octal notations.


Advantages of one pass assembler over two pass assembler?

In theory the only advantage is Speed simply because one pass is faster than two passes. However a properly written two pass assembler can be faster than a poorly written one pass assembler because the two pass assembler spends alot less time doing memory intensive lookups, look-aheads, and back-tracking.


Can some one please let you use there hentaikey.com membership pass?

no


How do you use a hack you already downloaded?

this is an account user usmanking pass dog another one user to pass to and not capital's


What is police tape use for?

It has MANY uses but it is primarily for creating a "no pass" zone to form perimeters through which no one is supposed to pass.


Can you use your blockbuster pass at more than one blockbuster?

yeeah of course


What is the difference between assemblers interpreters and compilers?

Assemblers convert Assembly code to machine code Interpreters convert high level code to real-time machine code and store it in the memory for direct execution Compilers convert high level code to real-time machine code or some intermediate code and store it in a file for later execution Assemblers use the basic building blocks of the command processor code to write programs and is the language closest to the binary on which all computers operate, although it is difficult to use it does work well for things like networking and communication protocols. Interpreters are just what they say, they translate the code in real time as you operate the program, then process it, and are therefore the slowest. Compilers translate the code into a format the computer understands prior to the execution (or distribution) of the code and is therefore the easiest to use as it combines the better attributes of both programming methods into one easy to use package.


On Pokemon Battle Revolution I have downloaded Pokemon from the ds and made a custom pass but I still can't use it so how do I use it?

you can only use a custom passes on certain Colosseum's so use the rental pass until you get to one of the Colosseums


What did Hannibal use to cross the Alps?

The feet of his soldiers through a pass - which one is uncertain.