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

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

* R0 is the accumulator.
* R14 is the status register.
* R13 stores the result of all comparison operations for branch testing.
* R15 is the 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 $00-$1F). The SWEET16 interpreter itself is located from $F689 to $F7FC 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 about 10 times slower than the equivalent native 6502 code.

The source code

In the very beginning of personal computing, copyrighted source codes were generally published (exception: Applesoft BASIC created by Bill Gates). Here are the first few lines of SWEET16's source code written by Wozniak. The starting address of SWEET16 is $F689 and the virtual 16-bit registers are little-endian.

******************************** * * * APPLE-II PSEUDO MACHINE * * INTERPRETER * * * * COPYRIGHT (C) 1977 * * APPLE COMPUTER, INC * * * * ALL RIGHTS RESERVED * * * * S. WOZNIAK * * * ******************************** * * * TITLE: SWEET 16 INTERPRETER * * * ******************************** R0L EQU $0 R0H EQU $1 R14H EQU $1D R15L EQU $1E R15H EQU $1F SAVE EQU $FF4A RESTORE EQU $FF3F ORG $F689

See also

* Lisa assembler


*Wozniak, Steve. "SWEET16: The 6502 Dream Machine". "BYTE". November 1977. [http://www.6502.org/source/interpreters/sweet16.htm#SWEET_16_A_Pseudo_16_Bit_Micropr]

External links

* [http://www.6502.org/source/interpreters/sweet16.htm Porting SWEET16]

Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Sweet sixteen (birthday) — A sweet sixteen party is a type of birthday party in the United States, usually celebrated for a girl on her sixteenth birthday. Sweet Sixteen parties were once given as a celebration of the girl s virginity, or a celebration of being old enough… …   Wikipedia

  • WVU — Vorlage:Infobox Hochschule/Logo fehlt West Virginia University Motto Add to your faith virtue and to virtue knowledge Gründung 1867 Trägerschaft Öffentlich Ort Morgantown (West Virginia), Vereinigte Staaten Präsident C. Peter Magrat …   Deutsch Wikipedia

  • West Virginia University — Motto Add to your faith virtue and to virtue knowledge Gründung 1867 …   Deutsch Wikipedia

  • Apple IIGS — Mac specs Introduced=September 1986 MSRP=999 CPU=65C816 CPUspeed=2.8 MHz OS=Apple ProDOS, Apple GS/OS RAM=256 KB or 1 MB (expandable up to 8 MB) RAMtype= Discontinued=December 1992The Apple sc|IIgs, the fifth model inception of the Apple II, was… …   Wikipedia

  • Virtual machine — A virtual machine (VM) is a completely isolated guest operating system installation within a normal host operating system .[1] Modern virtual machines are implemented with either software emulation or hardware virtualization or (in the most… …   Wikipedia

  • Bytecode — is a term which has been used to denote various forms of instruction sets designed for efficient execution by a software interpreter as well as being suitable for further compilation into machine code. Since instructions are processed by software …   Wikipedia

  • Integer BASIC — Integer BASIC, written by Steve Wozniak, was the BASIC interpreter of the Apple I and original Apple II computers. Originally available on cassette, then included in ROM on the original Apple II computer at release in 1977, it was the first… …   Wikipedia

  • Sweet Sixteen — may refer to: *Sweet sixteen (birthday), a party thrown in honor of a girl s and guy s sixteenth birthday, primarily in the United StatesIn sports: *Sweet Sixteen (NCAA Basketball Tournament), the final sixteen teams in the NCAA Division I… …   Wikipedia

  • Lazer's Interactive Symbolic Assembler — (Lisa) is an interactive MOS 6502 assembler for Apple II computers written by Randall Hyde in the late 1970s.The latest version of Lisa is V3.2. Syntax mistakes can be reported immediately in the edit mode. Lisa can assemble about 30,000 lines of …   Wikipedia

  • Atari 8-bit computer peripherals — This article covers the range of peripherals available for Atari s 8 bit home computer range (including the 400/800, XL and XE series machines).All of Atari s external peripherals used the proprietary SIO port, which allowed them to be daisy… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”

We are using cookies for the best presentation of our site. Continuing to use this site, you agree with this.