|
@@ -213,9 +213,16 @@ fn assemble_internal(parsed: &[Instruction]) -> Result<Vec<Insn>, String> {
|
|
/// mov64 r2, 0x32
|
|
/// mov64 r2, 0x32
|
|
/// mov64 r1, r0
|
|
/// mov64 r1, r0
|
|
/// be16 r0
|
|
/// be16 r0
|
|
-/// neg64 r8
|
|
|
|
|
|
+/// neg64 r2
|
|
/// exit");
|
|
/// exit");
|
|
/// println!("{:?}", prog);
|
|
/// println!("{:?}", prog);
|
|
|
|
+/// # assert_eq!(prog,
|
|
|
|
+/// # Ok(vec![0x07, 0x01, 0x00, 0x00, 0x05, 0x06, 0x00, 0x00,
|
|
|
|
+/// # 0xb7, 0x02, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00,
|
|
|
|
+/// # 0xbf, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
+/// # 0xdc, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
|
|
|
+/// # 0x87, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
+/// # 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]));
|
|
/// ```
|
|
/// ```
|
|
///
|
|
///
|
|
/// This will produce the following output:
|
|
/// This will produce the following output:
|
|
@@ -223,9 +230,9 @@ fn assemble_internal(parsed: &[Instruction]) -> Result<Vec<Insn>, String> {
|
|
/// ```test
|
|
/// ```test
|
|
/// Ok([0x07, 0x01, 0x00, 0x00, 0x05, 0x06, 0x00, 0x00,
|
|
/// Ok([0x07, 0x01, 0x00, 0x00, 0x05, 0x06, 0x00, 0x00,
|
|
/// 0xb7, 0x02, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00,
|
|
/// 0xb7, 0x02, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00,
|
|
-/// 0xbf, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
-/// 0xdc, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
-/// 0x87, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
|
+/// 0xbf, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
+/// 0xdc, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
|
|
|
+/// 0x87, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
/// 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
|
|
/// 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
|
|
/// ```
|
|
/// ```
|
|
pub fn assemble(src: &str) -> Result<Vec<u8>, String> {
|
|
pub fn assemble(src: &str) -> Result<Vec<u8>, String> {
|