void tgl_do_send_encr_msg (struct tgl_state *TLS, struct tgl_message *M, void (*callback)(struct tgl_state *TLS, void *callback_extra, int success, struct tgl_message *M), void *callback_extra) { if (M->flags & TGLMF_SERVICE) { tgl_do_send_encr_msg_action (TLS, M, callback, callback_extra); return; } tgl_peer_t *P = tgl_peer_get (TLS, M->to_id); if (!P || P->encr_chat.state != sc_ok) { vlogprintf (E_WARNING, "Unknown encrypted chat\n"); if (callback) { callback (TLS, callback_extra, 0, M); } return; } assert (M->flags & TGLMF_ENCRYPTED); clear_packet (); out_int (CODE_messages_send_encrypted); out_int (CODE_input_encrypted_chat); out_int (tgl_get_peer_id (M->to_id)); out_long (P->encr_chat.access_hash); out_long (M->id); encr_start (); out_int (CODE_decrypted_message_layer); out_random (15 + 4 * (lrand48 () % 3)); out_int (TGL_ENCRYPTED_LAYER); out_int (2 * P->encr_chat.in_seq_no + (P->encr_chat.admin_id != TLS->our_id)); out_int (2 * P->encr_chat.out_seq_no + (P->encr_chat.admin_id == TLS->our_id) - 2); out_int (CODE_decrypted_message); out_long (M->id); out_int (P->encr_chat.ttl); out_cstring ((void *)M->message, M->message_len); switch (M->media.type) { case tgl_message_media_none: out_int (CODE_decrypted_message_media_empty); break; case tgl_message_media_geo: out_int (CODE_decrypted_message_media_geo_point); out_double (M->media.geo.latitude); out_double (M->media.geo.longitude); break; default: assert (0); } encr_finish (&P->encr_chat); tglq_send_query (TLS, TLS->DC_working, packet_ptr - packet_buffer, packet_buffer, &msg_send_encr_methods, M, callback, callback_extra); }
PRIVATE u16 pci_read_word(u32 bus, u32 slot, u32 func, u16 offset) { u32 address = (u32)((bus << 16) | (slot << 11) | (func << 8) | (offset & 0xFC) | ((u32)0x80000000)); out_long(PCI_CTRL, address); return (u16)((in_long(PCI_DATA) >> ((offset & 2) * 8)) & 0xFFFF); }
PRIVATE int pci_bus_probe() { unsigned long init = 0x80000000; out_long(PCI_CTRL, init); init = in_long(PCI_DATA); if(init == 0xFFFFFFFF) return 0; return 1; }
void tgl_do_messages_mark_read_encr (struct tgl_state *TLS, tgl_peer_id_t id, long long access_hash, int last_time, void (*callback)(struct tgl_state *TLS, void *callback_extra, int), void *callback_extra) { clear_packet (); out_int (CODE_messages_read_encrypted_history); out_int (CODE_input_encrypted_chat); out_int (tgl_get_peer_id (id)); out_long (access_hash); out_int (last_time); tglq_send_query (TLS, TLS->DC_working, packet_ptr - packet_buffer, packet_buffer, &mark_read_encr_methods, tgl_peer_get (TLS, id), callback, callback_extra); }
void disk_do_write(void *buf, uint32_t sector) { int i; ide_prepare(sector); issue_write(); for (i = 0; i < 512 / sizeof(uint32_t); i ++) { out_long(IDE_PORT_BASE, *(((uint32_t*)buf) + i)); } }
static void do_write(void *buf) { int i; static struct Message m; out_byte(IDE_PORT_BASE + 7, 0x30); for (i = 0; i < 512 / sizeof(uint_32); i ++) { out_long(IDE_PORT_BASE, *(((uint_32*)buf) + i)); } do { receive(MSG_HARD_INTR, &m); } while (m.type != IDE_READY); }
//write disk void writesect(void *src, int offset) { int i; waitdisk(); out_byte(0x1F2, 1); out_byte(0x1F3, offset); out_byte(0x1F4, offset >> 8); out_byte(0x1F5, offset >> 16); out_byte(0x1F6, (offset >> 24) | 0xE0); out_byte(0x1F7, 0x20); waitdisk(); for (i = 0; i < SECTSIZE / 4; i ++) { //((int *)dst)[i] = in_long(0x1F0); out_long(0x1F0,((unsigned int*)src)[i]); } }
//---------------------------------------------------------------------- static void out_sizer(op_t &x) { static char show_sizer = -1; if ( show_sizer == -1 ) show_sizer = getenv("H8_NOSIZER") == NULL; if ( !show_sizer ) return; if ( (cmd.auxpref & (aux_disp8|aux_disp16|aux_disp24)) == 0 ) return; out_symbol(':'); // 1D 00 11 07 00 01 mov:g.w #1:16, @0x11:16 // 1D 00 11 06 01 mov:g.w #1:16, @0x11:16 // 0D 11 07 00 01 mov:g.w #1:8, @0x11:8 // 0D 11 06 01 mov:g.w #1:8, @0x11:8 // 0D 11 07 00 01 mov:g.w #1:8, @0x11:8 // 1D 00 11 07 00 01 mov:g.w #1:16, @0x11:16 // 15 00 11 06 01 mov:g.b #1:16, @0x11:16 // 05 11 06 01 mov:g.b #1:8, @0x11:8 int s = calc_sizer(x); out_long(s, 10); }
PRIVATE void pci_scan_devices(int bus_nr) { unsigned long conf_reg = 0x80000000; unsigned long tmp = 0L; printl("Scaning PCI device.\n"); tmp = bus_nr; tmp &= 0x000000FF; conf_reg += (tmp << 16); int i = 0; for(i = 0; i < 0x100; i++) { conf_reg &= 0xFFFF0000; conf_reg += (i << 8); out_long(PCI_CTRL, conf_reg); tmp = in_long(PCI_DATA); if(0xFFFFFFFF == tmp) continue; printl("A PCI device found.\n"); } return; }
void tgl_do_send_create_encr_chat (struct tgl_state *TLS, void *x, unsigned char *random, void (*callback)(struct tgl_state *TLS, void *callback_extra, int success, struct tgl_secret_chat *E), void *callback_extra) { int user_id = (long)x; int i; unsigned char random_here[256]; tglt_secure_random (random_here, 256); for (i = 0; i < 256; i++) { random[i] ^= random_here[i]; } BIGNUM *a = BN_bin2bn (random, 256, 0); ensure_ptr (a); BIGNUM *p = BN_bin2bn (TLS->encr_prime, 256, 0); ensure_ptr (p); BIGNUM *g = BN_new (); ensure_ptr (g); ensure (BN_set_word (g, TLS->encr_root)); BIGNUM *r = BN_new (); ensure_ptr (r); ensure (BN_mod_exp (r, g, a, p, TLS->BN_ctx)); BN_clear_free (a); static char g_a[256]; memset (g_a, 0, 256); BN_bn2bin (r, (void *)(g_a + (256 - BN_num_bytes (r)))); int t = lrand48 (); while (tgl_peer_get (TLS, TGL_MK_ENCR_CHAT (t))) { t = lrand48 (); } //bl_do_encr_chat_init (TLS, t, user_id, (void *)random, (void *)g_a); int state = sc_waiting; bl_do_encr_chat_new (TLS, t, NULL, NULL, &TLS->our_id, &user_id, random, NULL, NULL, &state, NULL, NULL, NULL, NULL, NULL, NULL, TGLPF_CREATE | TGLPF_CREATED); tgl_peer_t *_E = tgl_peer_get (TLS, TGL_MK_ENCR_CHAT (t)); assert (_E); struct tgl_secret_chat *E = &_E->encr_chat; clear_packet (); out_int (CODE_messages_request_encryption); tgl_peer_t *U = tgl_peer_get (TLS, TGL_MK_USER (E->user_id)); assert (U); if (U && U->user.access_hash) { out_int (CODE_input_user_foreign); out_int (E->user_id); out_long (U->user.access_hash); } else { out_int (CODE_input_user_contact); out_int (E->user_id); } out_int (tgl_get_peer_id (E->id)); out_cstring (g_a, 256); //write_secret_chat_file (); BN_clear_free (g); BN_clear_free (p); BN_clear_free (r); tglq_send_query (TLS, TLS->DC_working, packet_ptr - packet_buffer, packet_buffer, &send_encr_request_methods, E, callback, callback_extra); }
void tgl_do_send_accept_encr_chat (struct tgl_state *TLS, struct tgl_secret_chat *E, unsigned char *random, void (*callback)(struct tgl_state *TLS,void *callback_extra, int success, struct tgl_secret_chat *E), void *callback_extra) { int i; int ok = 0; for (i = 0; i < 64; i++) { if (E->key[i]) { ok = 1; break; } } if (ok) { if (callback) { callback (TLS, callback_extra, 1, E); } return; } // Already generated key for this chat assert (E->g_key); assert (TLS->BN_ctx); unsigned char random_here[256]; tglt_secure_random (random_here, 256); for (i = 0; i < 256; i++) { random[i] ^= random_here[i]; } BIGNUM *b = BN_bin2bn (random, 256, 0); ensure_ptr (b); BIGNUM *g_a = BN_bin2bn (E->g_key, 256, 0); ensure_ptr (g_a); assert (tglmp_check_g_a (TLS, TLS->encr_prime_bn, g_a) >= 0); //if (!ctx) { // ctx = BN_CTX_new (); // ensure_ptr (ctx); //} BIGNUM *p = TLS->encr_prime_bn; BIGNUM *r = BN_new (); ensure_ptr (r); ensure (BN_mod_exp (r, g_a, b, p, TLS->BN_ctx)); static unsigned char kk[256]; memset (kk, 0, sizeof (kk)); BN_bn2bin (r, kk + (256 - BN_num_bytes (r))); static unsigned char sha_buffer[20]; sha1 (kk, 256, sha_buffer); long long fingerprint = *(long long *)(sha_buffer + 12); //bl_do_encr_chat_set_key (TLS, E, kk, *(long long *)(sha_buffer + 12)); //bl_do_encr_chat_set_sha (TLS, E, sha_buffer); int state = sc_ok; bl_do_encr_chat_new (TLS, tgl_get_peer_id (E->id), NULL, NULL, NULL, NULL, kk, NULL, sha_buffer, &state, NULL, NULL, NULL, NULL, NULL, &fingerprint, TGL_FLAGS_UNCHANGED ); clear_packet (); out_int (CODE_messages_accept_encryption); out_int (CODE_input_encrypted_chat); out_int (tgl_get_peer_id (E->id)); out_long (E->access_hash); ensure (BN_set_word (g_a, TLS->encr_root)); ensure (BN_mod_exp (r, g_a, b, p, TLS->BN_ctx)); static unsigned char buf[256]; memset (buf, 0, sizeof (buf)); BN_bn2bin (r, buf + (256 - BN_num_bytes (r))); out_cstring ((void *)buf, 256); out_long (E->key_fingerprint); BN_clear_free (b); BN_clear_free (g_a); BN_clear_free (r); tglq_send_query (TLS, TLS->DC_working, packet_ptr - packet_buffer, packet_buffer, &send_encr_accept_methods, E, callback, callback_extra); }
static void send_file_encrypted_end (struct tgl_state *TLS, struct send_file *f, void *callback, void *callback_extra) { out_int (CODE_messages_send_encrypted_file); out_int (CODE_input_encrypted_chat); out_int (tgl_get_peer_id (f->to_id)); tgl_peer_t *P = tgl_peer_get (TLS, f->to_id); assert (P); out_long (P->encr_chat.access_hash); long long r; tglt_secure_random (&r, 8); out_long (r); encr_start (); out_int (CODE_decrypted_message_layer); out_random (15 + 4 * (lrand48 () % 3)); out_int (TGL_ENCRYPTED_LAYER); out_int (2 * P->encr_chat.in_seq_no + (P->encr_chat.admin_id != TLS->our_id)); out_int (2 * P->encr_chat.out_seq_no + (P->encr_chat.admin_id == TLS->our_id)); out_int (CODE_decrypted_message); out_long (r); out_int (P->encr_chat.ttl); out_string (""); int *save_ptr = packet_ptr; if (f->flags == -1) { out_int (CODE_decrypted_message_media_photo); } else if ((f->flags & TGLDF_VIDEO)) { out_int (CODE_decrypted_message_media_video); } else if ((f->flags & TGLDF_AUDIO)) { out_int (CODE_decrypted_message_media_audio); } else { out_int (CODE_decrypted_message_media_document); } if (f->flags == -1 || !(f->flags & TGLDF_AUDIO)) { out_cstring ("", 0); out_int (90); out_int (90); } if (f->flags == -1) { out_int (f->w); out_int (f->h); } else if (f->flags & TGLDF_VIDEO) { out_int (f->duration); out_string (tg_mime_by_filename (f->file_name)); out_int (f->w); out_int (f->h); } else if (f->flags & TGLDF_AUDIO) { out_int (f->duration); out_string (tg_mime_by_filename (f->file_name)); } else { out_string (""); out_string (tg_mime_by_filename (f->file_name)); // document } out_int (f->size); out_cstring ((void *)f->key, 32); out_cstring ((void *)f->init_iv, 32); int *save_in_ptr = in_ptr; int *save_in_end = in_end; in_ptr = save_ptr; in_end = packet_ptr; assert (skip_type_any (TYPE_TO_PARAM(decrypted_message_media)) >= 0); assert (in_ptr == in_end); in_ptr = save_ptr; in_end = packet_ptr; struct tl_ds_decrypted_message_media *DS_DMM = fetch_ds_type_decrypted_message_media (TYPE_TO_PARAM (decrypted_message_media)); in_end = save_in_ptr; in_ptr = save_in_end; int peer_type = tgl_get_peer_type (f->to_id); int peer_id = tgl_get_peer_id (f->to_id); int date = time (NULL); encr_finish (&P->encr_chat); if (f->size < (16 << 20)) { out_int (CODE_input_encrypted_file_uploaded); } else { out_int (CODE_input_encrypted_file_big_uploaded); } out_long (f->id); out_int (f->part_num); if (f->size < (16 << 20)) { out_string (""); } unsigned char md5[16]; unsigned char str[64]; memcpy (str, f->key, 32); memcpy (str + 32, f->init_iv, 32); MD5 (str, 64, md5); out_int ((*(int *)md5) ^ (*(int *)(md5 + 4))); tfree_secure (f->iv, 32); bl_do_create_message_encr_new (TLS, r, &TLS->our_id, &peer_type, &peer_id, &date, NULL, 0, DS_DMM, NULL, NULL, TGLMF_OUT | TGLMF_UNREAD | TGLMF_ENCRYPTED | TGLMF_CREATE | TGLMF_CREATED); free_ds_type_decrypted_message_media (DS_DMM, TYPE_TO_PARAM (decrypted_message_media)); struct tgl_message *M = tgl_message_get (TLS, r); assert (M); tglq_send_query (TLS, TLS->DC_working, packet_ptr - packet_buffer, packet_buffer, &send_encr_file_methods, M, callback, callback_extra); tfree_str (f->file_name); tfree (f, sizeof (*f)); }
void tgl_do_send_encr_msg_action (struct tgl_state *TLS, struct tgl_message *M, void (*callback)(struct tgl_state *TLS, void *callback_extra, int success, struct tgl_message *M), void *callback_extra) { tgl_peer_t *P = tgl_peer_get (TLS, M->to_id); if (!P || P->encr_chat.state != sc_ok) { vlogprintf (E_WARNING, "Unknown encrypted chat\n"); if (callback) { callback (TLS, callback_extra, 0, 0); } return; } assert (M->flags & TGLMF_ENCRYPTED); clear_packet (); out_int (CODE_messages_send_encrypted_service); out_int (CODE_input_encrypted_chat); out_int (tgl_get_peer_id (M->to_id)); out_long (P->encr_chat.access_hash); out_long (M->id); encr_start (); out_int (CODE_decrypted_message_layer); out_random (15 + 4 * (lrand48 () % 3)); out_int (TGL_ENCRYPTED_LAYER); out_int (2 * P->encr_chat.in_seq_no + (P->encr_chat.admin_id != TLS->our_id)); out_int (2 * P->encr_chat.out_seq_no + (P->encr_chat.admin_id == TLS->our_id) - 2); out_int (CODE_decrypted_message_service); out_long (M->id); switch (M->action.type) { case tgl_message_action_notify_layer: out_int (CODE_decrypted_message_action_notify_layer); out_int (M->action.layer); break; case tgl_message_action_set_message_ttl: out_int (CODE_decrypted_message_action_set_message_t_t_l); out_int (M->action.ttl); break; case tgl_message_action_request_key: out_int (CODE_decrypted_message_action_request_key); out_long (M->action.exchange_id); out_cstring ((void *)M->action.g_a, 256); break; case tgl_message_action_accept_key: out_int (CODE_decrypted_message_action_accept_key); out_long (M->action.exchange_id); out_cstring ((void *)M->action.g_a, 256); out_long (M->action.key_fingerprint); break; case tgl_message_action_commit_key: out_int (CODE_decrypted_message_action_commit_key); out_long (M->action.exchange_id); out_long (M->action.key_fingerprint); break; case tgl_message_action_abort_key: out_int (CODE_decrypted_message_action_abort_key); out_long (M->action.exchange_id); break; case tgl_message_action_noop: out_int (CODE_decrypted_message_action_noop); break; default: assert (0); } encr_finish (&P->encr_chat); tglq_send_query (TLS, TLS->DC_working, packet_ptr - packet_buffer, packet_buffer, &msg_send_encr_methods, M, callback, callback_extra); }
static void out_cond(op_t &x) { char *reg = ph.regNames[x.reg]; switch(x.value) { case 0x00: out_register(reg); out_line(" == #", COLOR_SYMBOL); out_long(0, 10); break; case 0x10: out_register(reg); out_line(" != #", COLOR_SYMBOL); out_long(0, 10); break; case 0x20: out_register(reg); out_line(" < #", COLOR_SYMBOL); out_long(0, 10); break; case 0x30: out_register(reg); out_line(" <= #", COLOR_SYMBOL); out_long(0, 10); break; case 0x40: out_register(reg); out_line(" > #", COLOR_SYMBOL); out_long(0, 10); break; case 0x50: out_register(reg); out_line(" >= #", COLOR_SYMBOL); out_long(0, 10); break; case 0x60: out_line("overflow(", COLOR_SYMBOL); out_register(reg); out_symbol(')'); break; case 0x64: out_register(ph.regNames[TC1]); break; case 0x65: out_register(ph.regNames[TC2]); break; case 0x66: out_register(ph.regNames[CARRY]); break; case 0x68: out_register(ph.regNames[TC1]); out_line(" & ", COLOR_SYMBOL); out_register(ph.regNames[TC2]); break; case 0x69: out_register(ph.regNames[TC1]); out_line(" & !", COLOR_SYMBOL); out_register(ph.regNames[TC2]); break; case 0x6A: out_symbol('!'); out_register(ph.regNames[TC1]); out_line(" & ", COLOR_SYMBOL); out_register(ph.regNames[TC2]); break; case 0x6B: out_symbol('!'); out_register(ph.regNames[TC1]); out_line(" & !", COLOR_SYMBOL); out_register(ph.regNames[TC2]); break; case 0x70: out_line("!overflow(", COLOR_SYMBOL); out_register(reg); out_symbol(')'); break; case 0x74: out_symbol('!'); out_register(ph.regNames[TC1]); break; case 0x75: out_symbol('!'); out_register(ph.regNames[TC2]); break; case 0x76: out_symbol('!'); out_register(ph.regNames[CARRY]); break; case 0x78: out_register(ph.regNames[TC1]); out_line(" | ", COLOR_SYMBOL); out_register(ph.regNames[TC2]); break; case 0x79: out_register(ph.regNames[TC1]); out_line(" | !", COLOR_SYMBOL); out_register(ph.regNames[TC2]); break; case 0x7A: out_symbol('!'); out_register(ph.regNames[TC1]); out_line(" | ", COLOR_SYMBOL); out_register(ph.regNames[TC2]); break; case 0x7B: out_symbol('!'); out_register(ph.regNames[TC1]); out_line(" | !", COLOR_SYMBOL); out_register(ph.regNames[TC2]); break; case 0x7C: out_register(ph.regNames[TC1]); out_line(" ^ ", COLOR_SYMBOL); out_register(ph.regNames[TC2]); break; case 0x7D: out_register(ph.regNames[TC1]); out_line(" ^ !", COLOR_SYMBOL); out_register(ph.regNames[TC2]); break; case 0x7E: out_symbol('!'); out_register(ph.regNames[TC1]); out_line(" ^ ", COLOR_SYMBOL); out_register(ph.regNames[TC2]); break; case 0x7F: out_symbol('!'); out_register(ph.regNames[TC1]); out_line(" ^ !", COLOR_SYMBOL); out_register(ph.regNames[TC2]); break; default: error("interr: out: o_cond"); } }
//---------------------------------------------------------------------- bool outop(op_t &x) { ea_t segadr; switch (x.type) { case o_void: return 0; case o_reg: OutReg(x.reg); break; case o_fpreg: OutReg(x.reg + 8); break; case o_imm: // 27 if(x.ill_imm) { out_symbol('('); OutReg(rPC); out_symbol(')'); out_symbol('+'); } else { out_symbol('#'); if(x.dtyp == dt_float || x.dtyp == dt_double) { char str[MAXSTR]; if(out_real(&x.value, 2, str, sizeof(str))) { register char *p = str; while(*p == ' ') p++; out_symbol('^'); out_symbol('F'); out_line(p, COLOR_NUMBER); } else out_long(x.value, 8); } else OutValue(x, OOF_SIGNED | OOFW_IMM); } break; case o_mem: // 37/67/77 case o_near: // jcc/ [jmp/call 37/67] case o_far: if(x.phrase != 0) { if(x.phrase == 077 || x.phrase == 037) out_symbol('@'); if(x.phrase == 037) out_symbol('#'); if(x.addr16 < m.asect_top && !isOff(uFlag,x.n)) { OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_16); break; } } segadr = toEA(x.type == o_far ? x.segval : codeSeg(x.addr16,x.n), x.addr16); if(!out_name_expr(x, segadr, x.addr16)) { if(x.type == o_far || x.addr16 < 0160000) QueueMark(Q_noName, cmd.ea); OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_16); } break; case o_number: //EMT/TRAP/MARK/SPL OutValue(x, OOF_NUMBER | OOFS_NOSIGN | OOFW_8); break; case o_displ: // 6x/7x (!67/!77) if(x.phrase >= 070) out_symbol('@'); OutValue(x, OOF_ADDR | OOF_SIGNED | OOFW_16); out_symbol('('); goto endregout; case o_phrase: // 1x/2x/3x/4x/5x (!27/!37) switch(x.phrase >> 3) { case 1: out_symbol('@'); OutReg(x.phrase & 7); break; case 3: out_symbol('@'); case 2: out_symbol('('); OutReg(x.phrase & 7); out_symbol(')'); out_symbol('+'); break; case 5: out_symbol('@'); case 4: out_symbol('-'); out_symbol('('); endregout: OutReg(x.phrase & 7); out_symbol(')'); break; } break; default: warning("out: %" FMT_EA "o: bad optype %d", cmd.ip, x.type); break; } return 1; }
bool outop(op_t &x) { uval_t v; int dir, bit; char buf[MAXSTR]; switch ( x.type ) { case o_reg: OutReg(x.reg); break; case o_phrase: if ( x.phrase == fRi ) { out_symbol('@'); OutReg(x.indreg); break; } out_colored_register_line(phrases[x.phrase]); break; case o_displ: out_symbol('@'); OutReg(x.reg); out_symbol('+'); OutValue(x, OOF_ADDR | OOFS_IFSIGN | OOFW_16); break; case o_imm: out_symbol('#'); if ( cmd.auxpref & aux_0ext ) out_symbol('0'); if ( cmd.auxpref & aux_1ext ) out_symbol('1'); OutValue(x, OOFS_IFSIGN | OOFW_IMM); break; case o_mem: case o_near: v = map_addr(x.addr, x.n, x.type==o_mem); if ( get_name_expr(cmd.ea+x.offb, x.n, v, x.addr, buf, sizeof(buf)) <= 0 ) { /* int nbit; if ( cmd.itype == I51_ecall || cmd.itype == I51_ejmp ) nbit = OOFW_32; else nbit = OOFW_16;*/ OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_32); QueueMark(Q_noName, cmd.ea); break; } // we want to output SFR register names always in COLOR_REG, // so remove the color tags and output it manually: if ( x.type == o_mem && x.addr >= 0x80 ) { tag_remove(buf, buf, sizeof(buf)); out_register(buf); break; } OutLine(buf); break; case o_void: return false; case o_bit251: if ( x.b251_bitneg ) out_symbol('/'); dir = x.addr; bit = x.b251_bit; goto OUTBIT; case o_bitnot: out_symbol('/'); case o_bit: dir = (x.reg & 0xF8); bit = x.reg & 7; if ( (dir & 0x80) == 0 ) dir = dir/8 + 0x20; OUTBIT: if(ash.uflag & UAS_PBIT) { const ioport_bit_t *predef = find_bit( dir, bit); if ( predef != NULL ) { out_line(predef->name, COLOR_REG); break; } } { v = map_addr(dir, x.n, true); ssize_t len = get_name_expr(cmd.ea+x.offb, x.n, v, dir, buf, sizeof(buf)); if ( len > 0 && strchr(buf, '+') == NULL ) { // we want to output the bit names always in COLOR_REG, // so remove the color tags and output it manually: if ( dir < 0x80 ) { OutLine(buf); } else { tag_remove(buf, buf, sizeof(buf)); out_register(buf); } } else { out_long(dir, 16); } out_symbol(ash.uflag & UAS_NOBIT ? '_' : '.'); out_symbol('0'+bit); } break; default: warning("out: %a: bad optype",cmd.ea,x.type); break; } return true; }