+static void dismem(machine_6502 *machine, AddrMode adm, char *output){
+ Bit8 zp;
+ Bit16 n;
+ switch(adm){
+ case SINGLE:
+ output = "";
+ break;
+ case IMMEDIATE_LESS:
+ case IMMEDIATE_GREAT:
+ case IMMEDIATE_VALUE:
+ n = popByte(machine);
+ sprintf(output,"#$%x",n);
+ break;
+ case INDIRECT_X:
+ zp = popByte(machine);
+ n = memReadByte(machine,zp) +
+ (memReadByte(machine,zp+1)<<8);
+ sprintf(output,"($%x,x)",n);
+ break;
+ case INDIRECT_Y:
+ zp = popByte(machine);
+ n = memReadByte(machine,zp) +
+ (memReadByte(machine,zp+1)<<8);
+ sprintf(output,"($%x),y",n);
+ break;
+ case ABS_OR_BRANCH:
+ case ZERO:
+ n = popByte(machine);
+ sprintf(output,"$%x",n);
+ break;
+ case ZERO_X:
+ n = popByte(machine);
+ sprintf(output,"$%x,x",n);
+ break;
+ case ZERO_Y:
+ n = popByte(machine);
+ sprintf(output,"$%x,y",n);
+ break;
+ case ABS_VALUE:
+ n = popWord(machine);
+ sprintf(output,"$%x",n);
+ break;
+ case ABS_LABEL_X:
+ case ABS_X:
+ n = popWord(machine);
+ sprintf(output,"$%x,x",n);
+ break;
+ case ABS_LABEL_Y:
+ case ABS_Y:
+ n = popWord(machine);
+ sprintf(output,"$%x,x",n);
+ break;
+ case DCB_PARAM:
+ output = "";
+ break;
+ }
+}
+