Numeric Topline

From Esolang
Jump to navigation Jump to search

This is an esoteric programming language by User:Zzo38 based on Topline, however Topline also uses the shift (not only the top line), and I could try to make it numeric only, also.

The count and address register are each 32-bits signed numbers, but values stored in addressed memory are 16-bits unsigned numbers.

Instructions:

  • 00 end of a block loop.
  • 01 begins a loop of while the count is odd.
  • 02 begins a loop of while the count is even.
  • 03 begins a loop of while the count is zero.
  • 04 begins a loop of a number of times equal to absolute value of the count at the beginning of the loop.
  • 05 begins a loop of while the count is negative.
  • 07 begins a loop of while the count is positive.
  • 08 begins a loop that runs infinite.
  • 10 prints the count as a numeral.
  • 110nn makes a system call.
  • 111nn send a signal to another program. It also sends the value of this count with the signal.
  • 112nn checks if this program is receiving that signal, if so it will set the count.
  • 113nn selects the program for send/receive signals with.
  • 16 takes a ASCII character input and alters the count via the polarity.
  • 17 prints the count as a ASCII character.
  • 2n adds a digit to the end of the program.
  • 3nnnn defines a label number in the program.
  • 40 skips a number of digits in the program equal to the count (negative count skips backwards). Skipping zero approaches only the next instruction after the digits of this instructions only.
  • 41 set the low bit of the count.
  • 42 clear the low bit of the count.
  • 43 resets the count to zero.
  • 45 set the polarity to negative.
  • 46 toggles the polarity.
  • 47 set the polarity to positive.
  • 49 immediately ends the program, or returns from a subroutine call.
  • 5nnnn goto a label. If there are multiple labels with this number, it will find the last one in the program.
  • 60 copies the count to the address register.
  • 61 copies the count to a memory address pointed to by the address register.
  • 68 adds four digits to the end of the program, which are the count modulo ten thousand.
  • 69 copies the count modulo ten to a location in the program pointed to by the address register (the first digit in the program is location zero).
  • 7nnnn gosub to a label. If there are multiple labels with this number, it will find the last one in the program.
  • 80 copies the address register to the count, and clears the extra register to zero.
  • 81 copies the value at the memory address pointed to by the address register to the count.
  • 83 find a label in the program with the number by count, and stores the result of where it is found, in the count. It will point directly to the label position (where the digit "3" is).
  • 89 copies the digit in the location in the program pointed by the address register, to the count.
  • 9nnnn alters the count via the polarity (adds or subtracts nnnn to/from the count).

Example copies input to output until zero:

474316071743160049