Skip to content
Surf Wiki
Save to docs
technology/computing

From Surf Wiki (app.surf) — the open knowledge base

SWEET16

Interpreted byte-code instruction set


Interpreted byte-code instruction set

SWEET16 is an interpreted byte-code instruction set invented by Steve Wozniak and implemented as part of the Integer BASIC ROM in the Apple II computers. It was created because Wozniak needed to manipulate 16-bit pointer data, and the Apple II was an 8-bit computer.

SWEET16 was not used by the core BASIC code, but was later used to implement several utilities. Notable among these was the line renumbering routine, which was included in the Programmer's Aid #1 ROM, added to later Apple II models and available for user installation on earlier examples.

SWEET16 code is executed as if it were running on a 16-bit processor with sixteen internal 16-bit little-endian registers, named through . Some registers have well-defined functions:

  • – accumulator
  • – subroutine stack pointer
  • – stores the result of all comparison operations for branch testing
  • – status register
  • – program counter

The 16 virtual registers, 32 bytes in total, are located in the zero page of the Apple II's real, physical memory map (at –), with values stored as low byte followed by high byte. The SWEET16 interpreter itself is located from to in the Integer BASIC ROM.

According to Wozniak, the SWEET16 implementation is a model of frugal coding, taking up only about 300 bytes in memory. SWEET16 runs at about one-tenth the speed of the equivalent native 6502 code; however it shaved around 20% off the size of Integer BASIC.

Operators

Register OpsNonregister Ops
1n
2n
3n
4n
5n
6n
7n
8n
9n
An
Bn
Cn
Dn
En
Fn

References

References

  1. Wozniak, Stephen. (November 1977). "SWEET16: The 6502 Dream Machine". [[Byte (magazine).
  2. (1978). "Apple Programmers Aid". Apple.
  3. Wozniak, Stephen. (May 1977). "The Apple II". [[Byte (magazine).
Info: Wikipedia Source

This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.

Want to explore this topic further?

Ask Mako anything about SWEET16 — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.

Report