User Tools

Site Tools


ugbasic:user:pills:1
Translations of this page:


Pills of... ugBASIC!

EPISODE 1 - THE STRINGS

Although ugBASIC is a compiler that converts BASIC into MOS 6510, Motorola 6809 or Zilog Z80 assembly, for some parts it is dynamic just like an interpreter. For example, in string management. If you write:

  a = "goofy"
  b = "donald duck"
  c = a + " and " + b
  PRINT c
  

and run it, you will see the string “goofy and donald duck”. However, when did you ask to provide adequate space to keep this string in the c variable? Never. In fact, ugBASIC thinks about it, as BASIC in the 1980s.

In ugBASIC there can be up to 255 strings (16 on ColecoVision, SEGA SC-3000 and SG-1000) which, depending on the processor, can be a maximum of 127 (6809) or 255 (6510, Z80) characters long, and can occupy up to 1 KB. Does it seem little to you? You can increase the space with the DEFINE STRING SPACE command and change the number of strings with the DEFINE STRING COUNT command.

But be careful! For each KB of memory for strings you need another free one, and each string (not as text, but as a variable) takes up a space, so … be careful not to overdo it!

POWERED BY