SWEET16
SWEET16 is an interpreted "byte-code" language invented by Steve Wozniak and implemented as part of the Integer BASIC ROM in the Apple II series of computers. 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.[1]
SWEET16 code is executed as if it were running on a 16-bit processor with sixteen internal 16-bit little-endian registers, named R0 through R15. Some registers have well-defined functions:[1]
- R0 is the accumulator.
- R12 is the subroutine stack pointer.
- R13 stores the result of all comparison operations for branch testing.
- R14 is the status register.
- 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), with values stored as low byte followed by high byte.[1] 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.[2] SWEET16 runs about one-tenth the speed of the equivalent native 6502 code.[1]
See also
- Lazer's Interactive Symbolic Assembler — an Apple II assembler
- Bytecode
- Compiler
- Interpreter
- Interpreted language
- Joel McCormack
- Microsoft P-Code
- Run-time system
- Token threaded code
- UCSD Pascal
References
- ↑ 1.0 1.1 1.2 1.3 Wozniak, Stephen (November 1977). "SWEET16: The 6502 Dream Machine". Byte. Retrieved 2011-01-05.
- ↑ Wozniak, Stephen (May 1977). "The Apple II". Byte. Retrieved 2012-05-18.
External links
- Call-A.P.P.L.E. Wozpak II — 1979 Call-A.P.P.L.E. booklet that includes "SWEET 16 Introduction" by Dick Sedgewick and a version of "SWEET 16: The 6502 Dream Machine" by Steve Wozniak with longer descriptions of each opcode
- Strotmann, Carsten (2004-03-21). "Porting Sweet 16". 6502.org.