Apers Assembly

From Esolang
Jump to navigation Jump to search

Apers Assembly is a Assembly-like Esolang, where all instructions are anagrams of the word apers. It was created by user:Bertrahm. An aper, according to merriam-webster.com, is a person who adopts the appearance or behavior of another especially in an obvious way.

The Language

Apers Assembly has a total of 17 Instructions, these 17 Instructions are represented with 12 anagrams of the word "apers". Single-Line/EOL comments can be made with a semi-colon

Table of Instructions
MNEMONIC DESCRIPTION PARAMETERS
apers BRANCH RESULT ZERO BRANCH ADDRESS
apres BRANCH RESULT GREATER BRANCH ADDRESS
asper BRANCH RESULT LESS BRANCH ADDRESS
pares BRANCH BRANCH ADDRESS
parse LOAD REGISTER REGISTER, VALUE/ADDRESS/POINTER
pears STORE REGISTER REGISTER, ADDRESS/POINTER
prase ADD REGISTER + MEMORY REGISTER, ADDRESS/POINTER
presa SUB REGISTER - MEMORY REGISTER, ADDRESS/POINTER
rapes INPUT TO REGISTER REGISTER
reaps OUTPUT REGISTER REGISTER
spare COMPARE REGISTERS REGISTER, REGISTER
spear EXIT PROGRAM NONE
Instruction Codes
 $00 apers
 $01 apres
 $02 asper
 $03 pares
 $04 parse (VALUE)
 $05 parse (ADDRESS)
 $06 parse (POINTER)
 $07 pears (ADDRESS)
 $08 pears (POINTER)
 $09 prase (ADDRESS)
 $0a prase (POINTER)
 $0b presa (ADDRESS)
 $0c presa (POINTER)
 $0d rapes
 $0e reaps
 $0f spare
 $10 spear
Address/Pointer/Value

Several instructions want either a Address, a Pointer or a Value as a parameter, in Apers Assembly these are defined as follows:

  • #<HEX-VALUE> For Values
  • *<HEX-VALUE> For Pointers
  • $<HEX-VALUE> For Addresses
Labels

Labels are defined using the LABEL keyword followed by its name (Note that the first letter must be capitalised). These get lost in assembling, as the assembler notes the address of the next instruction and places this address at each label mention. Example

 LABEL MyLabel
   ; Some Source Code Here
 
 pares MyLabel ; Jump to my label

Label Addresses/Program Instruction Addresses are the only 32-bit numbers in a program

The Runtime

An Apers assembly runtime should have 3 8-bit registers named a, b & c,it should provide 16 Kilo-Bytes of RAM.

Results of Arithmetic Operations should be stored in the Register they were performed with.

Examples

 ; Hello World with Manipulating Register Values
 ; instead of just loading each character's hex
 ; into a.
 parse a, #48 ; Init Data (H)
 parse b, #1d ; Adder
 pears b, $00
 parse b, #07
 
 reaps a      ; Print H
 prase a, $00 ; Make a to #65
 reaps a      ; Print e
 pears b, $00 ; Get #07 from b
 parse b, #03 ; Make b #03
 prase a, $00 ; Make a to #6c
 reaps a      ; Print ll
 reaps a
 pears b, $00 ; Get #03 from b
 prase a, $00 ; Make a to #6f
 reaps a      ; Output o
 presa a, $00 ; Make a #6c
 parse b, #40 ; Make b #40
 pears b, $00 ; Get #40 from b
 presa a, $00 ; Make a #2c
 reaps a      ; Print ,
 parse b, #0c ; Make b #0c
 pears b, $00 ; Get #0c from b
 presa a, $00 ; Make a #20
 reaps a      ; Print SPACE
 parse b, #37 ; Make b #37
 pears b, $00 ; Get #37 from b
 prase a, $00 ; Make a #57
 reaps a      ; Print W
 parse b, #18 ; Make b #18
 pears b, $00 ; Get #18 from b
 prase a, $00 ; Make a to #6f
 reaps a      ; Print o
 parse b, #03 ; Make b #03
 pears b, $00 ; Get #03 from b
 prase a, $00 ; Make a to #72
 reaps a      ; Print r
 parse b, #06 ; Make b #06
 pears b, $00 ; Get #06 from b
 presa a, $00 ; Make a to #6c
 reaps a      ; Print l
 parse b, #08 ; Make b #08
 pears b, $00 ; Get #08 from b
 presa a, $00 ; Make a to #64
 reaps a      ; Print d
 spear        ; EXIT

External Links