Amethyst Subframe Computer Series
Model A V1.1
Features:
This project has taken 5 months of my life,
I would love and appreciate your support.
Amethyst Computer is proud to be the most
complete and smallest 29-bit computer in TPT. (2021)
Assembler Instruction words
Assembler language and integers are in HEX.
Download Mark2222 subframe mod to write
and read the CTIPE in HEX.
Or convert HEX to Decimal and paint
in the filt.
TPT Asembler will be supported soon.
TPT Asembler unique ID 0x0CEBADA0
(Most Significant Bit)
(Least Significant Bit)
MSB 0x20000000 LSB
Always write in the instructions the MSB.
The MSB is for avoid the Bray Anihilation.
---------------------------------------------
Integers
Integer format complement 1a:
Integer:
0x3FFFFFFF
Without MSB:
0x1FFFFFFF
precision of 1a complement:
536,870,911 variables
Integer format complement 2a:
Integer:
0x2FFFFFFF
Without MSB:
0x0FFFFFFF
Overflow:
0x30000000
Without MSB:
0x10000000
precision of 2a complement:
+ 268,435,455 (+ 0) - 268,435,455 variables
---------------------------------------------
Computer Instruction set
Bit field used
0x1F000000
A: Operand A
B: Operand B
Instruction type: ALU Out:
00 BUF 0x00 Buffer operand B,
In case you do not specify any field,
this instruction works as NOP (No OPeration)
It is NOP quite useful
for syncing with slower ports.
01 ADD 0x01 Add A + B
02 ADC 0x02 Add A + B + 1
03 AND 0x03 A & B
04 ORR 0x04 A | B
05 XOR 0x05 A ^ B
06 RSH 0x06 A >> B
07 LSH 0x07 A << B
Instruction type: Boolean Out:
08 AEB 0x08 A == B
09 AOF 0x09 (A has OverFlow)
Evaluates if A has OverFlow,
10 ADOF 0x0A (Carry Out has Overflow)
Evaluates if adder Carry Out has Overflow,
11 EIR 0x0B (Evaluate In Request)
Evaluates if the bus
request for instructions
to be attended to is true
Instruction type: Conditional jump:
12 CDJP 0x0C Conditional Direct jump,
29 ADJP 0x1C Inconditional Direct jump,
13 CIJP 0x0D Conditional Indirect jump,
30 AIJP 0x1D Inconditional Indirect jump,
Instruction type: State:
14 SLP 0x0E Sleep mode
15 HLT 0x0F Halt CPU
-
Operands
Selects the integers to be sended or
processed.
Bit field used
0x20FF0000
Operand A:
Bit field used
0x20F00000
0x0 to 0xB read and write allowed
0xC to 0xF read only
0xC External integer in A
0xD External integer in B
0xE Read current RAM integer
0xF Read random number
Operand B:
Bit field used
0x200F0000
0x0 to 0xB read and write allowed
0xC to 0xF read only
0xC External integer in A
0xD External integer in B
0xE Read current Cache L1 integer
0xF Read random number
-
Bitwise NOT operands
(Before processing)
Bit field used
0x2000C000
Operand A 0x20008000
0x0 Nothing
0x8 Bitwise NOT A
Operand B 0x20004000
0x0 Nothing
0x4 Bitwise NOT B
-
Address register to be readed
Bit field used:
0x20003000
0x0 Read data from general purpose counter.
0x1 Read icremented data from
general purpose counter without
increment the current value. (+I)
0x2 Read current value incremented
of the Program Counter.
MISC Function: Determinate the start of
a loop easy in 1 frame without
knowing the program address map.
0x3 Read operand A like Address
General Function: Pointing memory's,
periferics.
-
Address or data to...
Set whether the result of ALU
(data out) or an address from the main
address bus will be stored in the selected
memory to write the result.
(select whether to write data
or addresses to the selected recipient)
Bit field used:
0x20000800
0x0 Data
0x8 Address
-
Result receiver: (recipient)
The memory or register where the result
of the ALU or comparer (OUT) is to be written.
EXCEPTION:
Only the comparer can send values to the FLAG
register.
Bit field used:
0x20000700
0x0 To Void
0x1 To Operand memory
0x2 To RAM
0x3 To External out
0x4 To Flags register
Reserved:
0x5 To Void
0x6 To Void
0x7 To Void
-
Selected operand register to write
If the selected register is the operand memory
this field sets the address of the operand
register where the result is to be written.
Bit field used:
0x200000F0
Good: 0x0 to 0xB read and write allowed
Bad: 0xC to 0xF read only.
If the selected register isn't the operand
memory, this is a void.
TIPS:
Some instructions may have colors closer to
the value 0 (0x20000000)
HLT example: 0x2F0000000, HLT
it is invisible, you can use this field
to visually differentiate from 0 without
affecting the program while operand writing
is not in use, like this: 0x2F00000F0
-
Bitwise NOT on the result:
(after processing)
Bit field used:
0x20000008
you can invert the out of the ALU
and out of the comparator (outputs).
0x0 Nothing
0x8 Inverter
If the instruction is a comparation,
the Bitwise NOT on the result
changes to a boolean inverter.
-
Increment general purpose counter:
Increment type (I+)
All types have this field in use
Bit field used:
0x20000004
0x0 Nothing
0x4 Increment (I+)
TIPS:
If you read the
counter increased and at the same time increasing it,
you will take a counter value +1.
And then the counter will be increased (+ i +)
If you read the value without increasing,
you obviously will get the current value
without modifying it. (i)
If you read the current value and increase,
you will get an increment type: (i +)
If you read the
augmented value, you get
an augmented current value, without modify
the current value. (+ i)
-
Fetch modes:
Bit field used:
0x20000003
External instructions
cannot influence this section.
0x0 Fetch instruction from RAM
0x1 Fetch Data from RAM
- 2 frames
frame 1: Instruction to be executed
on the Integer.
frame 2: Integer.
0x2 Jump to set address and write or read
instrucion or data as data and return
program Pointer.
To write:
Operand A is RAM address
Operand B any data to be writen
Result receiver is 0x2 (To RAM)
To read:
Operand A is RAM address
Operand B is 0xE RAM readed as data
Result receiver: any receiver
0x3 Ignore the instruction
__________________________________
Delving into the complex instructions
Sleep mode:
- If computer is in
sleep mode you can send "wake up" or OFF
signal to the computer from
external instruction in.
If sleep mode activated the instructions
on the RAM are invalidated and will
be read as data,
the counter will stop and
the external instruction bus (input) will
request attention.
You can execute instructions from external
instruction in.
To "wake up"
Bit field used with MSB:
0x30000000
Bit field used without MSB:
0x10000000
0x0 no wake up
0x1 wake up (1 frame)
if you wake it up the attention request is
withdrawn the external input bus is closed
the RAM instruction entry is opened and
the program counter is continuously
incremented again
If you not modify the Program Counter
it will wake up in the
position where the pointer was.
If you modify the Program Counter
It will wake up in the position you programmed.
-
ON/OFF:
- If computer is OFF the external
instruction bus can receive an ON signal
ON signal:
Bit field used with MSB:
0x30000000
Bit field used without MSB:
0x10000000
0x0 nothing
0x1 ON (1 frame)
- If computer is ON,
exist a halt instruction
Bit field used
0x2F000000
HLT 0xF
-
Conditional Jumps
Bit field used:
0x0F000000
Fields used:
Operand A, is an Address to jump.
Conditional direct Jump
If Flag register is true
Jump to an specified address
Execute the instruction
Program Counter is modified
Continue the execution.
12 DJP 0x0C Conditional Direct jump,
13 IJP 0x0D Conditional Indirect jump,
Conditional indirect Jump
If Flag register is true
Jump to an specified address
Execute the instruction and
return.
Program Counter isn't modified.
29 DJP 0x1C Inconditional Direct jump,
30 IJP 0x1D Inconditional Indirect jump,
__________________________________
TIPS:
To tell the computer that the external input
has data when it asks for it you can send a
Overflow to input A and
the integer to input B.
This computer can compare
whether A > B or A < B in 1 frame.
The trick to compare A > B is:
1. subtract A - B (A + bitwise NOT B).
2. Compare the carry output of the
adder if there is carry.
3. invert the output of ALU and Comparator.
4. move comparison result to flag register.
Operand A and B are the comparated numbers.
Instruction word in assembler:
0x2A004400
The trick to compare A < B is:
1. subtract A - B (A + bitwise NOT B).
2. Compare the carry output of
the adder if there is carry.
4. move comparison result to flag register.
Operand A and B are the comparated numbers.
Instruction word in assembler:
0x2A004408
Supports unsigned numbers and signed numbers.
----------------------------------------------
Output:
You could send the address and data
at the same time
to external output (mapped output)
Result receiver:
0x20000300 To External out
TIPS:
With Data send an integer, with address
set a periferic.
-
Set the start of the loop easily
SAVE CURRENT PROGRAM COUNTER STATE
+1 TO SELECTED REGISTER.
- 1 frame
- you will no longer have to define
a static integer indicating the start,
before, this was necessary.
you can set the start of a cycle or program
without defining its location with static
values manually. (automatic)
So that it is understood I have this example,
first write the value
of the program counter +1
For any record that you want to be
the one indicated containing
the start of the cycle. Keep in mind
that the output of program counter +1 is
considered an address,
so we must establish the
bit "data or address to receiver" to 1.
Therefore: 0x200029B0
(in this case, you receive
by the register of operand B)
Once this is done, you can write your program.
To break the loop,
do a conditional comparison
or unconditional, and take a leap
like this: 0x2CB000F0, remember that the
the beginning of the loop is in the direction
B, C is the direct jump instruction
and F is to differentiate from 0,
if the situation is true in the loop
is repeated; otherwise the program
will continue, interrupting the cycle.
If you need an example,
visit my save, fibonacci sequence
save id:2769099
and then cut - paste the program
in another sector of RAM, and run it.
TIPS:
You can define what you want,
for example: memory cell RAM where
the data will be read or saved,
without having to define its location
with static values.
if you have questions ask me
Here a demos:
Examples
1. Fibonacci sequence
(OF: OFFSET)
Clean version:
OF INSTRUCTION
00 0x200E0101
01 0x20000001
02 0x200A0110
03 0x20002920
04 0x21010100
05 0x20000300
06 0x21010110
07 0x20010300
08 0x29000408
09 0x2C2000F0
0A 0x2F0000F0
----------------------------------------------
Explain the instruction words:
OF INSTRUCTION
00 0x200E0101 SAVE INTEGER TO REG A (REG 0)
01 0x20000001 INTEGER
02 0x200A0110 CLEAN REG B (REG 1)
03 0x20002920 SAVE CURRENT PROGRAM COUNTER STATE TO BEGIN OF THE PROGRAM (REG 2)
(Set the start of the loop easily)
04 0x21010100 ADD A + B TO A
05 0x20000300 A TO THE OUTPUT
06 0x21010110 ADD A + B TO B
07 0x20010300 B TO THE OUTPUT
08 0x29000408 INVERTED A OVERFLOW COMPARATION
IF NOT CARRY SAVE BOOLEAN (TRUE)
IF CARRY SAVE BOOLEAN (FALSE)
TO FLAG REGISTER
09 0x2C2000F0
IF TRUE, JUMP TO BEGIN OF THE PROGRAM (REG 2)
IF FALSE, CONTINUE
0A 0x2F0000F0 OFF COMPUTER
----------------------------------------------
2. Print HELLO WORD!! to the new screen
OF INSTRUCTION
00 0x200E01B1 SET THE CONSTANT FOR INCREMENT, REG B (register 1)
01 0x20000001 CONSTANT
02 0x200E0101 SET THE START OF THE FILE TO READ AND SAVE, REG 0 (ADDRESS FILE)
03 0x200001C0 FILE START ADDRESS
04 0x200E0111 SET N CHARACTERS TO PRINT, REG 1 (N NUMBER)
05 0x2000000E N NUMBER
06 0x21010120 ADD FILE START + N NUMBER TO DEFINE FILE END, REG 2 (FILE END)
07 0x20E00601 LOAD TO GENERAL PURPOSE COUNTER THE X, Y SCREEN POS
08 0x20100051 X, Y POS & MODES OF THE SCREEN
09 0x20002910 DEFINE LOOP START, REG 1 (LOOP START)
0A 0x200E0302 JUMP TO ADDRESS FILE, READ AND WRITE TO SCREEN
0B 0x210B0104 INCREMENT ADDRESS FILE AND X, Y SCREEN POS
0C 0x280204F8 COMPARE IF ADDRESS FILE == FILE END (IF NO, JUMP)
0D 0x2C1000F0 CONDITIONAL JUMP TO LOOP START
0E 0x2E0000F0 SLEEP
0F 0x20E00601 LOAD TO GENERAL PURPOSE COUNTER THE SCREEN MODE
10 0x20110000 X, Y POS & MODES OF THE SCREEN
11 0x2F000300 CLEAN THE SCREEN AND OFF THE COMPUTER
I am kinda understanding this, but have some questions.
1. How does the number 0x20000000 convert into the CTYPE? Solved
2. Where is the register (the storage pixel's X and Y)?
3. How can I output a value to a display? or get input from a keyboard (for example, the RT2)?
4. How can I use a static value (such as using 4+3)? Should I store it to a register? How?
5. What is the initial value of registers?
Pls answer ASAP!
1. 0x20000000 0x230F3023 This UPPER 2 is so to avoid BRAY annihilation.
2. I already highlighted the operand memory (in the save).
3. For imput:
If a specific address is needed, for example, you can send the peripheral address and its mode (reading or writing in this case is reading) through the External output.
and then evaluate if there is input, and if there is, save in x memory.
For Output:
Output is the result of the selected instruction word, We can send data and addresses in the same frame and, if necessary, you can use the request Atention out bus.
4. Fetch mode (FETCH DATA FROM RAM) It exists to deal with static values (29-bit integers), in RAM, for example, it works like this, when specifying this search mode we need two variables to specify: The first is the instruction to be executed on the static number, and the second is the static number, at the point where it is reading the static number it will complete the instruction that was specified in the previous memory cell. With this instruction mode you can deal with values stored in RAM, Due to the current limitations in RAM we cannot handle two static integers in one frame, you will have to move one of them to the registers. :(
5. Initial value of register = 0
If you need to reset completely before shutting down the programs to fill the registers with 0x20000000
The integers can be saved in any way, but to have more order I recommend you save them with the upper bit (0x20000007), I have added OR gates that integrate the upper bit to avoid the annihilation of BRAY, when there is an unexpected annihilation of BRAY some components could break, and break other things.
Is the integer 7 saved as 0x00000007 or 0x20000007?
Under the tools tab, select the property tool. Then when you see the interface, select ctype from the list of options and in the bottom box type the hex value. Then use the property tool on the filter you want to add the data to. At least that's how I do it on my kindle fire tablet.