egg

Multi-architecture emulator.
Log | Files | Refs | README | LICENSE

test.asm (1043B)


      1 ; Instructions test for EGG Sagui.
      2 
      3 	; movl, prepare for jumps.
      4 	movl 5
      5 
      6 	; Copy addr.
      7 	movr r1, r0
      8 	; Zero r0 to test branching.
      9 	sub r0, r0
     10 
     11 	; The movr should not be performed.
     12 	brzr r0, r1
     13 	movr r0, r0
     14 
     15 	movl 8
     16 	jr r0
     17 	; Again, movr shouldn't be performed.
     18 	movr r0, r0
     19 
     20 	; Again, movr shouldn't be performed.
     21 	sub r0, r0
     22 	brzi brzi_test
     23 	movr r0, r0
     24 	; Now the branches shouldn't be performed.
     25 brzi_test:
     26 	movl 1
     27 	brzi 3
     28 	brzr r0, r0
     29 	; Lastly, test ji.
     30 	ji ji_test
     31 	movr r0, r0
     32 
     33 	; Arithmetic instructions.
     34 ji_test:
     35 	sub r0, r0
     36 	movl 0x1
     37 	movr r1, r0
     38 	sub r0, r0
     39 	movh 0xf
     40 
     41 	; r0 shall be 0xf1.
     42 	add r0, r1
     43 	; r0 shall be 0xf0.
     44 	sub r0, r1
     45 
     46 	; r0 shall be 0xf1.
     47 	or r0, r1
     48 	; r0 shall be 0x01.
     49 	and r0, r1
     50 
     51 	; r0 shall be 0x0.
     52 	not r0, r0
     53 	; And 0x1 again.
     54 	not r0, r0
     55 
     56 	movr r1, r0
     57 	; r0 shall be 0x2.
     58 	slr r0, r1
     59 	; Now 0x1 again.
     60 	srr r0, r1
     61 
     62 	; Use a convenient address and value to test load and store.
     63 	movl 0xa
     64 	movr r1, r0
     65 	movh 0xf
     66 	st r1, r0
     67 	; Zero r1 to be sure.
     68 	sub r1, r1
     69 	ld r1, r0
     70 
     71 	; Finally, the "break".
     72 	movr r0, r0