GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Download
  • News
  • Community
  • Resources
  • Language Reference
  • SmallBASIC Manual

This view

  • Original page
  • New address

GeezerVison is showing smallbasic.github.io — SmallBASIC | ASC

Edit History

ASC

n = ASC (s)

Home > Reference > String

Returns the ASCII code of first character of the string s.

See CHR for converting a ASCII code to a character.

Example 1

print "ASCII value of A is "; ASC("A")      ' Output: ASCII value of A is 65

Example 2: Create an ASCII table.

LOCATE 1,16 : ? "ASC Table 30-129:"  ' locate print spot, print title for our app

FOR column = 0 to 9                    ' print a header, 10 numbers plus + (to add to row value)
  LOCATE 2, column * 5 + 4 : ? "+"; column
NEXT

FOR row = 3 to 12
  LOCATE row, 0 : ? RIGHT(" " + STR(row * 10) + ":", 4)
NEXT

'main table
FOR ASCnumber = 30 to 129              ' note ASC(32) = space so wont see anything in Table
  row = ASCnumber \ 10                 ' \ rounds division down to integer
  column = (ASCnumber MOD 10) * 5 + 5  ' times 5 to space out the characters printed plus 5 for column labels
  LOCATE row,column : ? CHR(ASCnumber)
NEXT
Code samples using ASC
3d_palmx.bas   ascii 3d.bas   balls in 3d cube.bas   base64.bas   bezier_pen.bas   blackbox.bas   Blackbox.bas   bonkers.bas   calc.bas   Capitol pal test.bas   circles Kalide v2.bas   ciretose.bas   color chart.bas   crop circles 1.bas   curtains.bas   drawpoly.bas   evdemo.bas   falling blocks - tetris.bas   form demo.bas   graphics sampler.bas   guessit.bas   GUI RPSLS v2.bas   hanoi.bas   hopalong.bas   I am a fan 2.bas   img2ascii.bas   irc-bot.bas   kaleidoscope v2.bas   kaleidoscope v3.bas  
String
ASC   BCS   BIN   CBS   CHOP   CHR   DISCLOSE   ENCLOSE   FORMAT   HEX   INSTR   JOIN   LCASE   LEFT   LEFTOF   LEFTOFLAST   LOWER   LTRIM   MID   OCT   REPLACE   RIGHT   RIGHTOF   RIGHTOFLAST   RINSTR   RTRIM   SINPUT   SPACE   SPC   SPLIT   SPRINT   SQUEEZE   STR   STRING   TRANSLATE   TRIM   UCASE   UPPER   VAL  
This page was last edited on Mon, 18 Sep 2023 17:32:59 +0200 | Markdown processed with pandoc 3.1.12.1
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.