(Example: +interarchy +wands) Advanced Search & Tips
GUI Goodies
Clocks iTunes Skins
Desktop Pictures App Makeovers
GUI Software Explorer Skins
Icons Propaganda Tiles
Interarchy Interfaces Themes

Throbbers
Home Page
Splash Screens
ATM Replacements
Application Splashes
Explorer Splashes
MacOS Startups (MOSS)
Netscape Splashes

MacOS X
MacOS X Mods
Login Panels
Boot Panels
Dock Poofs
Darwin
Boot Images
Safari Stuff
ResEdit
Classic ResEdit Mods
Getting Started
Download ResEdit
Resource/Template


Help Sections
User Forum
About Us!
Icon Help
Site Map
Submission Policy
Contact Us
In Addition...
REALbasic
Snapshots
Advertising
Linux Icebox
Applescript/Scripting
Links Page
Download Stats
Download a free demo of REALbasic!
Download a free demo of REALbasic!
Recent Articles...
Attention
Mac OS X 10.2 Users!

Browse with Sherlock
By Date


By Category

3D
3D Photo Gallery Part 2 (12-06-01)
3D Photo Gallery Part 1 (11-29-01)

Audio
Laugh Track Machine
Audio Player with Reverb
Shepard Melody(11-08-01)
RB Phone Home (10-25-01)
Build a Drum Machine (10-04-01)

General RB
Listbox Auto-Find
iTunes-style Listboxes
Virtual Volumes
Time Tracker
Software Distribution Part 4
Software Distribution Part 3
Software Distribution Part 2
Software Distribution Part 1
Exceptions
Custom Controls (8-2-01)
Living on the Edge (6-21-01)
Tips and Tricks (6-14-01)
Review of REALbasic 3.0 (2-19-01)
Text Clippings Made Easy (5-10-01)

Graphics
Shimmer Graphics
Lissajous Figures
Simple Screen Capture
Vector Graphics
Kaleidoscope Images
Stegonography
Spirals!
Image Table (11-15-01)
RB Magnifying Lens (10-11-01)
Screen Capture (8-9-01)
Color Picker Tutorial (6-7-01)

Hacks
Ghost Grab
Speedy Mouse Extension(11-01-01)
iTunes Plugins (8-23-01)
iTunes Skinner (7-26-01)

Internet
HTML IMG Tags
Version Tracking
Even Smarter Instant Messaging
Web Tiler
JavaScript and REALbasic (10-02-01)
Stock Ticker - Part II (9-06-01)
Stock Ticker - Part I (8-30-01)
AIM Mate (8-16-01)

Mac OS X
Build a Bundle Part 2
Build a Bundle Part 1
Dock Your Passwords
Mac OS X Debugging
REALbasic Mac OS X Icon Tutorial (12-13-01)
Animate Your Dock (5-17-01)
RB and the Command Line (5-3-01)

Novelty
Tile Mixer
Zip Code Finder
Happy Valentine's Day
Merlin Simulator Part 3 (01-24-02)
Merlin Simulator Part 2 (01-17-02)
Merlin Simulator Part 1 (01-10-02)
Buzzword Machine (10-18-01)
AppleSoft BASIC (9-20-01)

Printing
Print to PDF

Resources
Picture Extractor 2 (5-31-01)
Picture Extractor 1 (5-24-01)

Serial
Caller ID Part 3 (7-12-01)
Caller ID Part 2 (7-5-01)
Caller ID Part 1 (6-28-01)

Speech
Speech Recognition (9-13-01)
Video
Big Brother Video Capture

Newest Dev Tools!

Book Alert !
REALbasic for Dummies
by Erick Tejkowski
$19.99 @ Amazon

Made with REALbasic!

Problems?
Downloads are in StuffIt 5 format (free download).
Tell me about a bad link (Thanks!).
Submission Policy

9-20-01

Build an Applesoft BASIC Simulator by Erick Tejkowski

