BETRIC Machine Language Reference

Here is the reference. It needs to be reformatted :-)

Reference

foo

All instructions are shown and entered into memory in hexadecimal format.
Thus, the one-byte instruction to move a value into the C register, '00000101' is shown as the hexadecimal number, '05'.

All instructions are categorized by function and sorted in numerical order.
The machine code instruction in hexadecimal is listed first, followed by the mnemonic 'assembly language' instruction.

Program Flow Instructions


00 - HALT
This instruction will stop all program flow and return control to the BETRIC ROM operating system.

Memory and Copy Instructions


01 - MVALMEM
Move value to memory. This instruction will move the next byte of memory to the RAM memory that is addressed in registers BH and BL. For example, if BH = 00 and BL = 20, the machine code '01FF' will copy the value 'FF' to the RAM memory at the hexadecimal address '20'.

02 - MVALA
Move value to the A register. This instruction will move the next byte of memory to register A. For example, '02FF' will move the value 'FF' to A.

03 - MVALBH
Move value to the BH register. This instruction will move the next byte of memory to register BH. For example, '03FF' will move the value 'FF' to BH.

04 - MVALBL
Move value to the BL register. This instruction will move the next byte of memory to register BL. For example, '04FF' will move the value 'FF' to BL.

05 - MVALC
Move value to the C register. This instruction will move the next byte of memory to register C. For example, '05FF' will move the value 'FF' to C.

06 - MVALD
Move value to the D register. This instruction will move the next byte of memory to register D. For example, '06FF' will move the value 'FF' to D.


0F - MTOMEM
Move from a register to RAM memory. This instruction will copy a value from a register to the address specified in registers BH and BL. The source register for the move operation is specified in the byte following the MTOMEM instruction. The following are valid sources:
00 - Register A
01 - Register BH
02 - Register BL
03 - Register C
04 - Register D
For example, if BH = 00, BL = 2F, and A = 3C, then the machine code '0F00' will copy the value '3C' from Register A to the RAM memory at address '002F'.

10 - MTOA
Move from a specified source to Register A. This instruction will copy a value to Register A from a register or memory address (specified in registers BH and BL). The source for the move operation is specified in the byte following the MTOA instruction. The following are valid sources:
00 - Register BH
01 - Register BL
02 - Register C
03 - Register D
04 - A memory address specified in BH and BL
For example, if Register C contains the value '3A', the machine code '1002' will copy the value '3A' from Register C to Register A.

11 - MTOBH
Move from a specified source to Register BH. This instruction will copy a value to Register BH from a register or memory address (specified in registers BH and BL). The source for the move operation is specified in the byte following the MTOBH instruction. The following are valid sources:
00 - Register A
01 - Register BL
02 - Register C
03 - Register D
04 - A memory address specified in BH and BL
For example, if Register C contains the value '3A', the machine code '1102' will copy the value '3A' from Register C to Register BH.

12 - MTOBL
Move from a specified source to Register BL. This instruction will copy a value to Register BL from a register or memory address (specified in registers BH and BL). The source for the move operation is specified in the byte following the MTOBL instruction. The following are valid sources:
00 - Register A
01 - Register BH
02 - Register C
03 - Register D
04 - A memory address specified in BH and BL
For example, if Register C contains the value 'F2', the machine code '1202' will copy the value 'F2' from Register C to Register BL.

13 - MTOC
Move from a specified source to Register C. This instruction will copy a value to Register C from a register or memory address (specified in registers BH and BL). The source for the move operation is specified in the byte following the MTOC instruction. The following are valid sources:
00 - Register A
01 - Register BH
02 - Register BL
03 - Register D
04 - A memory address specified in BH and BL
For example, if Register A contains the value '3A', the machine code '1300' will copy the value '3A' from Register A to Register C.

14 - MTOD
Move from a specified source to Register D. This instruction will copy a value to Register D from a register or memory address (specified in registers BH and BL). The source for the move operation is specified in the byte following the MTOD instruction. The following are valid sources:
00 - Register A
01 - Register BH
02 - Register BL
03 - Register C
04 - A memory address specified in BH and BL
For example, if Register C contains the value '3A', the machine code '1403' will copy the value '3A' from Register C to Register D.

Display Instructions


A0 - DCHR
Display ASCII character in Register A on the screen in the row and column specified in registers C and D. For example, given A=54, C=2, and D=3, the instruction 'A0' will cause the character 'T' (ASCII character 54h) to be displayed in column 2h on row 3h.

A1 - PRSTR
Display a null-terminated ASCII character string from memory. The memory location is specified in registers BH and BL. The starting screen row and column for the string specified in registers C and D.

A2 - DCLR
Changes the color of a row and column on the display screen. The color is set in Register A and the row and and column is specified in registers C and D. For example, given A=13, C=17, and D=4, the instruction 'A2' will cause the character on column 17h, row 4h to be changed to color 13h.