- SWEET16
SWEET16 is an interpreted "
byte-code " language invented bySteve Wozniak and implemented as part of theInteger BASIC ROM in the Apple II computer. It was created because Wozniak needed to manipulate 16-bit pointer data in his implementation ofBASIC , 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 thestatus register .
* R13 stores the result of all comparison operations for branch testing.
* R15 is theprogram 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 theInteger BASIC ROM.According to Wozniak, the SWEET16 implementation is a model of frugal coding, taking up only about 300
byte s in memory. SWEET16 runs about 10 times slower than the equivalent native 6502 code.The source code
In the very beginning of personal computing,
copyright edsource code s were generally published (exception:Applesoft BASIC created byBill 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 References
*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.