ArticleslgStudy

computer science

XMODEM

XMODEM is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand XMODEM rather than just read about it. In short: XMODEM is a simple file transfer protocol developed as a quick hack by Ward Christensen for use in his 1977 MODEM.ASM terminal program. It allowed users to transmit files between their computers when both sides used MODEM.

Key takeaways

  • XMODEM belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect XMODEM to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of XMODEM from memory before moving on to harder problems.

Reference excerpt

XMODEM is a simple file transfer protocol developed as a quick hack by Ward Christensen for use in his 1977 MODEM.ASM terminal program. It allowed users to transmit files between their computers when both sides used MODEM. Keith Petersen made a minor update to always turn on "quiet mode", and called the result XMODEM. XMODEM, like most file transfer protocols, breaks up the original data into a series of "packets" that are sent to the receiver, along with additional information allowing the receiver to determine whether that packet was correctly received. If an error is detected, the receiver requests that the packet be re-sent. A string of bad packets causes the transfer to abort. XMODEM became extremely popular in the early bulletin board system (BBS) market, largely because it was simple to implement. It was also fairly inefficient, and as modem speeds increased, this problem led to the development of a number of modified versions of XMODEM to improve performance or address other problems with the protocol. Christensen believed his original XMODEM to be "the single most modified program in computing history". Chuck Forsberg collected a number of common modifications into his YMODEM protocol, but poor implementation led to a further fracturing before they were re-unified by his later ZMODEM protocol. ZMODEM became very popular, but never completely replaced XMODEM in the BBS market.

Packet structure The original XMODEM used a 128-byte data packet, the block size used on CP/M floppy disks. The packet was prefixed by a simple 3-byte header containing a <SOH> character, a "block number" from 1-255, and the "inverse" block number—255 minus the block number. Block numbering starts with 1 for the first block sent, not 0. The header was followed by the 128 bytes of data, and then a single-byte checksum. The checksum was the sum of all 128 data bytes in the packet modulo 256. The complete packet was thus 132 bytes long, containing 128 bytes of payload data, for a total channel efficiency of about 97%. The file was marked "complete" with a <EOT> character sent after the last block. This character was not in a packet, but sent alone as a single byte. Since the file length was not sent as part of the protocol, the last packet was padded out with a "known character" that could be dropped. In the original specification, this defaulted to <SUB> or 26 decimal, which CP/M used as the end-of-file marker inside its own disk format. The standard suggested any character could be used for padding, but there was no way for it to be changed within the protocol itself – if an implementation changed the padding character, only clients using the same implementation would correctly interpret the new padding character.

Transfer details Files were transferred one packet at a time. When received, the packet's checksum was calculated by the receiver and compared to the one received from the sender at the end of the packet. If the two matched, the receiver sent an <ACK> message back to the sender, which then sent the next packet in sequence. If there was a problem with the checksum, the receiver instead sent a <NAK>. If a <NAK> was received, the sender would re-send the packet, and continued to try several times, normally ten, before aborting the transfer. A <NAK> was also sent if the receiver did not receive a valid packet within ten seconds while still expecting data due to the lack of a <EOT> character. A seven-second timeout was also used within a packet, guarding against dropped connections in mid-packet. The block numbers were also examined in a simple way to check for errors. After receiving a packet successfully, the next packet should have a one-higher number. If it instead received the same block number this was not considered serious, it was implied that the <ACK> had not been received by the sender, which had then re-sent the packet. Any other packet number signalled that packets had been lost. Transfers were receiver-driven; the transmitter would not send any data until an initial <NAK> was sent by the receiver. This was a logical outcome of the way the user interacted with the sending machine, which would be remotely located. The user would navigate to the requested file on the sending machine, and then ask that machine to transfer it. Once this command was issued, the user would then execute a command in their local software to start receiving. Since the delay between asking the remote system for the file and issuing a local command to receive was unknown, XMODEM allowed up to 90 seconds for the receiver to begin issuing requests for data packets.

Problems Although XMODEM was robust enough for a journalist in 1982 to transmit stories from Pakistan to the United States with an Osborne 1 and acoustic coupler over poor-quality telephone lines, the protocol had several flaws.

Minor problems XMODEM was written for CP/M machines, and bears several marks of that operating system. Notably, files on CP/M were always multiples of 128 bytes, and their end was marked within a block with the <EOT> character. These characteristics were transplanted directly into XMODEM. However, other operating systems did not feature either of these peculiarities, and the widespread introduction of MS-DOS in the early 1980s led to XMODEM having to be updated to notice either a <EOT> or <EOF> as the end-of-file marker. For some time it was suggested that sending a <CAN> character instead of an <ACK> or <NAK> should be supported in order to easily abort the transfer from the receiving end. Likewise, a <CAN> received in place of the <SOH> indicated the sender wished to cancel the transfer. However, this character could be easily "created" via simple noise-related errors of what was meant to be an <ACK> or <NAK>. A double-<CAN> was proposed to avoid this problem, but it is not clear if this was widely implemented.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with XMODEM

Start with the simplest possible case. Write down what XMODEM claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to XMODEM before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about XMODEM ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of XMODEM

In research
XMODEM appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses XMODEM in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
XMODEM is common in secondary-school and first-year university syllabi. It links to neighbouring topics BBS file transfer protocols, Computer-related introductions in 1977, so understanding it makes those chapters shorter.
In everyday life
Look for XMODEM outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “XMODEM” →

How to study XMODEM in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what XMODEM means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain XMODEM out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is XMODEM in simple terms?

XMODEM is a simple file transfer protocol developed as a quick hack by Ward Christensen for use in his 1977 MODEM.ASM terminal program. It allowed users to transmit files between their computers when both sides used MODEM.

Why does XMODEM matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study XMODEM?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on XMODEM.

Tags

  • BBS file transfer protocols
  • Computer-related introductions in 1977

Keep exploring