Benutzer-Werkzeuge

Webseiten-Werkzeuge


lgp30:samples

Dies ist eine alte Version des Dokuments!


Small Programmes

Blanks are significant if among the last 8 characters before a tick, see proposal for formatting and comments

Test halt on overflow

As it is rather unusual that the machine stops on overflow, here is a small test program:

   halt on overflow
   ;zzz0700'
   /zzz0700'
   00   b0016'	get start
   01   a0017'	stops if overflow
        u0001'	loop
   variables:
   ;zzz0716'
   ,zzz0002'
   16 7ww00000' start
   17 00002000' increment
   go
   .zzz0700'    

Hello

The follwing program to print Hello on the console is rather untypical:

Print Hello
;   0600'
/   0600'
  xp1600'	CR
  xz0000'	sync
  xp0800'	UC
  xz0000'
  xp4900'	H
  xz0000'
  xp0400'	LC
  xz0000'
  xp3700'	e
  xz0000'
  xp0600'	l = 1
  xz0000'
  xp0600'	l
  xz0000'
  xp3500'	o
  xz0000'
  xz0800'	pause unless Br8
   u0000'	repeat
.   0600'

Simple Loop

Example looping program that prints a given number of asterisks:

   simple loop
   ;   0900'
   /   0900'
   00  xp0800'	upper case
       xz0000'	sync
       xp1600'	CR
       xz0000'
        b0022'	start value
        u0007'	avoid data wait
   06   b0020'	get counter 
   07   s0021'	minus step 
        t0013'	done if negative
        h0020'	save
       xp1000'	print *
       xz0000'
        u0006'	repeat
   13  xz0000'	halt
   14   u0000'	restart
   data:
   ;   0920'
   ,000  03'
   20 00000000' counter
   21 00000010' decrement
   22 00000050' initial
   start:
   .   0900'

Printing all digits

The following example prints all characters in numerical sequence, all digits as an example. It shows how to modify instructions:

   print 10 digits
   ;zzz0800'
   /zzz0800'
   00  xp0400'	lower case
       xz0000'
       xp1600'	CR
       xz0000'
   04  xp0200'	print 0
       xz0000' 
        b0004'	last printed
        e0022'	mask char code
        a0020'	increment
        y0004'	save 
        s0021'	end?
        t0004'	no
   12  xz0400'	stop for repeat  
        b0023'
        y0004'	start over
        u0000'
   data area:
   ;zzz0820'
   ,zzz0003'
   20 00000400' increment
   21 00002700' last digit 9 = x26, plus 1
   22 0000ww00' mask
   23 00000200' digit 0 
   start here:
   .zzz0800'
lgp30/samples.1516014126.txt.gz · Zuletzt geändert: 2018-01-15 12:02 von rainer