Share on Facebook Share on Twitter Email
Answers.com

SWEET16

 
Wikipedia: 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 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:

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.

Contents

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

References

External links


Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
 
 

 

Copyrights:

Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "SWEET16" Read more