Skip to content

Assembler: @ command errors #4

@markarmb

Description

@markarmb

Bug encountered by many students who use @-1 in thier Fill.asm programs.

Numbers outside the range [0, 32767] cause undetected errors in assembly.
This affects all instances of the assembler as used in Assembler, CPUEmulator and HardwareSimulator.

////////////////////////////////////////////////////////////////////////
// FILE:  bad_a.asm
//
// No error messages are generated by this file.

// source      binary
@0          // 0000000000000000     OK
@-1         // 1111111111111111     illegal c-instuction generated
@-2         // 1111111111111110     illegal c-instuction generated
@32767      // 0111111111111111     OK
@32768      // 0000000000010000     RAM address for variable "32768"
@32769      // 0000000000010001     RAM address for variable "32769"
@foo        // 0000000000010010     RAM address for variable "foo"
@32770      // 0000000000001011     ROM address for label "32770"
@-32768     // 1000000000000000     illegal c-instuction generated
@-32769     // 0000000000010011     RAM address for variable "-32769"
@-32770     // 0000000000001100     ROM address for label "-32770"
(32770)     //                      label "32770" (ROM addr = 11)
@0          // 0000000000000000     OK
(-32770)    //                      label "-32770" (ROM addr = 12)

// There are at least two bugs here:
//   o  numbers outside the range [-32678, 32767] are being treated
//      as symbols in all contexts.  (Parser bug?)
//   o  negative numbers are not disallowed in '@' commands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions