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:
Operators
{| class="wikitable"
! colspan="3" | Register Ops
! colspan="3" | Nonregister Ops
|-
|
|
|
|00
|
|Return to 6502 mode
|-
|1n
|
|Constant set
|01
|
|Branch always
|-
|2n
|
|Load
|02
|
|Branch if No Carry
|-
|3n
|
|Store
|03
|
|Branch if Carry
|-
|4n
|
|Load indirect
|04
|
|Branch if Plus
|-
|5n
|
|Store indirect
|05
|
|Branch if Minus
|-
|6n
|
|Load double-byte indirect
|06
|
|Branch if Zero
|-
|7n
|
|Store double-byte indirect
|07
|
|Branch if NonZero
|-
|8n
|
|Pop indirect
|08
|
|Branch if Minus 1
|-
|9n
|
|Store Pop indirect
|09
|
|Branch if Not Minus 1
|-
|An
|
|Add
|0A
|
|Break
|-
|Bn
|
|Subtract
|0B
|
|Return from Subroutine
|-
|Cn
|
|Pop double-byte indirect
|0C
|
|Branch to Subroutine
|-
|Dn
|
|Compare
|0D
|colspan=2
|-
|En
|
|Increment
|0E
|colspan=2
|-
|Fn
|
|Decrement
|0F
|colspan=2
|}
References
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
