Chipmunk Basic

Uit Wikipedia, de vrije encyclopedie
Ga naar: navigatie, zoeken

Chipmunk Basic is een freeware-interpreter voor de programmeertaal BASIC voor de Apple Macintosh onderhouden door de ontwikkelaar Ron Nicholson. Chipmunk Basic heeft ook versies voor andere platforms als Linux en Windows. De GUI-versie bevat verscheidene grafische tekencommando's en objectgeoriënteerde programmeerconstructies. Deze en afgeleide versies (voor Palm OS, cBasPad en HotPaw) zijn gebaseerd op een Pascal-implementatie in het publiek domein door David Gillespie, auteur van de Pascal vertaler p2c.

Voorbeelden[bewerken]

XFA01.bas[bewerken]

100 rem Clear screen - make table of control characters and show your own application_id & first 32 codeNumbers
110 cls : dim i$(34) : dim m$(255) : for j = 0 to 34 : read i$(j) : m$(j) = i$(j) : next j
120 print "XFA01.bas {ar.v.u(p): cb3.6.6(b0)} Show ASCII Table"
130 k = -32 : gosub 180 : for j = k+32 to l+32 : print i$(j); : next j : print
140 rem print all codeLines in a loop & finish
150 while j < 225 : gosub 260 : wend
160 print i$(33) : goto 340
170 rem SubProcedure to show characterCodes
180 if k = 64 then l = k+30 else l = k+31
190  for j = k+32 to l+32 : print right$("   "+str$(j),4); : next j : if j = 127 then print " 127"; : j = j+1
200  print : return
210 rem ASCII-characters contained in a line
220 for j = k+32 to l+32 : m$(j) = " '"+chr$(j)+"'" : print m$(j); :  : next j
230  if j = 127 then m$(j) = i$(32) : print m$(j); : j = j+1
240  print : return
250 rem both codes and content
260 k = j-32 : gosub 180 : gosub 220 : return
270 rem when user chose 'cont(inue)' print table as 16*16
280 l = k+15 : print "x";left$(hex$(k),1);"c;"; : for j = k to l : print m$(j); : next j : print : k = j : return
290 rem 'database' of special chars that are making a mess of your screen if printed as is 
300 data " nul"," soh"," stx"," etx"," eot"," enq"," ack"," bel","  bs","  ht","  lf","  vt","  ff","  cr","  so","  si"
310 data " dle"," dc1"," dc2"," dc4"," dc4"," nak"," syn"," etb"," can","  em"," sub"," esc","  fs","  gs","  rs","  us"
320 data " del","*brk","*rdy"
330 rem Break so user can decide to continue, quit, change, restart etcetra
340 stop : print "&#r(c=)0   1   2   3   4   5   6   7   8   9   a   b   c   d   e   f"
350  k = 0 : while k < 241 : gosub 280 : wend : print : print i$(34) : end

Externe links[bewerken]



Logo Wikibooks
Wikibooks heeft een Engelstalig boek over dit onderwerp: Chipmunk Basic pocketManual