//
// INSTEAD OF USING HARD-TO-REMEMBER
// NUMBERS, PLASMA ALLOWS YOU TO
// REPLACE THOSE WITH SYMBOLIC VALUES
//
CONST CR     = $8D
CONST MALE   = 0
CONST FEMALE = 1

//
// STRUCTURES ARE SYNTACTICAL CANDY
// FOR CREATING OFFSETS. IN THE FOLLOWING
// EXAMPLE, MYSTRUC IS A CONSTANT VALUE
// OF THE SIZE OF THE STRUCTURE. THE
// ELEMENTS WILL BE CONSTANTS REPRESENTING
// THE OFFSETS INTO THE STRUCTURE.
//
STRUC MYSTRUC
  BYTE[32] FIRST
  BYTE[32] LAST
  BYTE AGE
  WORD SEX
END

BYTE MALESTR   = "MALE"
BYTE FEMALESTR = "FEMALE"

//
// INITIALIZE A SAMPLE RECORD.
//
BYTE[] RECORD
BYTE[32] = "STEVE"
BYTE[32] = "WOZNIAK"
BYTE     = 61
WORD     = @MALESTR

//
// HERE IS A NEW WAY TO USE POINTERS: AS
// A POINTER TO A STRUCTURE. AGAIN,
// SINCE POINTERS DON'T KNOW WHAT THEY
// POINT TO, THERE ARE TWO OPERATORS TO
// POINT TO A BYTE, OR POINT TO A WORD.
// '->' POINTS TO A BYTE USING A POINTER
// AND AN OFFSET. '=>' POINTS TO A WORD
// USING A POINTER AND AN OFFSET. IN
// THE FOLLOWING EXAMPLE, THE OFFSETS
// COME FROM THE 'MYSTRUC' DEFINITION.
//
DEF PUTREC(RECPTR)
  PUTS(@RECPTR->FIRST) // ADDRESS OF FIRST NAME
  PUTC(CR)
  PUTS(@RECPTR->LAST)  // ADDRESS OF LAST NAME
  PUTC(CR)
  PUTI(RECPTR->AGE)    // AGE (BYTE)
  PUTC(CR)
  PUTS(RECPTR=>SEX)    // POINTER TO STRING (WORD)
END

PUTS("STRUCTURE SIZE:")
PUTI(MYSTRUC)  // THIS IS JUST THE SIZE OF THE STRUCTURE
PUTC(CR)

//
// PASS THE ADDRESS OF A SAMPLE RECORD
// TO BE PRINTED OUT.
//
PUTREC(@RECORD)
DONE
