if (options.filename != NULL) {
rc = hexfile_load(options.filename);
- if (rc == false)
+ if (!rc)
exit(1);
}
static int
cpu8051_interrupt_enabled(int interrupt_no)
{
- return (memory_read_direct(_IE_) & INTERRUPT_MASK(interrupt_no)) ? 1 : 0;
+ return (memory_read_direct(_IE_) & INTERRUPT_MASK(interrupt_no)) ?
+ 1 : 0;
}
static void
if (cpu8051_interrupt_enabled(INTERRUPT_1) &&
cpu8051_interrupt_fire(INTERRUPT_1, i) &&
(memory_read_direct(_TCON_) & 0x20)) {
- memory_write_direct(_TCON_,
- memory_read_direct(_TCON_) & 0xDF);
+ memory_write_direct(
+ _TCON_,
+ memory_read_direct(_TCON_) & 0xDF);
cpu8051_process_interrupt(0x0B, i);
return;
}
if (cpu8051_interrupt_enabled(INTERRUPT_3) &&
cpu8051_interrupt_fire(INTERRUPT_3, i) &&
(memory_read_direct(_TCON_) & 0x80)) {
- memory_write_direct(_TCON_,
- memory_read_direct(_TCON_) & 0x7F);
+ memory_write_direct(
+ _TCON_,
+ memory_read_direct(_TCON_) & 0x7F);
cpu8051_process_interrupt(0x1B, i);
return;
}
print INST_DEF "/* Exported variables. */\n";
print INST_DEF "#ifdef INSTRUCTIONS_8051_M\n";
print INST_DEF "OPCODE_FP opcode_table[256] = {\n";
-for( $i=0; $i<256; $i++ ) {
- $ifunc=substr($instfunction[$i], 9);
- if( $i < 255 ) {
- print INST_DEF " cpu8051_$ifunc,\n";
- }
- else {
- print INST_DEF " cpu8051_$ifunc\n";
- print INST_DEF "};\n";
- }
-}
+for ($i = 0; $i < 256; $i++) {
+ $ifunc = substr($instfunction[$i], 9);
+
+ print INST_DEF "\tcpu8051_$ifunc,\n";
+}
+print INST_DEF "};\n";
print INST_DEF "#else\n";
print INST_DEF "OPCODE_FP opcode_table[256];\n";
print INST_DEF "#endif\n\n\n";
tmp &= 0xFF;
if (tmp == 0) {
/* If overflow set TFx */
- memory_write_direct(_TCON_, memory_read_direct(_TCON_) | tf_mask);
+ memory_write_direct(_TCON_,
+ memory_read_direct(_TCON_) | tf_mask);
}
memory_write_direct(counter_address, tmp); /* Save new value. */
tmp &= 0xFF;
if (tmp == 0) {
/* If overflow -> reload and set TF0 */
- memory_write_direct(_TCON_, memory_read_direct(_TCON_) | tf_mask);
+ memory_write_direct(
+ _TCON_,
+ memory_read_direct(_TCON_) | tf_mask);
memory_write_direct(tl, memory_read_direct(th));
} else {
memory_write_direct(tl, tmp);
/* Timer 1 */
tr = memory_read_direct(_TCON_) & 0x40;
- mode = (memory_read_direct(_TMOD_) & 0x30) >> 4 ;
+ mode = (memory_read_direct(_TMOD_) & 0x30) >> 4;
gate = memory_read_direct(_TMOD_) & 0x80;
timer_counter = memory_read_direct(_TMOD_) & 0x40;