Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Operators  





2 References  





3 External links  














SWEET16







 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


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.[1]

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.[2]

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]

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 $F689to$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.[3] SWEET16 runs at about one-tenth the speed of the equivalent native 6502 code.[1]

Operators

[edit]
Register Ops Nonregister Ops
00 RTN Return to 6502 mode
1n SET Rn Constant set 01 BR ea Branch always
2n LD Rn Load 02 BNC ea Branch if No Carry
3n ST Rn Store 03 BC ea Branch if Carry
4n LD @Rn Load indirect 04 BP ea Branch if Plus
5n ST @Rn Store indirect 05 BM ea Branch if Minus
6n LDD @Rn Load double-byte indirect 06 BZ ea Branch if Zero
7n STD @Rn Store double-byte indirect 07 BNZ ea Branch if NonZero
8n POP @Rn Pop indirect 08 BM1 ea Branch if Minus 1
9n STP @Rn Store Pop indirect 09 BNM1 ea Branch if Not Minus 1
An ADD Rn Add 0A BK Break
Bn SUB Rn Subtract 0B RS Return from Subroutine
Cn POPD @Rn Pop double-byte indirect 0C BS ea Branch to Subroutine
Dn CPR Rn Compare 0D Unassigned
En INR Rn Increment 0E Unassigned
Fn DCR Rn Decrement 0F Unassigned

References

[edit]
  1. ^ a b c d Wozniak, Stephen (November 1977). "SWEET16: The 6502 Dream Machine". Byte. Retrieved 2011-01-05.
  • ^ Apple Programmers Aid (PDF). Apple. 1978.
  • ^ Wozniak, Stephen (May 1977). "The Apple II" (PDF). Byte. Retrieved 2012-05-18.
  • [edit]
    Retrieved from "https://en.wikipedia.org/w/index.php?title=SWEET16&oldid=1235358565"

    Categories: 
    Apple II software
    Interpreters (computing)
    Register-based virtual machines
    Hidden categories: 
    Articles with short description
    Short description matches Wikidata
     



    This page was last edited on 18 July 2024, at 21:51 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki