10 REM Allocate 4KB for the assembled file.
   20 DIM program 4*1024
   30 REM Equates from ti83plus.inc.
   40 GetCSC=&4018
   50 PutS=&450A
   60 ClrLCDFull=&4540
   70 HomeUp=&4558
   80 skClear=&0F
   90 REM You need to run two passes manually.
  100 REM OPT 4 means "assemble code at O% with error detection switched off and no listing".
  110 REM OPT 6 means "assemble code at O% with error detection switched on and no listing".
  120 FOR pass=0 TO 1
  130   opt=pass*2+4
  140   REM P% is the origin (.org), O% is the place to store the assembled program.
  150   P%=&9D93 : O%=program
  160   [OPT opt
  170   ; AsmPrgm
  180   DEFB &BB : DEFB &6D
  190   ; Ion header.
  200   RET
  210   JR NC,main
  220   DEFM "BBC BASIC Assembler"
  230   DEFB 0
  240   ; Main program start here.
  250   .main
  260   OPT FN_bcall(ClrLCDFull)
  270   OPT FN_bcall(HomeUp)
  280   LD HL,message
  290   OPT FN_bcall(PutS)
  300   .waitClear
  310   OPT FN_bcall(GetCSC)
  320   CP skClear
  330   RET Z
  340   JR waitClear
  350   .message
  360   DEFM "Hello, world!"
  370   DEFB 0:]
  380 NEXT pass
  390 REM Save the assembled binary to a program using *SAVE.
  400 OSCLI "SAVE IONPROG "+STR$~program+" "+STR$~O%
  410 END
  420 REM Macros
  430 DEF FN_bcall(i)
  440 [OPT opt
  450 RST &28
  460 DEFW i:]
  470 =opt