What you’ll see by the end
Your compiled program will open an AmiBlitz3 Console Output window showing:
Hello from Blitz!
Compiled, not interpreted.It will wait for a left mouse click. You’ll then return to the editor, change the message and repair a deliberate error. Start with the AmiBlitz setup guide if PED is not open or you do not have a Tools: drive.
The whole program
NPrint "Hello from Blitz!"
NPrint "Compiled, not interpreted."
MouseWait
EndFour lines do the work:
NPrint "Hello from Blitz!"shows the text between the quotes, then starts a new line.NPrint "Compiled, not interpreted."shows a second line.MouseWaitwaits for the left mouse button, keeping the result on screen.Endfinishes the program.
Blitz compiles these instructions into an Amiga program before running them. That gives us the loop we’ll use throughout: write → compile → run → change.
Prepare the source file
For this first import, use a plain-text editor on your own computer. Save a file called hello.ab3 in the Tools folder you mounted in the setup guide. Use plain text, straight quotes and the exact .ab3 extension; check your editor has not added .txt.
Put these three lines at the very top:
; XTRA
; RuntimeDebug = 0
; /XTRAThen put the four program lines from the listing immediately below them. Your file has seven lines in total.
The three lines beginning with ; are AmiBlitz settings stored as comments. They turn off the runtime debugger for this source. We do not need its inspection windows for this greeting, and this setting gives us the console output shown above. PED reads these settings when it loads the file, then hides them from the editing area.
The listing’s maintained filename ends in .bb2, but its contents are plain text. Use .ab3 for this copy. AmiBlitz expects .bb2 input to contain binary tokens representing commands; loading this plain-text listing under that extension can produce “Garbage at the end of line”. Genuine binary .bb2 files are a different format.
Load, compile and run
- In PED, choose Source → Open, or press right-Amiga+O.
- In the file requester, use Drawer
Tools:and Filehello.ab3, then choose Load. Entering a complete path may first split it between those two fields. Check the fields before confirming again. - Check that the editing area shows the four program lines. The settings header should be hidden, and the
Ddebugger indicator should be dark. - Choose Compiler → Compile & Run, or press right-Amiga+#. The shortcut uses the
#character; its position depends on your keyboard layout. In PED, right-Amiga+X cuts text. - Wait for compilation. The console window should show both lines and remain open at
MouseWait. - Left-click to finish the wait. When you see
Press <ENTER> to return to the IDE ..., press Return to restore PED.
If a blank Sourcecode View appears instead of the greeting, check that you loaded the file containing the settings header. The checked route uses the runtime debugger off.
Change the message
In PED, add Edited inside the first pair of quotes, before Hello. Keep both quote marks. Compile and run again.
The first line should now read Edited Hello from Blitz!. The second should stay Compiled, not interpreted.. Left-click and press Return to get back to PED.
You changed the source. Compiling again built a program containing that change. Running an older compiled program would not pick up words you had only changed in the editor.
Make an error, then repair it
After the closing quote on the first line, add one extra +:
NPrint "Edited Hello from Blitz!"+Predict what will happen, then compile. AmiBlitz should open Compile Error, report “Syntax error!” and show the first line. This incomplete expression cannot be compiled into a runnable program.
Choose OK, or press left-Amiga+V, to dismiss this dialog. PED returns to the affected line. Remove the extra + and check that the rest of the line still matches the working version. Compile and run again: both output lines should return, including your edited greeting. Left-click, then press Return.
Finding an error is part of programming. The useful loop is to read the message, inspect the named line, make a small repair and run again to check the result.
If it doesn’t work
- “Garbage at the end of line” on a copied listing: check that the plain-text file is saved as
.ab3and that you loaded that copy. - Blank Sourcecode View: check the settings header and reload the file so PED reads it.
- Compile Error stays open after Return: use OK or left-Amiga+V. Return is used later at the program’s termination prompt.
- A different compile error: compare the affected line with the listing, including straight quotes and the spelling of
NPrint,MouseWaitandEnd. - A shortcut does something unexpected: use the named PED menu command and check the emulator’s Amiga-key mapping.
What you’ve learnt
You loaded plain-text source, compiled it, checked its output, changed it and recovered from a real compile error. NPrint shows text and starts a new line, MouseWait waits for a left click, and End finishes the program.
What’s next
The next lesson explores Amiga Mode and Blitz Mode: two ways Blitz works with the machine, with different commands available in each.