comparison emu/iset.c @ 42:792da050d8c4 tip

more dox
author james <jb302@eecs.qmul.ac.uk>
date Tue, 22 Apr 2014 14:25:14 +0100
parents 2e35be400012
children
comparison
equal deleted inserted replaced
41:a9bf262f557b 42:792da050d8c4
896 896
897 897
898 /* 0xF8 - MUL R0, R1 */ 898 /* 0xF8 - MUL R0, R1 */
899 void 899 void
900 MUL(void) { 900 MUL(void) {
901 /* implement me */ 901 tmpw = regs[R0] * regs[R1];
902 regs[R0] = GHIGH(tmpw);
903 regs[R1] = GLOW(tmpw);
902 } 904 }
903 905
904 /* 0xF9 - DIV R0, R1 */ 906 /* 0xF9 - DIV R0, R1 */
905 void 907 void
906 DIV(void) { 908 DIV(void) {
907 /* implement me */ 909 tmpw = regs[R0] / regs[R1];
910 regs[R0] = GHIGH(tmpw);
911 regs[R1] = GLOW(tmpw);
908 } 912 }
909 913
910 /* 0xFA - DA A */ 914 /* 0xFA - DA A */
911 void 915 void
912 DA(void) { 916 DA(void) {
913 /* implement me */ 917 if (((A & 0xF) > 9) | get_flag(AC) == 1) {
918 A = A + 6;
919 }
920 if (((A & 0xF0) > 9) | get_flag(C) == 1) {
921 A = A + 0x60;
922 }
914 } 923 }
915 924
916 /* 0xFC - IN port_addr */ 925 /* 0xFC - IN port_addr */
917 void 926 void
918 IN(void) { 927 IN(void) {
932 } 941 }
933 942
934 /* 0xFF - HLT */ 943 /* 0xFF - HLT */
935 void 944 void
936 HLT(void) { 945 HLT(void) {
937 /* implement me */ 946 exit(0);
938 } 947 }