After hearing from a few Apple ][ diehards, it occurred to me that some REALbasic newbies might be making the transition to REALbasic from Apple BASIC. Many folks started their programming careers using the venerable Applesoft BASIC on the various models of the Apple ][ (yours truly included).

In their honor, this week we will build a simple Applesoft BASIC simulator, which will allow you to enter and "run" graphics commands from the Applesoft BASIC language. Hang on to your seats as we set the time traveler to 1980...

Preparation

Ok, here we are in 1980 staring at the TV screen of our fancy Apple ][ machine. Each Apple machine at the time came with a copy of Applesoft BASIC, a BASIC intrepreter. One of the first things an Applesoft BASIC programmer learned to do was create low resolution graphics. They were lousy compared to today's standards, but they have a certain retro charm. Our project will simulate some of the low resolution graphics commands of the Applesoft BASIC language.

Command Function
HOME Clear the screen with the current color.
COLOR=x Sets the current color to 'x'. 'x' can be any integer between 0 and 15 inclusive.
HLIN x1,x2 at y Draws a horizontal line from x1 to x2 at the y coordinate.
VLIN y1,y2 at x Draws a vertical line from y1 to y2 at the x coordinate.

Low resolution Applesoft BASIC graphics have a coordinate system much like REALbasic with the origin (0,0) at the top left. Unlike REALbasic, the dimensions of the screen are 40 columns wide by 48 columns high. Look here if you would like to learn more about the Applesoft BASIC commands.

Build the Interface

Launch REALbasic and open the default window, Window1. From the toolbar, add the following controls to the interface:

Control Settings
Canvas Name : tvscreen
(Many people used a TV set as the Apple II's monitor.)
Width=400
Height=480
Listbox Name : programlist
Where we will output any data that normally appeared onscreen in Applesoft BASIC.
EditField Name : codefield
Where we will enter a graphics command.
PushButton Name : PushButton1
Pushing this button executes the command.

Feel free to experiment with the layout, but it might look something like this:

09_20-interface.jpg (18k)

Add the Code

Double click any control to open the Code Editor. Before adding any code, though, select Edit->NewProperty and create the following two Properties:

09_20-properties.jpg (4947bytes)

To begin the coding, navigate to the Open event of Window1 and enter the following code:

09_20-opencode.jpg (17k)

This code initializes the color to black (the same as on an Apple ][) and creates a picture object. The picture, p is where we will draw the graphics for each command. Notice that it is very small (only 40x48 pixels). We will stretch this picture over a larger (but similarly shaped) Canvas to display it to the user. Since this is low resolution graphics, it doesn't matter that we lose resolution.

Next, open the Paint event of the tvscreen Canvas and enter this code:

09_20-paintcode.jpg (14k)

You might guess that this code "stretches" (called scaling in graphics lingo) the picture p over the Canvas.

Select Edit->New Method to add a new method named SetCurrentColor(colornumber as integer). We will pass this method a color number (between 0 and 15) and adjust the current color accordingly:

09_20-setcurrentcolor.jpg (100k)

The final step in this code is to process the commands a user enters. The code is somehwat involved and takes up a lot of space on a web page. For this reason, I will briefly discuss it here, but not display it. To see it, you can download the completed project at the end of this tutorial.

Each time a user enters a command and presses "Enter", we have to figure out which command it was and act appropriately. This occurs in the Action event of PushButton1. We start by looking for the "HOME" command, since it is only four letters long. If we find it, we fill in the picture p and exit the code. If the "HOME" command wasn't entered, then the user may have entered one of the other three commands: COLOR, HLIN, and VLIN. The remainder of the code determines which of these commands has been entered. If the COLOR command is entered, the SetCurrentColor method gets called. If the command is HLIN or VLIN, the code draws the appropriate sized line and refreshes the tvscreen Canvas. If, at any time, our code gets some garbage command or improper syntax, we warn the user that they have entered an invalid command.

Conclusion

09_20-finis.jpg (14k)

This week you need to download the completed project to see all of the code. Go dig up that collection of old Byte magazines and scour them for low resolution graphics code. If you are feeling really daring, you might add some code that allows a user to save their work of art or the sequence of commands used in creating the picture. when you get finished playing with the code set your time machine back to 2001. See you next week!


9-18-01

News by Erick Tejkowski

New REALbasic Version! REAL Software has posted a new version of REALbasic: RB 3.5.1. This is a free upgrade for 3.5 owners and looks to include many bug fixes, so don't miss it!

Transfer files with QuickTime. Alfred Van Hoek has finalized the first version of his QuickTime File Transfer plugin. It comes in demo and pro versions and allows you to download files from a URL to a RB FolderItem. It works on all platforms that REALbasic 3.5.1 supports.

Fancy Buttons with REALbasic. Searchware Solutions has released cPictureButton 1.0. This class lets you create buttons of any shape you desire. All you have to do is supply the picture and mask. cPictureButton does the rest.

Marching Ants and Crosshairs. ZegSoft has announced the immediate availability of Neato! Widgets, which gives you instant access to the "Marching Ants" and other related goodies.

09-18_Ant.GIF (2808bytes)

New Calculator Plugin. Bob Delaney has an interesting REALbasic plugin on his site, entitled MPCalc Plugin.

MPCalc plugin provides the functionality of my multi-precision RPN calculator to a REALbasic program. It can handle numbers with up to 30,000 decimal digits. It can also handle numbers whose absolute values lie between 1e-167100000 and 1e+167100000. As a Carbon and PPC plugin it can run under either Mac OS 9.x or Mac OS X. Over forty scientific functions are now available.


GUI Goodies
Clocks iTunes Skins
Desktop Pictures App Makeovers
GUI Software Explorer Skins
Icons Propaganda Tiles
Interarchy Interfaces Themes

Throbbers
Home Page
Splash Screens
ATM Replacements
Application Splashes
Explorer Splashes
MacOS Startups (MOSS)
Netscape Splashes

MacOS X
MacOS X Mods
Login Panels
Boot Panels
Dock Poofs
Darwin
Boot Images
Safari Stuff
ResEdit
Classic ResEdit Mods
Getting Started
Download ResEdit
Resource/Template


Help Sections
User Forum
About Us!
Icon Help
Site Map
Submission Policy
Contact Us
In Addition...
REALbasic
Snapshots
Advertising
Linux Icebox
Applescript/Scripting
Links Page
Download Stats

Maintained by the Staff of ResExcellence. This entire site ©1997-2003 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement.

243 on the ResEx LinuxPPC Server