From d24fd2cea017f153021daf7fffc8d8e0721f3f4e Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 24 Aug 2014 21:34:58 +0200 Subject: Missing "-a" in previous git commit :D --- reverse-engineering/dosbox_snif/Makefile | 2 +- reverse-engineering/dosbox_snif/dos_lemm.h | 22 +- reverse-engineering/dosbox_snif/dos_lemm_sim.c | 341 ++++++++++++- reverse-engineering/dosbox_snif/dos_lemm_sim.h | 6 +- reverse-engineering/dosbox_snif/main_dump.c | 2 +- reverse-engineering/dosbox_snif/main_dump_delta.c | 14 +- reverse-engineering/dosbox_snif/main_dump_ds0.c | 2 +- reverse-engineering/dosbox_snif/main_poke.c | 2 +- .../dosbox_snif/main_validate_code.c | 136 +++-- reverse-engineering/dosbox_snif/rsp.c | 6 +- reverse-engineering/dosbox_snif/rsp_lemm.c | 2 +- reverse-engineering/dosbox_snif/utils.c | 6 + reverse-engineering/dosbox_snif/utils.h | 1 + reverse-engineering/work/seg_code_0208.txt | 551 +++++++++++---------- 14 files changed, 771 insertions(+), 322 deletions(-) diff --git a/reverse-engineering/dosbox_snif/Makefile b/reverse-engineering/dosbox_snif/Makefile index 3c38045..ac5c20f 100644 --- a/reverse-engineering/dosbox_snif/Makefile +++ b/reverse-engineering/dosbox_snif/Makefile @@ -28,6 +28,6 @@ int16todec: int16todec.o $(CC) -c $(CFLAGS) -o $@ $^ clean: - rm $(OBJS) main_*.o $(EXE) || true + rm $(OBJS) main_*.o dos_lemm_sim.o int16todec.o $(EXE) || true .PHONY: all clean diff --git a/reverse-engineering/dosbox_snif/dos_lemm.h b/reverse-engineering/dosbox_snif/dos_lemm.h index 5504fee..472b1f5 100644 --- a/reverse-engineering/dosbox_snif/dos_lemm.h +++ b/reverse-engineering/dosbox_snif/dos_lemm.h @@ -3,9 +3,15 @@ #include +#define TRUE 0xFF +#define FALSE 0x00 + +#define LEVEL_HEIGHT 160 +#define LEVEL_WIDTH 1664 + struct _state { uint8_t s_splatting:1; //0x01 - uint8_t s_exploding:1; //0x02 combinable + uint8_t s_exploding_spe:1; //0x02 combinable uint8_t s_falling:1; //0x04 uint8_t s_ascending:1; //0x08 uint8_t s_digging:1; //0x10 @@ -49,9 +55,9 @@ enum state_masks { }; struct _flags1 { - uint8_t fl1_cap_climber:1; // 0x01 - uint8_t fl1_unused:6; - uint8_t fl1_walk_pause_for_shruggling:1; // 0x80 + uint8_t cap_climber:1; // 0x01 + uint8_t unused:6; + uint8_t walk_pause_for_shruggling:1; // 0x80 } __attribute__ ((__packed__)); union flags1 { @@ -115,8 +121,10 @@ struct _avail_skills { struct game_data { /* ds == 0x0b55 */ - uint8_t unk0; // TODO - uint8_t unk1[0x27]; // TODO + uint16_t unk0; // TODO + uint16_t unk0b; // TODO cf 00002BB5 + uint16_t stencil_line_width; + uint8_t unk1[0x22]; // TODO uint8_t paused; // [0x28] uint8_t unk2[0x16]; // TODO uint8_t lemm_count_to_process; // [0x3f] @@ -133,7 +141,7 @@ struct game_data { uint8_t unk6[0x1d]; // TODO struct _avail_skills avail_skills; // [0x67] - [0x7e] uint8_t unk7[0x06]; // TODO - struct _lemm_data lemmings[1]; // [0x85] + struct _lemm_data lemmings[2]; // [0x85] //struct _lemm_data lemmings[100]; // [0x85] } __attribute__ ((__packed__)); diff --git a/reverse-engineering/dosbox_snif/dos_lemm_sim.c b/reverse-engineering/dosbox_snif/dos_lemm_sim.c index 97657d8..e4f7e49 100644 --- a/reverse-engineering/dosbox_snif/dos_lemm_sim.c +++ b/reverse-engineering/dosbox_snif/dos_lemm_sim.c @@ -1,11 +1,344 @@ #include "dos_lemm_sim.h" +#include "utils.h" /* imin() */ -int game_data_diff(struct game_data *g1, struct game_data *g2) { - return 1; +uint8_t is_solid(uint16_t x, uint16_t y); + +// Code segment 0x0208, offsets in comments +void move_lemmings(struct game_data *g) { + uint8_t *g_raw = (uint8_t *) g; + struct _lemm_data *lemm; + uint8_t *lemm_raw; + uint16_t y_test=0x55AA; //=21930 remarkable value if we hit a bug + int i; + + //182F + if ( g->paused ) { + g_raw[0x4d] = FALSE; + return; + } + //1839 + //TODO vga_set_read_mode1_compare_plan3_to_color_8(); + + //183C + g_raw[0x4d] = TRUE; + + //1841 + lemm=&(g->lemmings[0]); + lemm_raw = (uint8_t *) lemm; // Instrumentation + // Replaced (instrumentation) + //g->lemm_count_to_process = g->lemm_spawned_count; + g->lemm_count_to_process = imin(g->lemm_spawned_count, (sizeof(g->lemmings) / sizeof(struct _lemm_data))); + + //184A + while ( g->lemm_count_to_process != 0 ) { + //XXX push es + //1852 + if ( lemm->is_gone ) { + goto next_lemming; + } + //185B + if ( lemm->expl_countdown != 0 ) { + //TODO if ( commit_suicide() != FALSE ) goto next_lemming; + } + //186A + if ( lemm->flags1.bits.walk_pause_for_shruggling ) { + goto lbl_anim_but_no_move; + } + //1877 + if ( lemm->state.raw == 0x0 ) goto lbl_walking; + if ( lemm->state.bits.s_exploding_spe ) goto lbl_exploding_spe; + if ( lemm->state.bits.s_exploding ) goto lbl_exploding; + if ( lemm->state.bits.s_falling ) goto lbl_falling; + if ( lemm->state.bits.s_floating ) goto lbl_floating; + if ( lemm->state.bits.s_splatting ) goto lbl_splatting; + if ( lemm->state.bits.s_ascending ) goto lbl_ascending; + if ( lemm->state.bits.s_digging ) goto lbl_digging; + if ( lemm->state.bits.s_climbing ) goto lbl_climbing; + if ( lemm->state.bits.s_climb_ending ) goto lbl_climb_ending; + if ( lemm->state.bits.s_building ) goto lbl_building; + if ( lemm->state.bits.s_blocking ) goto lbl_blocking; + if ( lemm->state.bits.s_bashing ) goto lbl_bashing; + if ( lemm->state.bits.s_mining ) goto lbl_mining; + if ( lemm->state.bits.s_drawning ) goto lbl_drawning; + if ( lemm->state.bits.s_ending ) goto lbl_ending; + if ( lemm->state.bits.s_dying ) goto lbl_dying; + +check_this_and_go_next_lemming: //18FE + //TODO process_if_in_special_zone(); +next_lemming: //1901 + //XXX pop es + lemm++; + g->lemm_count_to_process--; + //1909 + if ( g->lemm_count_to_process != 0 ) continue; + //190E + if ( g->nuke_all_in_progress ) { + goto nuke_one_by_one; + } + } //1913 end while + + g_raw[0x4d] = FALSE; + //191A + return; // General case end point + +nuke_one_by_one: //191B + if ( g->nuke_i == g->lemm_spawned_count ) { + //1952 + g->nuke_all_in_progress = 0; + g_raw[0x4d] = FALSE; + return; + } + //1924 + lemm=&(g->lemmings[g->nuke_i]); + //1930 + if ( lemm->expl_countdown == 0 ) { + //1936 + if ( lemm->is_gone ) { + //193C + g->nuke_i++; + goto nuke_one_by_one; + } + //1942 + if ( ( lemm->state.raw & (s_exploding | s_splatting | s_exploding_spe) ) == 0 ) { + lemm->expl_countdown = 79; + } + } + //194D + g->nuke_i++; + return; + +lbl_walking: //195D + lemm->spr_frame = (lemm->spr_frame + 1) % 8; + lemm->x_effective += lemm->direction; + //196D + if ( lemm->x_effective<16 || lemm->x_effective>=LEVEL_WIDTH ) { + //1A5B + lemm->direction = - lemm->direction; + goto check_this_and_go_next_lemming; + } + //197E + //TODO vga_mem_read_prepare_registers(); + y_test = lemm->y_effective; + lemm->y_effective--;//XXX rustine + + if ( ! is_solid(lemm->x_effective, y_test) ) { + //19FF + for (i=0;i<3;i++) { + if ( ! is_solid(lemm->x_effective, y_test) ) { + goto walker_adjust_y_or_U_turn; + } + y_test--; + } + //1A26 + for (i=0;i<3;i++) { + if ( ! is_solid(lemm->x_effective, y_test) ) { + //1A82 + //walker_become_ascender + lemm->state.bits.s_ascending=1; + lemm->spr_frame = 8; + y_test = lemm->y_effective - 2; + goto walker_adjust_y_or_U_turn; + } + y_test--; + } + //1A55 + //XXX Seems opposite cond in disassembly + if ( lemm->flags1.bits.cap_climber ) { + //1A92 + //walker_become_climber + lemm_raw[0x28]=0; + lemm_raw[0xa]=0; + lemm_raw[0xb]=0; + lemm_raw[0xc]=0; + lemm_raw[0xd]=0; + lemm->state.bits.s_climbing = 1; + lemm_raw[0x10]=0x48; + lemm_raw[0x11]=0x00; + lemm_raw[0x12]=0x30; + lemm_raw[0x13]=0x00; + lemm->x_spr_offset=-8; + lemm->y_spr_offset=-12; + lemm_raw[0x14]=g_raw[0x2d]; + lemm_raw[0x15]=g_raw[0x2e]; + lemm->draw_trick1 = TRUE; + lemm->draw_hint = 8; + } else { + //1A5B + lemm->direction = - lemm->direction; + } + goto check_this_and_go_next_lemming; + } + //198B + for (i=0; i<3; i++) { + lemm->y_effective++; + if ( is_solid(lemm->x_effective, lemm->y_effective) ) { + goto walker_check_fall_out_of_screen; + } + } +//walker_become_faller: //19AF + lemm->y_effective++; + lemm->state.bits.s_falling=1; + lemm_raw[0xa]=0; + lemm->spr_data_ptr = 0xa42; + lemm_raw[0x10]=0x5a; + lemm_raw[0x11]=0x00; + lemm_raw[0x12]=0x3c; + lemm_raw[0x13]=0x00; + lemm->spr_frame = 0; + lemm->falldist = 3; + lemm->x_spr_offset = -8; + lemm->y_spr_offset = -10; + lemm->draw_hint = hint_falling; + //19DE + lemm->ptr2 = g_raw[0x2b]; + lemm->draw_trick1 = FALSE; + lemm->flags1.bits.walk_pause_for_shruggling = 0; +walker_check_fall_out_of_screen: //19EC + y_test = lemm->y_effective; + if ( y_test >= 180 /* LEVEL_HEIGHT + 20 */ ) { + lemm->is_gone=TRUE; + goto next_lemming; + } + //19F5 + goto check_this_and_go_next_lemming; + + +walker_adjust_y_or_U_turn: //1A61 + lemm->y_effective = y_test; + if ( y_test + lemm->y_spr_offset <= 10 ) { + //1A6F + lemm->y_effective = 9 - lemm->y_spr_offset; + lemm->direction = -lemm->direction; + lemm->state.bits.s_ascending=0; + } + //1A7F + goto check_this_and_go_next_lemming; + +lbl_falling: + //1AC9 + lemm->spr_frame = (lemm->spr_frame + 1) % 4; + if ( lemm->falldist >= 16 && lemm->cap_floater ) { + //1ADF + lemm->state.raw = s_floating; + lemm_raw[0xa]=0; + lemm_raw[0xc]=0x0b; + lemm_raw[0xd]=0xaa; + lemm_raw[0x10]=0x80; + lemm_raw[0x11]=0x00; + lemm_raw[0x12]=0x60; + lemm_raw[0x13]=0x00; + lemm->spr_frame = 0; + lemm->floattime_dble = 0; + lemm->y_spr_offset = -16; + lemm->draw_hint = hint_special1; + //1B0A + lemm->ptr2 = g_raw[0x37]; + lemm->draw_trick1 = TRUE; + lemm->flags1.bits.walk_pause_for_shruggling = 0; + goto check_this_and_go_next_lemming; + } + //1B1B + //TODO vga_mem_read_prepare_registers(); + //TODO + goto check_this_and_go_next_lemming; +lbl_splatting: + //TODO + goto next_lemming; +lbl_drawning: + //TODO + goto next_lemming; +lbl_ending: + //TODO + goto next_lemming; +lbl_dying: + //TODO + goto next_lemming; +lbl_exploding_spe: + //TODO + goto next_lemming; +lbl_ascending: + //TODO + goto walker_adjust_y_or_U_turn; +lbl_digging: + //TODO + goto check_this_and_go_next_lemming; +lbl_climbing: + //TODO + goto walker_adjust_y_or_U_turn; +lbl_climb_ending: + //TODO + goto next_lemming; +lbl_building: + //TODO + goto check_this_and_go_next_lemming; +lbl_blocking: + //TODO + goto next_lemming; +lbl_bashing: + //TODO + goto check_this_and_go_next_lemming; +lbl_floating: + //TODO + goto check_this_and_go_next_lemming; +lbl_mining: + //TODO + goto check_this_and_go_next_lemming; +lbl_exploding: + //TODO + goto next_lemming; +lbl_anim_but_no_move: + //TODO + goto check_this_and_go_next_lemming; + +} // 26F5 end move_lemmings() + + + + +uint8_t is_solid(uint16_t x, uint16_t y) { + //FIXME : memdump the video memory once at start + return TRUE; } -int move_lemmings(struct game_data *g) { +void spawn_lemming(struct game_data *g) { + // 0208:299A + //TODO ecrit à l'intuitive, cf disassembly + g->next_spawn_ticks = ( g->next_spawn_ticks - 1) % g->spawn_rate_ticks; + return; +} + +void draw_lemmings(struct game_data *g) { + // 0208:2F23 + //TODO très incomplet + ((uint8_t *) g)[0x4d] = FALSE; +} + +void fixups_before(struct game_data *g) { + ((uint8_t *) g)[0x4f]++; +} + +void fixups_after(struct game_data *g) { + ((uint8_t *) g)[0x53] += 0x10; + if ( ((uint8_t *) g)[0x53] == 0xD0 ) { + ((uint8_t *) g)[0x53] = 0; + } + //0F4F + if ( ! g->paused ) { + ((uint8_t *) g)[0x82]--; + if ( ((uint8_t *) g)[0x82] == 0 ) { + ((uint8_t *) g)[0x82] = ((uint8_t *) g)[0x83]; + } + } +} + +void main_loop_ingame(struct game_data *g) { + //TODO + fixups_before(g); + + move_lemmings(g); + draw_lemmings(g); + spawn_lemming(g); - return 0; + fixups_after(g); } diff --git a/reverse-engineering/dosbox_snif/dos_lemm_sim.h b/reverse-engineering/dosbox_snif/dos_lemm_sim.h index 0f68d8d..7007806 100644 --- a/reverse-engineering/dosbox_snif/dos_lemm_sim.h +++ b/reverse-engineering/dosbox_snif/dos_lemm_sim.h @@ -3,7 +3,9 @@ #include "dos_lemm.h" -int game_data_diff(struct game_data *g1, struct game_data *g2); -int move_lemmings(struct game_data *g); +void main_loop_ingame(struct game_data *g); +void spawn_lemming(struct game_data *g); +void move_lemmings(struct game_data *g); +void draw_lemmings(struct game_data *g); #endif /*_DOS_LEMM_SIM_H*/ diff --git a/reverse-engineering/dosbox_snif/main_dump.c b/reverse-engineering/dosbox_snif/main_dump.c index 68bd4c0..b4df22d 100644 --- a/reverse-engineering/dosbox_snif/main_dump.c +++ b/reverse-engineering/dosbox_snif/main_dump.c @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) { while (!end) { rsp_query(&rsp, "c"); // Continue if ( rsp.replied != 1 ) printf("Bug 03\n"); - rsp_recv_full(&rsp); + //rsp_recv_full(&rsp); if ( rsp_check_and_clear(&rsp, "S05") != 0 ) printf("Bug 04\n"); snprintf(command, 15, "m%s,0x2d", ds_si); diff --git a/reverse-engineering/dosbox_snif/main_dump_delta.c b/reverse-engineering/dosbox_snif/main_dump_delta.c index 87878f4..cde2640 100644 --- a/reverse-engineering/dosbox_snif/main_dump_delta.c +++ b/reverse-engineering/dosbox_snif/main_dump_delta.c @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) { while (!end) { rsp_query(&rsp, "c"); // Continue if ( rsp.replied != 1 ) printf("Bug 03\n"); - rsp_recv_full(&rsp); + //rsp_recv_full(&rsp); if ( rsp_check_and_clear(&rsp, "S05") != 0 ) printf("Bug 04\n"); snprintf(command, 15, "m%s,0x2d", ds_si); @@ -150,15 +150,15 @@ int main(int argc, char *argv[]) { printf("falldist\t%02x -> %02x\n",prevlemm.s.falldist, lemm.s.falldist); break; case 0x24: //flags1 - if ( prevlemm.s.flags1.bits.fl1_cap_climber != lemm.s.flags1.bits.fl1_cap_climber ) { + if ( prevlemm.s.flags1.bits.cap_climber != lemm.s.flags1.bits.cap_climber ) { printf("cap_climber\t%2i -> %2i\n", - prevlemm.s.flags1.bits.fl1_cap_climber, - lemm.s.flags1.bits.fl1_cap_climber + prevlemm.s.flags1.bits.cap_climber, + lemm.s.flags1.bits.cap_climber ); - } else if ( prevlemm.s.flags1.bits.fl1_walk_pause_for_shruggling != lemm.s.flags1.bits.fl1_walk_pause_for_shruggling ) { + } else if ( prevlemm.s.flags1.bits.walk_pause_for_shruggling != lemm.s.flags1.bits.walk_pause_for_shruggling ) { printf("walk_pause_for_shruggling\t%2i -> %2i\n", - prevlemm.s.flags1.bits.fl1_walk_pause_for_shruggling, - lemm.s.flags1.bits.fl1_walk_pause_for_shruggling + prevlemm.s.flags1.bits.walk_pause_for_shruggling, + lemm.s.flags1.bits.walk_pause_for_shruggling ); } else { printf("flags1.unknown\t%02x -> %02x\n",prevlemm.s.flags1.raw, lemm.s.flags1.raw); diff --git a/reverse-engineering/dosbox_snif/main_dump_ds0.c b/reverse-engineering/dosbox_snif/main_dump_ds0.c index e54589d..d004158 100644 --- a/reverse-engineering/dosbox_snif/main_dump_ds0.c +++ b/reverse-engineering/dosbox_snif/main_dump_ds0.c @@ -20,7 +20,7 @@ int main(int argc, char *argv[]) { while (!end) { rsp_query(&rsp, "c"); // Continue if ( rsp.replied != 1 ) printf("Bug 03\n"); - rsp_recv_full(&rsp); + //rsp_recv_full(&rsp); if ( rsp_check_and_clear(&rsp, "S05") != 0 ) printf("Bug 04\n"); // For the beginning of the ds segment diff --git a/reverse-engineering/dosbox_snif/main_poke.c b/reverse-engineering/dosbox_snif/main_poke.c index e0048fa..ea77ac1 100644 --- a/reverse-engineering/dosbox_snif/main_poke.c +++ b/reverse-engineering/dosbox_snif/main_poke.c @@ -22,7 +22,7 @@ int main(int argc, char *argv[]) { while (!end_loop) { rsp_query(&rsp, "c"); // Continue if ( rsp.replied != 1 ) printf("Bug 03\n"); - rsp_recv_full(&rsp); + //rsp_recv_full(&rsp); if ( rsp_check_and_clear(&rsp, "S05") != 0 ) printf("Bug 04\n"); snprintf(command, 15, "m%s,0x2d", ds_si); diff --git a/reverse-engineering/dosbox_snif/main_validate_code.c b/reverse-engineering/dosbox_snif/main_validate_code.c index 22ce62d..afb32ae 100644 --- a/reverse-engineering/dosbox_snif/main_validate_code.c +++ b/reverse-engineering/dosbox_snif/main_validate_code.c @@ -4,24 +4,92 @@ #include "rsp_lemm.h" #include "utils.h" -#include /* memset() */ -#include /* printf() */ +#include /* memset(), memcmp() */ +#include /* snprintf(), printf() */ +#include /* free() */ +#include /* offsetof() */ +//#include /* sleep() */ + +int game_data_diff(struct game_data *g1, struct game_data *g2, char diff[], size_t difflen) { + int i, start, end, lemm, lemmcount, off; + uint8_t *g1_raw = (uint8_t *)g1; + uint8_t *g2_raw = (uint8_t *)g2; + + + start=offsetof(struct game_data, lemm_count_to_process); + end=offsetof(struct game_data, lemmings); + for (i=start; ilemm_level_count, (sizeof(g1->lemmings) / sizeof(struct _lemm_data))); +// printf("lemmcount:%i\n", lemmcount); + + for (lemm=0; lemm < lemmcount; lemm++ ) { + start=offsetof(struct game_data, lemmings) + lemm * sizeof(struct _lemm_data); +// printf("lemmings[%i] : [0x%0X]\n", lemm, start); + + for (off=0; off %s\n", command); + rsp_query(rsp, command); + if ( rsp_decode(rsp) != size*2) { + printf("%06x : Bug\n", addr); + break; + } + + //printf("%06x : %s\n", addr, rsp->decoded); + for (i=0;idecoded+(i*2), 2); + if ( sscanf(hex_byte, "%x", &byte) != 1 ) { + printf("Bug decode\n"); + break; + } + ((char *)g)[offset+i] = byte; + //printf("((char *)&g)[0x%02x] = 0x%02x\n", offset+i, byte); + } + } + //printf("\n"); +} + +int main(int argc, char *argv[]) { + int rv, end=0, loops; + char ds_si[10]; + struct rsp_state rsp; + char msg_diff[256]; + struct game_data g_before, g_after, g_simulated; + rv=rsp_lemm_init(&rsp, ds_si); if ( rv != 0 ) { @@ -43,53 +111,31 @@ int main(int argc, char *argv[]) { printf("Bug 03\n"); continue; } - rsp_recv_full(&rsp); + //rsp_recv_full(&rsp); if ( rsp_check_and_clear(&rsp, "S05") != 0 ) { printf("Bug 04\n"); continue; } rsp_query(&rsp, "p8"); // Read $eip - if ( rsp_check_and_clear(&rsp, "c4380000") ) { - g = &g_before; - } else { - g = &g_after; - } - - //printf("sizeof(struct game_data) == %i\n", sizeof(struct game_data) ); - - for (offset=0 ; offset < sizeof(struct game_data) ; offset += size) { - size = imin(bs,sizeof(struct game_data)-offset); - addr = (0xb55 << 4) + offset; - snprintf(command, 15, "m%06x,0x%x", addr, size); - //printf("-> %s\n", command); - rsp_query(&rsp, command); - if ( rsp_decode(&rsp) != size*2) { - printf("%06x : Bug\n", addr); - break; - } - //printf("%06x : %s\n", addr, rsp.decoded); - for (i=0;iresponse_bom+1 : %s\n", rsp.response_bom + 1); + if ( rsp_check_and_clear(&rsp, "c4380000") == 0 ) { + // Beginning of move_lemmings() + _mem_dump(&rsp,&g_before); - if ( g == &g_before ) { // Exec simulation memcpy(&g_simulated,&g_before,sizeof(struct game_data)); move_lemmings(&g_simulated); } else { + // End of move_lemmings() + _mem_dump(&rsp,&g_after); + // Compare simulation results and orignal code results - if ( game_data_diff(&g_simulated, &g_after) != 0 ) { - (void) scanf("%s"); + if ( game_data_diff(&g_after, &g_simulated, msg_diff, sizeof(msg_diff)) != 0 ) { + printf("Diff found : %s\n", msg_diff); + //(void) scanf("nothing"); + //sleep(1); } } diff --git a/reverse-engineering/dosbox_snif/rsp.c b/reverse-engineering/dosbox_snif/rsp.c index c9957b7..fd4bce7 100644 --- a/reverse-engineering/dosbox_snif/rsp.c +++ b/reverse-engineering/dosbox_snif/rsp.c @@ -145,7 +145,7 @@ void rsp_send_break(struct rsp_state *rsp) { rsp->replied = 0; rsp->response_len = 0; - _rsp_sniff_garbage(rsp); + //_rsp_sniff_garbage(rsp); sentbytes = send(rsp->sockfd, &cbreak, 1, 0); if ( sentbytes < 1 ) return; @@ -168,10 +168,10 @@ void rsp_query(struct rsp_state *rsp, char command[]) { checksum = (checksum + c ) % 256; } - rsp->command_len = snprintf(rsp->command, rsp->data_maxlen, "$%s#%02x", command, checksum); + rsp->command_len = snprintf(rsp->command, rsp->data_maxlen, "$%s#%02hhx", command, checksum); if (rsp->command_len < 5) return; - _rsp_sniff_garbage(rsp); + //_rsp_sniff_garbage(rsp); sentbytes = send(rsp->sockfd, rsp->command, rsp->command_len, 0); if ( sentbytes < rsp->command_len ) return; diff --git a/reverse-engineering/dosbox_snif/rsp_lemm.c b/reverse-engineering/dosbox_snif/rsp_lemm.c index e39ef30..edb3211 100644 --- a/reverse-engineering/dosbox_snif/rsp_lemm.c +++ b/reverse-engineering/dosbox_snif/rsp_lemm.c @@ -33,7 +33,7 @@ int rsp_lemm_init(struct rsp_state *rsp, char *ds_si) { do { rsp_query(rsp, "c"); // Continue if ( rsp->replied != 1 ) continue; //return 12; - rsp_recv_full(rsp); + //rsp_recv_full(rsp); if ( rsp_check_and_clear(rsp, "S05") != 0 ) continue; //return 13; // (void) rsp_check_and_clear(rsp, "S05"); diff --git a/reverse-engineering/dosbox_snif/utils.c b/reverse-engineering/dosbox_snif/utils.c index 8e26d46..355e858 100644 --- a/reverse-engineering/dosbox_snif/utils.c +++ b/reverse-engineering/dosbox_snif/utils.c @@ -110,3 +110,9 @@ int bit_position(uint16_t flags) { } return pos; } + +inline int imin(int a, int b) { + if ( a < b ) return a; + return b; +} + diff --git a/reverse-engineering/dosbox_snif/utils.h b/reverse-engineering/dosbox_snif/utils.h index a7031a8..ee8441f 100644 --- a/reverse-engineering/dosbox_snif/utils.h +++ b/reverse-engineering/dosbox_snif/utils.h @@ -7,5 +7,6 @@ int tcp_client_init(char host[], char port[], int *sockfd); void flatten(char *seg_off); int hexascii2bin(char src[], void *dst, int maxlen); int bit_position(uint16_t flags); +int imin(int a, int b); #endif /*_UTIL_H*/ diff --git a/reverse-engineering/work/seg_code_0208.txt b/reverse-engineering/work/seg_code_0208.txt index 6f6de9a..4ef7054 100644 --- a/reverse-engineering/work/seg_code_0208.txt +++ b/reverse-engineering/work/seg_code_0208.txt @@ -333,6 +333,7 @@ Interesting procs : move_lemmings(), apply_skill(); 0000032C 3F aas 0000032D 0B01 or ax,[bx+di] 0000032F CF iretw + 00000330 C60406 mov byte [si],0x6 00000333 D7 xlatb 00000334 351720 xor ax,0x2017 @@ -402,6 +403,7 @@ Interesting procs : move_lemmings(), apply_skill(); 000003C2 07 pop es 000003C3 3CF9 cmp al,0xf9 000003C5 CF iretw + 000003C6 7862 js 0x42a 000003C8 E498 in al,0x98 000003CA 8E31 mov segr6,[bx+di] @@ -616,6 +618,7 @@ Interesting procs : move_lemmings(), apply_skill(); 0000058B 9E sahf 0000058C 7A36 jpe 0x5c4 0000058E CF iretw + 0000058F E50F in ax,0xf 00000591 13695C adc bp,[bx+di+0x5c] 00000594 038464A7 add ax,[si-0x589c] @@ -724,6 +727,7 @@ Interesting procs : move_lemmings(), apply_skill(); 0000067A 834107C6 add word [bx+di+0x7],byte -0x3a 0000067E 0F db 0x0f 0000067F CF iretw + 00000680 1E push ds 00000681 E13C loope 0x6bf 00000683 05784D add ax,0x4d78 @@ -1126,6 +1130,7 @@ Interesting procs : move_lemmings(), apply_skill(); 000009A1 46 inc si 000009A2 DF db 0xdf 000009A3 CF iretw + 000009A4 BEE27C mov si,0x7ce2 000009A7 08F8 or al,bh 000009A9 53 push bx @@ -1198,6 +1203,7 @@ Interesting procs : move_lemmings(), apply_skill(); 00000A48 5E pop si 00000A49 58 pop ax 00000A4A CF iretw + 00000A4B 05B0AA add ax,0xaab0 00000A4E E2CD loop 0xa1d 00000A50 40 inc ax @@ -1220,6 +1226,7 @@ Interesting procs : move_lemmings(), apply_skill(); 00000A70 302F xor [bx],ch 00000A72 40 inc ax 00000A73 CF iretw + 00000A74 FC cld 00000A75 E2CD loop 0xa44 00000A77 40 inc ax @@ -1681,6 +1688,7 @@ Interesting procs : move_lemmings(), apply_skill(); 00000EAD 32C0 xor al,al 00000EAF 1F pop ds 00000EB0 CF iretw + 00000EB1 803EDA1FF8 cmp byte [0x1fda],0xf8 00000EB6 7406 jz 0xebe 00000EB8 BAF203 mov dx,0x3f2 @@ -1696,7 +1704,7 @@ main_loop_ingame: 00000ECB E80B02 call word 0x10d9 video_wait_sync(); 00000ECE C606CC1F00 mov byte [0x1fcc],0x0 [0x1fcc]=0; 00000ED3 FE06CF1F inc byte [0x1fcf] [0x1fcf]++; -00000ED7 E83701 call word 0x1011 unk_01(); +00000ED7 E83701 call word 0x1011 unk_01(); /* could be fadeoff when ending level */ 00000EDA E8482A call word 0x3925 unk_02(); 00000EDD 813E0D00B000 cmp word [0xd],0xb0 if ( [0xd] > 0xb0 ) nop(): 00000EE3 7E03 jng 0xee8 // @@ -1713,7 +1721,7 @@ main_loop_ingame: 00000F04 E88526 call word 0x358c detect_lemm_under_cursor(); 00000F07 E86D24 call word 0x3377 draw_control_panel_and_infos(); 00000F0A E8371B call word 0x2a44 apply_skill(); // Again ? -00000F0D 803E4C00FF cmp byte [0x4c],0xff if ([0x4c]) goto 0xfb6; +00000F0D 803E4C00FF cmp byte [0x4c],0xff if ( no_lemm_left ) goto 0xfb6; 00000F12 7503 jnz 0xf17 // 00000F14 E99F00 jmp word 0xfb6 // 00000F17 803E4700FF cmp byte [0x47],0xff if ([0x47]) { @@ -1779,12 +1787,13 @@ main_loop_ingame: 00000FA3 E922FF jmp word 0xec8 goto main_loop_ingame; no_lemm_left: -00000FA6 C6064C00FF mov byte [0x4c],0xff [0x4c] = TRUE; +00000FA6 C6064C00FF mov byte [0x4c],0xff no_lemm_left = TRUE; 00000FAB A04B00 mov al,[0x4b] [0x4b] |= 0x2; 00000FAE 0C02 or al,0x2 // 00000FB0 A24B00 mov [0x4b],al // 00000FB3 E912FF jmp word 0xec8 goto main_loop_ingame; + 00000FB6 A04B00 mov al,[0x4b] if ( [0x4b] & 0x2 != 0 ) goto main_loop_ingame; 00000FB9 A802 test al,0x2 // 00000FBB 7403 jz 0xfc0 // @@ -1952,7 +1961,7 @@ no_lemm_left: 00001153 32C0 xor al,al 00001155 A2D01F mov [0x1fd0],al 00001158 A2CF1F mov [0x1fcf],al -0000115B A24C00 mov [0x4c],al +0000115B A24C00 mov [0x4c],al no_lemm_left = FALSE; 0000115E A22700 mov [0x27],al 00001161 A24F00 mov [0x4f],al 00001164 A25200 mov [0x52],al @@ -2777,7 +2786,7 @@ no_lemm_left: return; } 00001839 E80D3A call word 0x5249 vga_set_read_mode1_compare_plan3_to_color_8(); -0000183C C6064D00FF mov byte [0x4d],0xff [0x4d]=0xff; # +0000183C C6064D00FF mov byte [0x4d],0xff [0x4d] = 0xff; # 00001841 BE8500 mov si,0x85 lemm=&(lemmings[0]); 00001844 A04000 mov al,[0x40] // 00001847 A23F00 mov [0x3f],al lemm_count_to_process = lemm_spawned_count; @@ -2793,11 +2802,11 @@ no_lemm_left: 0000185B 8A4420 mov al,[si+0x20] if ( lemm->expl_countdown != 0 ) { 0000185E 22C0 and al,al // 00001860 7408 jz 0x186a // -00001862 E8930E call word 0x26f8 if ( commit_suicide() == 1 ) goto next_lemming; +00001862 E8930E call word 0x26f8 if ( commit_suicide() != FALSE ) goto next_lemming; 00001865 7503 jnz 0x186a // 00001867 E99700 jmp word 0x1901 // } -0000186A 8A4424 mov al,[si+0x24] if ( lemm->flags1.walk_pause_for_shruggling ) +0000186A 8A4424 mov al,[si+0x24] if ( lemm->flags1.bits.walk_pause_for_shruggling ) 0000186D A880 test al,0x80 goto lbl_anim_but_no_move; 0000186F 7403 jz 0x1874 // 00001871 E9350E jmp word 0x26a9 // @@ -2830,7 +2839,7 @@ no_lemm_left: 000018B9 7403 jz 0x18be goto lbl_climbing; 000018BB E98105 jmp word 0x1e3f // 000018BE A94000 test ax,0x40 if ( lemm->state.bits.s_climb_ending ) -000018C1 7403 jz 0x18c6 goto lbl_climb_ending: +000018C1 7403 jz 0x18c6 goto lbl_climb_ending; 000018C3 E96406 jmp word 0x1f2a // 000018C6 A98000 test ax,0x80 if ( lemm->state.bits.s_building ) 000018C9 7403 jz 0x18ce goto lbl_building; @@ -2862,14 +2871,14 @@ next_lemming: 00001905 FE0E3F00 dec byte [0x3f] lemm_count_to_process--; 00001909 7403 jz 0x190e if ( lemm_count_to_process != 0 ) continue; 0000190B E943FF jmp word 0x1851 // -0000190E 803E480000 cmp byte [0x48],0x0 if ( nuke_all_in_progress ) goto lbl_nuke_all; +0000190E 803E480000 cmp byte [0x48],0x0 if ( nuke_all_in_progress ) goto nuke_one_by_one; 00001913 7506 jnz 0x191b } /*while*/ 00001915 C6064D0000 mov byte [0x4d],0x0 [0x4d]=0; 0000191A C3 ret return; -lbl_nuke_all: +nuke_one_by_one: 0000191B A04900 mov al,[0x49] // 0000191E 3A064000 cmp al,[0x40] if ( nuke_i == lemm_spawned_count ) { 00001922 742E jz 0x1952 nuke_all_in_progress = 0; [0x4d]=0; return; @@ -2879,14 +2888,14 @@ lbl_nuke_all: 00001929 F7E1 mul cx // 0000192B 058500 add ax,0x85 // 0000192E 8BF0 mov si,ax // -00001930 807C2000 cmp byte [si+0x20],0x0 if ( lemm.expl_countdown == 0 ) { +00001930 807C2000 cmp byte [si+0x20],0x0 if ( lemm->expl_countdown == 0 ) { 00001934 7517 jnz 0x194d // -00001936 807C26FF cmp byte [si+0x26],0xff if ( lemm.is_gone ) { nuke_i++; goto lbl_nuke_all; } +00001936 807C26FF cmp byte [si+0x26],0xff if ( lemm->is_gone ) { nuke_i++; goto nuke_one_by_one; } 0000193A 7506 jnz 0x1942 // 0000193C FE064900 inc byte [0x49] // 00001940 EBD9 jmp short 0x191b // 00001942 F744080380 test word [si+0x8],0x8003 if ( lemm->state.raw & (s_exploding | s_splatting | s_exploding_spe) == 0 ) { -00001947 7504 jnz 0x194d lemm.expl_countdown = 79; +00001947 7504 jnz 0x194d lemm->expl_countdown = 79; 00001949 C644204F mov byte [si+0x20],0x4f } } 0000194D FE064900 inc byte [0x49] nuke_i++; @@ -2903,13 +2912,14 @@ lbl_walking: 00001964 884428 mov [si+0x28],al // 00001967 8A4427 mov al,[si+0x27] lemm->x_effective += lemm->direction; 0000196A 98 cbw // (cbw == Convert Byte to Word) -0000196B 0104 add [si],ax // -0000196D 833C10 cmp word [si],byte +0x10 if ( lemm->x_effective<16 || lemm->x_effective>=LEVEL_WIDTH ) goto change_dir_and_next; -00001970 7D03 jnl 0x1975 // -00001972 E9E600 jmp word 0x1a5b // -00001975 813C8006 cmp word [si],0x680 // +rection = - lemm->direction;0000196B 0104 add [si],ax // +0000196D 833C10 cmp word [si],byte +0x10 if ( lemm->x_effective<16 || lemm->x_effective>=LEVEL_WIDTH ) { +00001970 7D03 jnl 0x1975 // Inlined from 00001A5B +00001972 E9E600 jmp word 0x1a5b lemm->direction = - lemm->direction; +00001975 813C8006 cmp word [si],0x680 goto check_this_and_go_next_lemming; 00001979 7C03 jl 0x197e // 0000197B E9DD00 jmp word 0x1a5b // + } 0000197E E8FA38 call word 0x527b vga_mem_read_prepare_registers(); 00001981 8B6C02 mov bp,[si+0x2] // 00001984 268A05 mov al,[es:di] if ( is_solid(lemm->x_effective, lemm->y_effective) ) goto walker_check_above_terrain; @@ -2918,9 +2928,9 @@ lbl_walking: for (i=0; i<3; i++) { 0000198B 45 inc bp lemm->y_effective++; -0000198C 033E0400 add di,[0x4] if ( is_solid(lemm->x_effective, lemm->y_effective) ) break; -00001990 268A05 mov al,[es:di] // -00001993 22C4 and al,ah // +0000198C 033E0400 add di,[0x4] if ( is_solid(lemm->x_effective, lemm->y_effective) ) { +00001990 268A05 mov al,[es:di] goto walker_check_fall_out_of_screen; +00001993 22C4 and al,ah } 00001995 7555 jnz 0x19ec // 00001997 45 inc bp // @@ -2935,43 +2945,46 @@ lbl_walking: 000019AB 22C4 and al,ah // 000019AD 753D jnz 0x19ec // } - if ( i == 3 ) { -000019AF 45 inc bp lemm->y_effective++; -000019B0 834C0804 or word [si+0x8],byte +0x4 lemm->state.bits.s_falling=1; -000019B4 C7440A0000 mov word [si+0xa],0x0 //??? -000019B9 C7440C420A mov word [si+0xc],0xa42 lemm->spr_data_ptr = 0xa42; -000019BE C744105A00 mov word [si+0x10],0x5a //??? -000019C3 C744123C00 mov word [si+0x12],0x3c //??? -000019C8 C6442800 mov byte [si+0x28],0x0 lemm->spr_frame = 0; -000019CC C6442303 mov byte [si+0x23],0x3 lemm->falldist = 3; -000019D0 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; -000019D5 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; -000019DA C6442904 mov byte [si+0x29],0x4 lemm->draw_hint = hint_falling; -000019DE A12B00 mov ax,[0x2b] // -000019E1 894414 mov [si+0x14],ax lemm->ptr2 = [0x2b]; # -000019E4 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -000019E8 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; - } +//walker_become_faller: +000019AF 45 inc bp lemm->y_effective++; +000019B0 834C0804 or word [si+0x8],byte +0x4 lemm->state.bits.s_falling=1; +000019B4 C7440A0000 mov word [si+0xa],0x0 //??? +000019B9 C7440C420A mov word [si+0xc],0xa42 lemm->spr_data_ptr = 0xa42; +000019BE C744105A00 mov word [si+0x10],0x5a //??? +000019C3 C744123C00 mov word [si+0x12],0x3c //??? +000019C8 C6442800 mov byte [si+0x28],0x0 lemm->spr_frame = 0; +000019CC C6442303 mov byte [si+0x23],0x3 lemm->falldist = 3; +000019D0 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +000019D5 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; +000019DA C6442904 mov byte [si+0x29],0x4 lemm->draw_hint = hint_falling; +000019DE A12B00 mov ax,[0x2b] // +000019E1 894414 mov [si+0x14],ax lemm->ptr2 = [0x2b]; # +000019E4 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; +000019E8 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; + +walker_check_fall_out_of_screen: 000019EC 896C02 mov [si+0x2],bp // 000019EF 81FDB400 cmp bp,0xb4 if ( lemm->y_effective >= 180 ) { -000019F3 7D03 jnl 0x19f8 lemm->is_gone=true; goto next_lemming; +000019F3 7D03 jnl 0x19f8 lemm->is_gone=TRUE; goto next_lemming; } 000019F5 E906FF jmp word 0x18fe goto check_this_and_go_next_lemming; -000019F8 C64426FF mov byte [si+0x26],0xff // ( lemm->is_gone=true; goto next_lemming; ) +000019F8 C64426FF mov byte [si+0x26],0xff // ( lemm->is_gone=TRUE; goto next_lemming; ) 000019FC E902FF jmp word 0x1901 // jumped from various places, but "inlined" in C comments walker_check_above_terrain: -000019FF E8B863 call word 0x7dba // nop(); //FIXME : rewrite with temp var because bp is reused (or not) after jumps +000019FF E8B863 call word 0x7dba // nop(); + //FIXME : rewrite : bp is used (or not) to change lemm->y_effective + // is_solid() has side effects (sub di,stencil_line_width) 00001A02 2B3E0400 sub di,[0x4] if ( ! is_solid(lemm->x_effective, lemm->y_effective - 1) 00001A06 268A05 mov al,[es:di] || ! is_solid(lemm->x_effective, lemm->y_effective - 2) 00001A09 22C4 and al,ah || ! is_solid(lemm->x_effective, lemm->y_effective - 3) ) { -00001A0B 7454 jz 0x1a61 goto walker_adjust_y; +00001A0B 7454 jz 0x1a61 goto walker_adjust_y_or_U_turn; 00001A0D 4D dec bp } 00001A0E 2B3E0400 sub di,[0x4] if ( ! is_solid(lemm->x_effective, lemm->y_effective - 4) 00001A12 268A05 mov al,[es:di] || ! is_solid(lemm->x_effective, lemm->y_effective - 5) 00001A15 22C4 and al,ah || ! is_solid(lemm->x_effective, lemm->y_effective - 6) ) { -00001A17 7448 jz 0x1a61 goto become_ascender; +00001A17 7448 jz 0x1a61 goto walker_become_ascender; 00001A19 4D dec bp } 00001A1A 2B3E0400 sub di,[0x4] // 00001A1E 268A05 mov al,[es:di] // @@ -2998,16 +3011,15 @@ walker_check_above_terrain: 00001A51 22C4 and al,ah // 00001A53 742D jz 0x1a82 // -00001A55 F6442401 test byte [si+0x24],0x1 if ( lemm->flags.cap_climber ) goto 0x1a92; +00001A55 F6442401 test byte [si+0x24],0x1 if ( lemm->flags.cap_climber ) goto walker_become_climber; 00001A59 7537 jnz 0x1a92 // -change_dir_and_next: -00001A5B F65C27 neg byte [si+0x27] lemm->direction = - lemm->direction; -00001A5E E99DFE jmp word 0x18fe goto check_this_and_go_next_lemming; +00001A5B F65C27 neg byte [si+0x27] ( lemm->direction = - lemm->direction; goto check_this_and_go_next_lemming; ) +00001A5E E99DFE jmp word 0x18fe // Inlined, see 0000196D -walker_adjust_y: +walker_adjust_y_or_U_turn: 00001A61 896C02 mov [si+0x2],bp lemm->y_effective = bp; -00001A64 036C06 add bp,[si+0x6] if ( lemm->y_effective + lemm->y_spr_offset ) <= 10 { +00001A64 036C06 add bp,[si+0x6] if ( lemm->y_effective + lemm->y_spr_offset <= 10 ) { 00001A67 83FD0A cmp bp,byte +0xa // 00001A6A 7E03 jng 0x1a6f // 00001A6C E98FFE jmp word 0x18fe // @@ -3019,25 +3031,26 @@ walker_adjust_y: } 00001A7F E97CFE jmp word 0x18fe goto check_this_and_go_next_lemming; -become_ascender: +walker_become_ascender: 00001A82 834C0808 or word [si+0x8],byte +0x8 lemm->state.bits.s_ascending=1; 00001A86 C6442808 mov byte [si+0x28],0x8 lemm->spr_frame = 8; 00001A8A 8B6C02 mov bp,[si+0x2] bp = lemm.y_effective - 2; 00001A8D 83ED02 sub bp,byte +0x2 // -00001A90 EBCF jmp short 0x1a61 goto walker_adjust_y; +00001A90 EBCF jmp short 0x1a61 goto walker_adjust_y_or_U_turn; +walker_become_climber: 00001A92 C6442800 mov byte [si+0x28],0x0 00001A96 C7440A0000 mov word [si+0xa],0x0 00001A9B C7440C9A03 mov word [si+0xc],0x39a 00001AA0 834C0820 or word [si+0x8],byte +0x20 lemm->state.bits.s_climbing = 1; 00001AA4 C744104800 mov word [si+0x10],0x48 00001AA9 C744123000 mov word [si+0x12],0x30 -00001AAE C74404F8FF mov word [si+0x4],0xfff8 -00001AB3 C74406F4FF mov word [si+0x6],0xfff4 +00001AAE C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +00001AB3 C74406F4FF mov word [si+0x6],0xfff4 lemm->y_spr_offset = -12; 00001AB8 A12D00 mov ax,[0x2d] 00001ABB 894414 mov [si+0x14],ax 00001ABE C6442AFF mov byte [si+0x2a],0xff lemm->draw_trick1 = TRUE; -00001AC2 C6442908 mov byte [si+0x29],0x8 +00001AC2 C6442908 mov byte [si+0x29],0x8 lemm->draw_hint = 8; 00001AC6 E935FE jmp word 0x18fe goto check_this_and_go_next_lemming; lbl_falling: @@ -3061,7 +3074,7 @@ lbl_falling: 00001B0A A13700 mov ax,[0x37] // 00001B0D 894414 mov [si+0x14],ax lemm->ptr2 = [0x37]; 00001B10 C6442AFF mov byte [si+0x2a],0xff lemm->draw_trick1 = TRUE; -00001B14 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00001B14 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00001B18 E9E3FD jmp word 0x18fe goto check_this_and_go_next_lemming; } 00001B1B E85D37 call word 0x527b vga_mem_read_prepare_registers(); @@ -3071,18 +3084,19 @@ lbl_falling: 00001B26 753E jnz 0x1b66 // 00001B28 45 inc bp -00001B29 81FDB400 cmp bp,0xb4 -00001B2D 7C03 jl 0x1b32 -00001B2F E9C6FE jmp word 0x19f8 lemm->is_gone=true; goto next_lemming; - +00001B29 81FDB400 cmp bp,0xb4 if ( ? >= 0xB4) { +00001B2D 7C03 jl 0x1b32 // +00001B2F E9C6FE jmp word 0x19f8 lemm->is_gone=TRUE; goto next_lemming; + } 00001B32 033E0400 add di,[0x4] 00001B36 268A05 mov al,[es:di] 00001B39 22C4 and al,ah 00001B3B 7529 jnz 0x1b66 00001B3D 45 inc bp -00001B3E 81FDB400 cmp bp,0xb4 -00001B42 7C03 jl 0x1b47 -00001B44 E9B1FE jmp word 0x19f8 lemm->is_gone=true; goto next_lemming; +00001B3E 81FDB400 cmp bp,0xb4 if ( ? >= 0xB4) { +00001B42 7C03 jl 0x1b47 // +00001B44 E9B1FE jmp word 0x19f8 lemm->is_gone=TRUE; goto next_lemming; + } 00001B47 033E0400 add di,[0x4] 00001B4B 268A05 mov al,[es:di] 00001B4E 22C4 and al,ah @@ -3093,7 +3107,7 @@ lbl_falling: 00001B5A 81FDB400 cmp bp,0xb4 00001B5E 7D03 jnl 0x1b63 00001B60 E99BFD jmp word 0x18fe goto check_this_and_go_next_lemming; -00001B63 E992FE jmp word 0x19f8 lemm->is_gone=true; goto next_lemming; +00001B63 E992FE jmp word 0x19f8 lemm->is_gone=TRUE; goto next_lemming; 00001B66 896C02 mov [si+0x2],bp 00001B69 807C233C cmp byte [si+0x23],0x3c 00001B6D 764D jna 0x1bbc @@ -3109,7 +3123,7 @@ lbl_falling: 00001B98 A12B00 mov ax,[0x2b] 00001B9B 894414 mov [si+0x14],ax 00001B9E C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = TRUE; -00001BA2 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00001BA2 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00001BA6 803E0820FF cmp byte [0x2008],0xff 00001BAB 750C jnz 0x1bb9 00001BAD F606FF2003 test byte [0x20ff],0x3 @@ -3123,13 +3137,13 @@ lbl_falling: 00001BCB C744105A00 mov word [si+0x10],0x5a 00001BD0 C744123C00 mov word [si+0x12],0x3c 00001BD5 C6442800 mov byte [si+0x28],0x0 -00001BD9 C74404F8FF mov word [si+0x4],0xfff8 -00001BDE C74406F6FF mov word [si+0x6],0xfff6 +00001BD9 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +00001BDE C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 00001BE3 C6442909 mov byte [si+0x29],0x9 00001BE7 A12B00 mov ax,[0x2b] 00001BEA 894414 mov [si+0x14],ax 00001BED C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -00001BF1 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00001BF1 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00001BF5 E906FD jmp word 0x18fe goto check_this_and_go_next_lemming; lbl_splatting: 00001BF8 8A4428 mov al,[si+0x28] @@ -3162,7 +3176,7 @@ lbl_drawning: 00001C35 7502 jnz 0x1c39 00001C37 011C add [si],bx 00001C39 E9C5FC jmp word 0x1901 goto next_lemming; -00001C3C E9B9FD jmp word 0x19f8 lemm.is_gone=true; goto next_lemming; +00001C3C E9B9FD jmp word 0x19f8 lemm.is_gone=TRUE; goto next_lemming; lbl_ending: 00001C3F 8A4428 mov al,[si+0x28] 00001C42 FEC0 inc al @@ -3176,7 +3190,7 @@ lbl_ending: lbl_dying: 00001C59 FE4428 inc byte [si+0x28] lemm.spr_frame++; 00001C5C 8A4428 mov al,[si+0x28] if ( lemm.spr_frame == 0xe ) { -00001C5F 3C0E cmp al,0xe lemm.is_gone=true; +00001C5F 3C0E cmp al,0xe lemm.is_gone=TRUE; 00001C61 7503 jnz 0x1c66 } 00001C63 E992FD jmp word 0x19f8 // 00001C66 E998FC jmp word 0x1901 goto next_lemming; @@ -3186,7 +3200,7 @@ lbl_exploding_spe: 00001C6E 884428 mov [si+0x28],al 00001C71 3C34 cmp al,0x34 00001C73 7503 jnz 0x1c78 -00001C75 E980FD jmp word 0x19f8 lemm.is_gone=true; goto next_lemming; +00001C75 E980FD jmp word 0x19f8 lemm.is_gone=TRUE; goto next_lemming; 00001C78 FEC8 dec al 00001C7A 7403 jz 0x1c7f 00001C7C E982FC jmp word 0x1901 goto next_lemming; @@ -3199,7 +3213,7 @@ lbl_exploding_spe: 00001C92 F744080001 test word [si+0x8],0x100 00001C97 7502 jnz 0x1c9b 00001C99 EB03 jmp short 0x1c9e -00001C9B E89504 call word 0x2133 +00001C9B E89504 call word 0x2133 unk_05(); 00001C9E 8B04 mov ax,[si] 00001CA0 8B5C02 mov bx,[si+0x2] 00001CA3 83EB10 sub bx,byte +0x10 @@ -3245,7 +3259,7 @@ lbl_ascending: 00001D03 C6442800 mov byte [si+0x28],0x0 00001D07 8B6C02 mov bp,[si+0x2] 00001D0A 45 inc bp -00001D0B E953FD jmp word 0x1a61 +00001D0B E953FD jmp word 0x1a61 goto walker_adjust_y_or_U_turn; lbl_digging: 00001D0E 807C2811 cmp byte [si+0x28],0x11 00001D12 7503 jnz 0x1d17 @@ -3260,7 +3274,7 @@ lbl_digging: 00001D27 E9D7FB jmp word 0x1901 goto next_lemming; 00001D2A 8B2C mov bp,[si] 00001D2C 8B4404 mov ax,[si+0x4] -00001D2F 0104 add [si],ax +00001D2F 0104 add [si],ax 00001D31 FF34 push word [si] 00001D33 E84535 call word 0x527b 00001D36 892C mov [si],bp @@ -3269,7 +3283,7 @@ lbl_digging: 00001D3C 8B6C02 mov bp,[si+0x2] 00001D3F 81FDB400 cmp bp,0xb4 00001D43 7C03 jl 0x1d48 -00001D45 E9B0FC jmp word 0x19f8 lemm->is_gone=true; goto next_lemming; +00001D45 E9B0FC jmp word 0x19f8 lemm->is_gone=TRUE; goto next_lemming; 00001D48 E84B60 call word 0x7d96 00001D4B 7543 jnz 0x1d90 00001D4D 836408EF and word [si+0x8],byte -0x11 @@ -3280,13 +3294,13 @@ lbl_digging: 00001D64 C744123C00 mov word [si+0x12],0x3c 00001D69 C6442800 mov byte [si+0x28],0x0 00001D6D C6442303 mov byte [si+0x23],0x3 -00001D71 C74404F8FF mov word [si+0x4],0xfff8 -00001D76 C74406F6FF mov word [si+0x6],0xfff6 +00001D71 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +00001D76 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 00001D7B C6442904 mov byte [si+0x29],0x4 00001D7F A12B00 mov ax,[0x2b] 00001D82 894414 mov [si+0x14],ax 00001D85 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -00001D89 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00001D89 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00001D8D E96EFB jmp word 0x18fe goto check_this_and_go_next_lemming; 00001D90 8B04 mov ax,[si] 00001D92 8B5C02 mov bx,[si+0x2] @@ -3321,14 +3335,15 @@ lbl_digging: 00001DDE C744105A00 mov word [si+0x10],0x5a 00001DE3 C744123C00 mov word [si+0x12],0x3c 00001DE8 C6442800 mov byte [si+0x28],0x0 -00001DEC C74404F8FF mov word [si+0x4],0xfff8 -00001DF1 C74406F6FF mov word [si+0x6],0xfff6 +00001DEC C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +00001DF1 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 00001DF6 C6442909 mov byte [si+0x29],0x9 00001DFA A12B00 mov ax,[0x2b] 00001DFD 894414 mov [si+0x14],ax 00001E00 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -00001E04 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00001E04 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00001E08 E9F3FA jmp word 0x18fe goto check_this_and_go_next_lemming; + 00001E0B FF34 push word [si] 00001E0D FF7402 push word [si+0x2] 00001E10 8B4404 mov ax,[si+0x4] @@ -3389,13 +3404,13 @@ lbl_climbing: 00001E9B C744123C00 mov word [si+0x12],0x3c 00001EA0 C6442800 mov byte [si+0x28],0x0 00001EA4 C6442303 mov byte [si+0x23],0x3 -00001EA8 C74404F8FF mov word [si+0x4],0xfff8 -00001EAD C74406F6FF mov word [si+0x6],0xfff6 +00001EA8 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +00001EAD C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 00001EB2 C6442904 mov byte [si+0x29],0x4 00001EB6 A12B00 mov ax,[0x2b] 00001EB9 894414 mov [si+0x14],ax 00001EBC C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -00001EC0 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00001EC0 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00001EC4 8A4427 mov al,[si+0x27] 00001EC7 F6D8 neg al 00001EC9 884427 mov [si+0x27],al @@ -3425,9 +3440,9 @@ lbl_climbing: 00001F13 C744123000 mov word [si+0x12],0x30 00001F18 C6442800 mov byte [si+0x28],0x0 00001F1C C6442908 mov byte [si+0x29],0x8 -00001F20 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00001F20 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00001F24 8B6C02 mov bp,[si+0x2] -00001F27 E937FB jmp word 0x1a61 +00001F27 E937FB jmp word 0x1a61 goto walker_adjust_y_or_U_turn; lbl_climb_ending: 00001F2A 8A4428 mov al,[si+0x28] 00001F2D FEC0 inc al @@ -3446,13 +3461,13 @@ lbl_climb_ending: 00001F56 C744105A00 mov word [si+0x10],0x5a 00001F5B C744123C00 mov word [si+0x12],0x3c 00001F60 C6442800 mov byte [si+0x28],0x0 -00001F64 C74404F8FF mov word [si+0x4],0xfff8 -00001F69 C74406F6FF mov word [si+0x6],0xfff6 +00001F64 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +00001F69 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 00001F6E C6442909 mov byte [si+0x29],0x9 00001F72 A12B00 mov ax,[0x2b] 00001F75 894414 mov [si+0x14],ax 00001F78 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -00001F7C 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00001F7C 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00001F80 8B6C02 mov bp,[si+0x2] 00001F83 E9DBFA jmp word 0x1a61 lbl_building: @@ -3549,13 +3564,13 @@ lbl_building: 0000206D C744105A00 mov word [si+0x10],0x5a 00002072 C744123C00 mov word [si+0x12],0x3c 00002077 C6442800 mov byte [si+0x28],0x0 -0000207B C74404F8FF mov word [si+0x4],0xfff8 -00002080 C74406F6FF mov word [si+0x6],0xfff6 +0000207B C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +00002080 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 00002085 C6442909 mov byte [si+0x29],0x9 00002089 A12B00 mov ax,[0x2b] 0000208C 894414 mov [si+0x14],ax 0000208F C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -00002093 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00002093 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00002097 8B6C02 mov bp,[si+0x2] 0000209A E9C4F9 jmp word 0x1a61 0000209D C744080000 mov word [si+0x8],0x0 @@ -3564,14 +3579,14 @@ lbl_building: 000020AC C744105A00 mov word [si+0x10],0x5a 000020B1 C744123C00 mov word [si+0x12],0x3c 000020B6 C6442800 mov byte [si+0x28],0x0 -000020BA C74404F8FF mov word [si+0x4],0xfff8 -000020BF C74406F6FF mov word [si+0x6],0xfff6 +000020BA C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +000020BF C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 000020C4 C6442908 mov byte [si+0x29],0x8 000020C8 A12B00 mov ax,[0x2b] 000020CB 894414 mov [si+0x14],ax 000020CE C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; 000020D2 80642401 and byte [si+0x24],0x1 // -000020D6 804C2480 or byte [si+0x24],0x80 lemm->flags1.walk_pause_for_shruggling = 1; +000020D6 804C2480 or byte [si+0x24],0x80 lemm->flags1.bits.walk_pause_for_shruggling = 1; 000020DA 8B6C02 mov bp,[si+0x2] 000020DD E981F9 jmp word 0x1a61 lbl_blocking: @@ -3588,15 +3603,17 @@ lbl_blocking: 00002103 C744105A00 mov word [si+0x10],0x5a 00002108 C744123C00 mov word [si+0x12],0x3c 0000210D C6442800 mov byte [si+0x28],0x0 -00002111 C74404F8FF mov word [si+0x4],0xfff8 -00002116 C74406F6FF mov word [si+0x6],0xfff6 +00002111 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +00002116 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 0000211B C6442909 mov byte [si+0x29],0x9 0000211F A12B00 mov ax,[0x2b] 00002122 894414 mov [si+0x14],ax 00002125 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -00002129 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; -0000212D E80300 call word 0x2133 +00002129 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; +0000212D E80300 call word 0x2133 unk_05(); 00002130 E9CEF7 jmp word 0x1901 goto next_lemming; + + void unk_05() { 00002133 8B04 mov ax,[si] 00002135 8B5C02 mov bx,[si+0x2] 00002138 83E804 sub ax,byte +0x4 @@ -3634,6 +3651,7 @@ lbl_blocking: 00002172 5F pop di 00002173 5E pop si 00002174 C3 ret + } lbl_bashing: 00002175 FE4428 inc byte [si+0x28] 00002178 8064281F and byte [si+0x28],0x1f @@ -3694,38 +3712,38 @@ lbl_bashing: 00002205 C744105A00 mov word [si+0x10],0x5a 0000220A C744123C00 mov word [si+0x12],0x3c 0000220F C6442800 mov byte [si+0x28],0x0 -00002213 C74404F8FF mov word [si+0x4],0xfff8 -00002218 C74406F6FF mov word [si+0x6],0xfff6 +00002213 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +00002218 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 0000221D C6442909 mov byte [si+0x29],0x9 00002221 A12B00 mov ax,[0x2b] 00002224 894414 mov [si+0x14],ax 00002227 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -0000222B 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +0000222B 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 0000222F E9CFF6 jmp word 0x1901 goto next_lemming; 00002232 8A4427 mov al,[si+0x27] 00002235 98 cbw 00002236 0104 add [si],ax 00002238 833C10 cmp word [si],byte +0x10 -0000223B 7C7C jl 0x22b9 +0000223B 7C7C jl 0x22b9 goto lbl_unk_06; 0000223D 813C8006 cmp word [si],0x680 -00002241 7D76 jnl 0x22b9 +00002241 7D76 jnl 0x22b9 goto lbl_unk_06; 00002243 E83530 call word 0x527b 00002246 268A05 mov al,[es:di] 00002249 22C4 and al,ah 0000224B 7403 jz 0x2250 -0000224D E9A800 jmp word 0x22f8 +0000224D E9A800 jmp word 0x22f8 goto lbl_unk_07; 00002250 FF4402 inc word [si+0x2] 00002253 033E0400 add di,[0x4] 00002257 268A05 mov al,[es:di] 0000225A 22C4 and al,ah 0000225C 7403 jz 0x2261 -0000225E E99700 jmp word 0x22f8 +0000225E E99700 jmp word 0x22f8 goto lbl_unk_07; 00002261 FF4402 inc word [si+0x2] 00002264 033E0400 add di,[0x4] 00002268 268A05 mov al,[es:di] 0000226B 22C4 and al,ah 0000226D 7403 jz 0x2272 -0000226F E98600 jmp word 0x22f8 +0000226F E98600 jmp word 0x22f8 goto lbl_unk_07; 00002272 FF4402 inc word [si+0x2] 00002275 834C0804 or word [si+0x8],byte +0x4 00002279 C7440A0000 mov word [si+0xa],0x0 @@ -3734,15 +3752,17 @@ lbl_bashing: 00002288 C744123C00 mov word [si+0x12],0x3c 0000228D C6442800 mov byte [si+0x28],0x0 00002291 C6442303 mov byte [si+0x23],0x3 -00002295 C74404F8FF mov word [si+0x4],0xfff8 -0000229A C74406F6FF mov word [si+0x6],0xfff6 +00002295 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +0000229A C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 0000229F C6442904 mov byte [si+0x29],0x4 000022A3 A12B00 mov ax,[0x2b] 000022A6 894414 mov [si+0x14],ax 000022A9 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -000022AD 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +000022AD 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 000022B1 816408FFFD and word [si+0x8],0xfdff 000022B6 E945F6 jmp word 0x18fe goto check_this_and_go_next_lemming; + +lbl_unk_06: 000022B9 F65C27 neg byte [si+0x27] 000022BC C744080000 mov word [si+0x8],0x0 000022C1 C7440A0000 mov word [si+0xa],0x0 @@ -3750,14 +3770,16 @@ lbl_bashing: 000022CB C744105A00 mov word [si+0x10],0x5a 000022D0 C744123C00 mov word [si+0x12],0x3c 000022D5 C6442800 mov byte [si+0x28],0x0 -000022D9 C74404F8FF mov word [si+0x4],0xfff8 -000022DE C74406F6FF mov word [si+0x6],0xfff6 +000022D9 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +000022DE C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 000022E3 C6442909 mov byte [si+0x29],0x9 000022E7 A12B00 mov ax,[0x2b] 000022EA 894414 mov [si+0x14],ax 000022ED C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -000022F1 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +000022F1 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 000022F5 E906F6 jmp word 0x18fe goto check_this_and_go_next_lemming; + +lbl_unk_07: 000022F8 8B04 mov ax,[si] 000022FA 8B5C02 mov bx,[si+0x2] 000022FD 83EB10 sub bx,byte +0x10 @@ -3783,11 +3805,12 @@ lbl_bashing: 00002327 240F and al,0xf 00002329 3C09 cmp al,0x9 0000232B 7422 jz 0x234f -0000232D 3C07 cmp al,0x7 + +0000232D 3C07 cmp al,0x7 while (...) { 0000232F 750A jnz 0x233b 00002331 8A4427 mov al,[si+0x27] 00002334 22C0 and al,al -00002336 7981 jns 0x22b9 +00002336 7981 jns 0x22b9 goto lbl_unk_06; 00002338 E9C3F5 jmp word 0x18fe goto check_this_and_go_next_lemming; 0000233B 3C08 cmp al,0x8 0000233D 7403 jz 0x2342 @@ -3795,15 +3818,17 @@ lbl_bashing: 00002342 8A4427 mov al,[si+0x27] 00002345 22C0 and al,al 00002347 7903 jns 0x234c -00002349 E96DFF jmp word 0x22b9 +00002349 E96DFF jmp word 0x22b9 goto lbl_unk_06; 0000234C E9AFF5 jmp word 0x18fe goto check_this_and_go_next_lemming; + } 0000234F 803E0820FF cmp byte [0x2008],0xff 00002354 750C jnz 0x2362 00002356 F606FF2003 test byte [0x20ff],0x3 0000235B 7405 jz 0x2362 0000235D B80A04 mov ax,0x40a 00002360 CD61 int 0x61 -00002362 E954FF jmp word 0x22b9 +00002362 E954FF jmp word 0x22b9 goto lbl_unk_06; + lbl_floating: 00002365 BBEB26 mov bx,0x26eb 00002368 035C0E add bx,[si+0xe] @@ -3859,18 +3884,18 @@ lbl_floating: 000023F0 C744105A00 mov word [si+0x10],0x5a 000023F5 C744123C00 mov word [si+0x12],0x3c 000023FA C6442800 mov byte [si+0x28],0x0 -000023FE C74404F8FF mov word [si+0x4],0xfff8 -00002403 C74406F6FF mov word [si+0x6],0xfff6 +000023FE C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +00002403 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 00002408 C6442909 mov byte [si+0x29],0x9 0000240C A12B00 mov ax,[0x2b] 0000240F 894414 mov [si+0x14],ax 00002412 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -00002416 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00002416 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 0000241A E9E1F4 jmp word 0x18fe goto check_this_and_go_next_lemming; 0000241D 817C02B400 cmp word [si+0x2],0xb4 00002422 7D03 jnl 0x2427 00002424 E9D7F4 jmp word 0x18fe -00002427 E9CEF5 jmp word 0x19f8 lemm.is_gone=true; goto next_lemming; +00002427 E9CEF5 jmp word 0x19f8 lemm.is_gone=TRUE; goto next_lemming; lbl_mining: 0000242A 8A4428 mov al,[si+0x28] 0000242D FEC0 inc al @@ -3921,19 +3946,19 @@ lbl_mining: 000024A4 C744123C00 mov word [si+0x12],0x3c 000024A9 C6442800 mov byte [si+0x28],0x0 000024AD C6442303 mov byte [si+0x23],0x3 -000024B1 C74404F8FF mov word [si+0x4],0xfff8 -000024B6 C74406F6FF mov word [si+0x6],0xfff6 +000024B1 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +000024B6 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 000024BB C6442904 mov byte [si+0x29],0x4 000024BF A12B00 mov ax,[0x2b] 000024C2 894414 mov [si+0x14],ax 000024C5 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -000024C9 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +000024C9 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 000024CD 816408FFF7 and word [si+0x8],0xf7ff 000024D2 E929F4 jmp word 0x18fe goto check_this_and_go_next_lemming; 000024D5 FF4402 inc word [si+0x2] 000024D8 817C02B400 cmp word [si+0x2],0xb4 000024DD 7C03 jl 0x24e2 -000024DF E916F5 jmp word 0x19f8 lemm.is_gone=true; goto next_lemming; +000024DF E916F5 jmp word 0x19f8 lemm.is_gone=TRUE; goto next_lemming; 000024E2 E919F4 jmp word 0x18fe 000024E5 8A4427 mov al,[si+0x27] 000024E8 98 cbw @@ -3954,8 +3979,8 @@ lbl_mining: 0000250F FF4402 inc word [si+0x2] 00002512 817C02B400 cmp word [si+0x2],0xb4 00002517 7C03 jl 0x251c -00002519 E9DCF4 jmp word 0x19f8 lemm.is_gone=true; goto next_lemming; -0000251C E85C2D call word 0x527b +00002519 E9DCF4 jmp word 0x19f8 lemm.is_gone=TRUE; goto next_lemming; +0000251C E85C2D call word 0x527b vga_mem_read_prepare_registers(); 0000251F 268A05 mov al,[es:di] 00002522 22C4 and al,ah 00002524 7544 jnz 0x256a @@ -3966,13 +3991,13 @@ lbl_mining: 00002539 C744123C00 mov word [si+0x12],0x3c 0000253E C6442800 mov byte [si+0x28],0x0 00002542 C6442303 mov byte [si+0x23],0x3 -00002546 C74404F8FF mov word [si+0x4],0xfff8 -0000254B C74406F6FF mov word [si+0x6],0xfff6 +00002546 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +0000254B C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 00002550 C6442904 mov byte [si+0x29],0x4 00002554 A12B00 mov ax,[0x2b] 00002557 894414 mov [si+0x14],ax 0000255A C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -0000255E 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +0000255E 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00002562 816408FFF7 and word [si+0x8],0xf7ff 00002567 E994F3 jmp word 0x18fe goto check_this_and_go_next_lemming; 0000256A 8B04 mov ax,[si] @@ -4014,13 +4039,13 @@ lbl_mining: 000025C1 C744105A00 mov word [si+0x10],0x5a 000025C6 C744123C00 mov word [si+0x12],0x3c 000025CB C6442800 mov byte [si+0x28],0x0 -000025CF C74404F8FF mov word [si+0x4],0xfff8 -000025D4 C74406F6FF mov word [si+0x6],0xfff6 +000025CF C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +000025D4 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 000025D9 C6442909 mov byte [si+0x29],0x9 000025DD A12B00 mov ax,[0x2b] 000025E0 894414 mov [si+0x14],ax 000025E3 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -000025E7 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +000025E7 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 000025EB E910F3 jmp word 0x18fe goto check_this_and_go_next_lemming; 000025EE 803E0820FF cmp byte [0x2008],0xff 000025F3 750C jnz 0x2601 @@ -4042,14 +4067,14 @@ lbl_exploding: 0000261D C744108002 mov word [si+0x10],0x280 # 00002622 C74412E001 mov word [si+0x12],0x1e0 # 00002627 C6442800 mov byte [si+0x28],0x0 lemm->spr_frame = 0; -0000262B C74406E7FF mov word [si+0x6],0xffe7 lemm->x_spr_offset = -25; -00002630 C74404F0FF mov word [si+0x4],0xfff0 lemm->y_spr_offset = -16; +0000262B C74406E7FF mov word [si+0x6],0xffe7 lemm->y_spr_offset = -25; +00002630 C74404F0FF mov word [si+0x4],0xfff0 lemm->x_spr_offset = -16; 00002635 C6442900 mov byte [si+0x29],0x0 lemm->draw_hint = 0; 00002639 A13900 mov ax,[0x39] // 0000263C 894414 mov [si+0x14],ax lemm->ptr2 = *[0x39]; # 0000263F C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; 00002643 C644220F mov byte [si+0x22],0xf # -00002647 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00002647 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 0000264B 803E0820FF cmp byte [0x2008],0xff if ( [0x2008] == 0xff && [0x20ff] != 0x3) { 00002650 750C jnz 0x265e // 00002652 F606FF2003 test byte [0x20ff],0x3 // @@ -4062,7 +4087,6 @@ lbl_exploding: 00002665 C6442200 mov byte [si+0x22],0x0 // 00002669 E995F2 jmp word 0x1901 goto next_lemming; } -lbl_exploding2: 0000266C 3C05 cmp al,0x5 if ( al != 5 || nuke_all_in_progress != TRUE ) { nop(); } // WTF 0000266E 7507 jnz 0x2677 // 00002670 803E4800FF cmp byte [0x48],0xff // @@ -4072,21 +4096,21 @@ lbl_exploding2: 0000267D 268A05 mov al,[es:di] 00002680 22C4 and al,ah 00002682 7403 jz 0x2687 -00002684 E965F3 jmp word 0x19ec +00002684 E965F3 jmp word 0x19ec goto walker_check_fall_out_of_screen; 00002687 45 inc bp 00002688 033E0400 add di,[0x4] 0000268C 268A05 mov al,[es:di] 0000268F 22C4 and al,ah 00002691 7403 jz 0x2696 -00002693 E956F3 jmp word 0x19ec +00002693 E956F3 jmp word 0x19ec goto walker_check_fall_out_of_screen; 00002696 45 inc bp 00002697 033E0400 add di,[0x4] 0000269B 268A05 mov al,[es:di] 0000269E 22C4 and al,ah 000026A0 7403 jz 0x26a5 -000026A2 E947F3 jmp word 0x19ec +000026A2 E947F3 jmp word 0x19ec goto walker_check_fall_out_of_screen; 000026A5 45 inc bp -000026A6 E943F3 jmp word 0x19ec +000026A6 E943F3 jmp word 0x19ec goto walker_check_fall_out_of_screen; lbl_anim_but_no_move: 000026A9 8A4428 mov al,[si+0x28] lemm->spr_frame++; @@ -4108,7 +4132,7 @@ lbl_anim_but_no_move: 000026E3 A12B00 mov ax,[0x2b] lemm->ptr2 = [0x2b]; 000026E6 894414 mov [si+0x14],ax // 000026E9 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -000026ED 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +000026ED 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 000026F1 8064247F and byte [si+0x24],0x7f // (redundant) 000026F5 E906F2 jmp word 0x18fe goto check_this_and_go_next_lemming; } /* move_lemmings() */ @@ -4122,6 +4146,7 @@ lbl_anim_but_no_move: lemm->state.bits.s_drawning || lemm->state.bits.s_floating || lemm->state.bits.s_falling + ) ) { 00002704 7551 jnz 0x2757 // 00002706 814C080080 or word [si+0x8],0x8000 lemm->state.bits.s_exploding = 1; @@ -4136,7 +4161,7 @@ lbl_anim_but_no_move: 00002731 A12B00 mov ax,[0x2b] // 00002734 894414 mov [si+0x14],ax lemm->ptr2 = *[0x2b]; # 00002737 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -0000273B 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +0000273B 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 0000273F 803E0820FF cmp byte [0x2008],0xff if ( [0x2008] == 0xff && [0x20ff] != 0x3) { 00002744 750C jnz 0x2752 // 00002746 F606FF2003 test byte [0x20ff],0x3 // @@ -4156,14 +4181,14 @@ lbl_anim_but_no_move: 00002765 C744108002 mov word [si+0x10],0x280 # 0000276A C74412E001 mov word [si+0x12],0x1e0 # 0000276F C6442800 mov byte [si+0x28],0x0 lemm->spr_frame = 0; -00002773 C74406E7FF mov word [si+0x6],0xffe7 lemm->x_spr_offset = -25; -00002778 C74404F0FF mov word [si+0x4],0xfff0 lemm->y_spr_offset = -16; +00002773 C74406E7FF mov word [si+0x6],0xffe7 lemm->y_spr_offset = -25; +00002778 C74404F0FF mov word [si+0x4],0xfff0 lemm->x_spr_offset = -16; 0000277D C6442900 mov byte [si+0x29],0x0 lemm->draw_hint = 0; 00002781 A13900 mov ax,[0x39] // 00002784 894414 mov [si+0x14],ax lemm->ptr2 = *[0x39]; # 00002787 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; 0000278B C644220F mov byte [si+0x22],0xf # -0000278F 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +0000278F 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00002793 803E0820FF cmp byte [0x2008],0xff if ( [0x2008] == 0xff && [0x20ff] != 0x3) { 00002798 750C jnz 0x27a6 // 0000279A F606FF2003 test byte [0x20ff],0x3 // @@ -4247,13 +4272,13 @@ lbl_on_exit: 00002845 C744104E00 mov word [si+0x10],0x4e 0000284A C744123400 mov word [si+0x12],0x34 0000284F C6442800 mov byte [si+0x28],0x0 -00002853 C74404F8FF mov word [si+0x4],0xfff8 -00002858 C74406F3FF mov word [si+0x6],0xfff3 +00002853 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset=-8; +00002858 C74406F3FF mov word [si+0x6],0xfff3 lemm->y_spr_offset=-13; 0000285D C6442900 mov byte [si+0x29],0x0 00002861 A12F00 mov ax,[0x2f] 00002864 894414 mov [si+0x14],ax 00002867 C6442AFF mov byte [si+0x2a],0xff lemm->draw_trick1 = TRUE; -0000286B 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +0000286B 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 0000286F 803E0820FF cmp byte [0x2008],0xff 00002874 740C jz 0x2882 00002876 F606FF2001 test byte [0x20ff],0x1 @@ -4310,13 +4335,13 @@ lbl_on_exit: 00002905 C744105A00 mov word [si+0x10],0x5a 0000290A C744123C00 mov word [si+0x12],0x3c 0000290F C6442800 mov byte [si+0x28],0x0 -00002913 C74404F8FF mov word [si+0x4],0xfff8 -00002918 C74406F6FF mov word [si+0x6],0xfff6 +00002913 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset=-8; +00002918 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset=-10; 0000291D C6442900 mov byte [si+0x29],0x0 00002921 A12B00 mov ax,[0x2b] 00002924 894414 mov [si+0x14],ax 00002927 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -0000292B 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +0000292B 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 0000292F 803E0820FF cmp byte [0x2008],0xff 00002934 750C jnz 0x2942 00002936 F606FF2003 test byte [0x20ff],0x3 @@ -4333,13 +4358,13 @@ lbl_on_exit: 0000295C C744108C00 mov word [si+0x10],0x8c 00002961 C744127000 mov word [si+0x12],0x70 00002966 C6442800 mov byte [si+0x28],0x0 -0000296A C74404F8FF mov word [si+0x4],0xfff8 -0000296F C74406F2FF mov word [si+0x6],0xfff2 +0000296A C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset=-8; +0000296F C74406F2FF mov word [si+0x6],0xfff2 lemm->y_spr_offset=-14; 00002974 C6442900 mov byte [si+0x29],0x0 00002978 A13B00 mov ax,[0x3b] 0000297B 894414 mov [si+0x14],ax 0000297E C6442AFF mov byte [si+0x2a],0xff lemm->draw_trick1 = TRUE; -00002982 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00002982 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00002986 803E0820FF cmp byte [0x2008],0xff 0000298B 750C jnz 0x2999 0000298D F606FF2003 test byte [0x20ff],0x3 @@ -4386,7 +4411,7 @@ lbl_on_exit: 000029F4 894402 mov [si+0x2],ax // 000029F7 C6442701 mov byte [si+0x27],0x1 000029FB C6442500 mov byte [si+0x25],0x0 -000029FF 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +000029FF 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00002A03 834C0804 or word [si+0x8],byte +0x4 00002A07 C7440A0000 mov word [si+0xa],0x0 00002A0C C7440C420A mov word [si+0xc],0xa42 @@ -4394,13 +4419,13 @@ lbl_on_exit: 00002A16 C744123C00 mov word [si+0x12],0x3c 00002A1B C6442800 mov byte [si+0x28],0x0 00002A1F C6442303 mov byte [si+0x23],0x3 -00002A23 C74404F8FF mov word [si+0x4],0xfff8 -00002A28 C74406F6FF mov word [si+0x6],0xfff6 +00002A23 C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset=-8; +00002A28 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset=-10; 00002A2D C6442904 mov byte [si+0x29],0x4 00002A31 A12B00 mov ax,[0x2b] 00002A34 894414 mov [si+0x14],ax 00002A37 C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -00002A3B 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00002A3B 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00002A3F FE064000 inc byte [0x40] lemm_spawned_count++; 00002A43 C3 ret return; } @@ -4417,7 +4442,7 @@ lbl_on_exit: 00002A61 744C jz 0x2aaf } 00002A63 803E5E00FF cmp byte [0x5e],0xff if ( ![0x5e] ) return; 00002A68 7444 jz 0x2aae // -00002A6A C6065E00FF mov byte [0x5e],0xff [0x5e] = FALSE; +00002A6A C6065E00FF mov byte [0x5e],0xff [0x5e] = TRUE; 00002A6F 8B365500 mov si,[0x55] si = [0x55]; // Selected lemming ? 00002A73 A07F00 mov al,[0x7f] if ( [0x7f] < 2 ) return; 00002A76 3C02 cmp al,0x2 // @@ -4499,14 +4524,14 @@ lbl_apply_digger_no_check: 00002B31 C744107000 mov word [si+0x10],0x70 00002B36 C744125400 mov word [si+0x12],0x54 00002B3B C6442811 mov byte [si+0x28],0x11 -00002B3F C74404F8FF mov word [si+0x4],0xfff8 -00002B44 C74406F4FF mov word [si+0x6],0xfff4 +00002B3F C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset=-8; +00002B44 C74406F4FF mov word [si+0x6],0xfff4 lemm->y_spr_offset=-12; 00002B49 C6442900 mov byte [si+0x29],0x0 00002B4D A13500 mov ax,[0x35] 00002B50 894414 mov [si+0x14],ax 00002B53 C6441F08 mov byte [si+0x1f],0x8 00002B57 C6442AFF mov byte [si+0x2a],0xff lemm->draw_trick1 = TRUE; -00002B5B 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00002B5B 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00002B5F E974FF jmp word 0x2ad6 goto check_after_skill_apply; try_other_candidate_for_digger: @@ -4531,12 +4556,12 @@ try_other_candidate_for_digger: lbl_apply_climber: 00002B8C 803E670000 cmp byte [0x67],0x0 if ( sk_climber==0 ) return; 00002B91 7418 jz 0x2bab // -00002B93 F6442401 test byte [si+0x24],0x1 if ( lemm->flags1.cap_climber != 0 ) return; +00002B93 F6442401 test byte [si+0x24],0x1 if ( lemm->flags1.bits.cap_climber != 0 ) return; 00002B97 7512 jnz 0x2bab // 00002B99 F744080301 test word [si+0x8],0x103 if ( lemm->state & ( s_blocking | s_splatting | s_exploding_spe ) != 0 ) return; 00002B9E 750B jnz 0x2bab // 00002BA0 FE0E6700 dec byte [0x67] sk_climber--; -00002BA4 804C2401 or byte [si+0x24],0x1 lemm->flags1.cap_climber = 1; +00002BA4 804C2401 or byte [si+0x24],0x1 lemm->flags1.bits.cap_climber = 1; 00002BA8 E92BFF jmp word 0x2ad6 goto check_after_skill_apply; 00002BAB E94FFF jmp word 0x2afd // @@ -4565,7 +4590,7 @@ lbl_apply_builder: 00002BFF A13300 mov ax,[0x33] //??? 00002C02 C6442AFF mov byte [si+0x2a],0xff lemm->draw_trick1 = TRUE; 00002C06 894414 mov [si+0x14],ax lemm->ptr2=*[0x33]; -00002C09 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00002C09 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00002C0D E9C6FE jmp word 0x2ad6 goto check_after_skill_apply; 00002C10 E9EAFE jmp word 0x2afd // (return;) @@ -4683,12 +4708,12 @@ lbl_apply_blocker: 00002D2F C744105A00 mov word [si+0x10],0x5a 00002D34 C744123C00 mov word [si+0x12],0x3c 00002D39 C6442900 mov byte [si+0x29],0x0 -00002D3D C74404F8FF mov word [si+0x4],0xfff8 -00002D42 C74406F6FF mov word [si+0x6],0xfff6 +00002D3D C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +00002D42 C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 00002D47 A12B00 mov ax,[0x2b] 00002D4A 894414 mov [si+0x14],ax 00002D4D C6442A00 mov byte [si+0x2a],0x0 lemm->draw_trick1 = FALSE; -00002D51 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00002D51 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00002D55 56 push si 00002D56 1E push ds 00002D57 07 pop es @@ -4758,8 +4783,8 @@ lbl_apply_basher: 00002DEB C606780000 mov byte [0x78],0x0 sk_basher_tag=0; 00002DF0 8164086FF5 and word [si+0x8],0xf56f 00002DF5 814C080002 or word [si+0x8],0x200 lemm.state |= s_bashing; -00002DFA C74404F8FF mov word [si+0x4],0xfff8 -00002DFF C74406F6FF mov word [si+0x6],0xfff6 +00002DFA C74404F8FF mov word [si+0x4],0xfff8 lemm->x_spr_offset = -8; +00002DFF C74406F6FF mov word [si+0x6],0xfff6 lemm->y_spr_offset = -10; 00002E04 C6442800 mov byte [si+0x28],0x0 00002E08 C7440A0000 mov word [si+0xa],0x0 00002E0D C7440CCA07 mov word [si+0xc],0x7ca @@ -4769,7 +4794,7 @@ lbl_apply_basher: 00002E20 C6442AFF mov byte [si+0x2a],0xff lemm->draw_trick1 = TRUE; 00002E24 A13100 mov ax,[0x31] 00002E27 894414 mov [si+0x14],ax -00002E2A 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00002E2A 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00002E2E E9A5FC jmp word 0x2ad6 goto check_after_skill_apply; 00002E31 E9C9FC jmp word 0x2afd // (return;) @@ -4832,8 +4857,8 @@ lbl_apply_miner_no_check: 00002EC2 C6067B0000 mov byte [0x7b],0x0 sk_miner_tag=0; 00002EC7 8164086FFD and word [si+0x8],0xfd6f lemm.state &= s_all & !s_bashing & !s_building & s_digging; 00002ECC 814C080008 or word [si+0x8],0x800 lemm.state |= s_mining; -00002ED1 C74404F8FF mov word [si+0x4],0xfff8 -00002ED6 C74406F3FF mov word [si+0x6],0xfff3 +00002ED1 C74404F8FF mov word [si+0x4],0xfff8 lemm->y_spr_offset = -8; +00002ED6 C74406F3FF mov word [si+0x6],0xfff3 lemm->y_spr_offset = -13; 00002EDB C6442800 mov byte [si+0x28],0x0 00002EDF C7440A0000 mov word [si+0xa],0x0 00002EE4 C7440C0A09 mov word [si+0xc],0x90a @@ -4843,7 +4868,7 @@ lbl_apply_miner_no_check: 00002EF7 A13300 mov ax,[0x33] 00002EFA 894414 mov [si+0x14],ax 00002EFD C6442AFF mov byte [si+0x2a],0xff lemm->draw_trick1 = TRUE; -00002F01 80642401 and byte [si+0x24],0x1 lemm->flags1.walk_pause_for_shruggling = 0; +00002F01 80642401 and byte [si+0x24],0x1 lemm->flags1.bits.walk_pause_for_shruggling = 0; 00002F05 FF4402 inc word [si+0x2] 00002F08 E9CBFB jmp word 0x2ad6 goto check_after_skill_apply; @@ -5519,7 +5544,7 @@ try_other_candidate_for_mining: 0000361B 7E02 jng 0x361f 0000361D EB2D jmp short 0x364c 0000361F 50 push ax -00003620 F6442480 test byte [si+0x24],0x80 if ( ! lemm->flags1.walk_pause_for_shruggling && +00003620 F6442480 test byte [si+0x24],0x80 if ( ! lemm->flags1.bits.walk_pause_for_shruggling && 00003624 7507 jnz 0x362d ( lemm->state & (...) = 0 ) 00003626 F74408908B test word [si+0x8],0x8b90 ) { 0000362B 740E jz 0x363b goto 0x363b; @@ -5563,7 +5588,7 @@ try_other_candidate_for_mining: 00003699 E8840E call word 0x4520 0000369C 8B365500 mov si,[0x55] 000036A0 BB2E49 mov bx,0x492e -000036A3 8A4424 mov al,[si+0x24] if ( lemm->flags1.walk_pause_for_shruggling ) +000036A3 8A4424 mov al,[si+0x24] if ( lemm->flags1.bits.walk_pause_for_shruggling ) 000036A6 A880 test al,0x80 goto 0x36f9; 000036A8 754F jnz 0x36f9 // 000036AA BB1249 mov bx,0x4912 @@ -6479,7 +6504,7 @@ try_other_candidate_for_mining: 00003FBE 81FB3030 cmp bx,0x3030 00003FC2 7403 jz 0x3fc7 00003FC4 BE954C mov si,0x4c95 -00003FC7 E8AD06 call word 0x4677 +00003FC7 E8AD06 call word 0x4677 unk_010(); 00003FCA A03D00 mov al,[0x3d] 00003FCD 3A063E00 cmp al,[0x3e] 00003FD1 7D02 jnl 0x3fd5 @@ -7182,22 +7207,26 @@ try_other_candidate_for_mining: 00004672 BB9F20 mov bx,0x209f 00004675 D7 xlatb 00004676 C3 ret -00004677 AC lodsb -00004678 22C0 and al,al -0000467A 7425 jz 0x46a1 -0000467C 8AC8 mov cl,al -0000467E FEC9 dec cl -00004680 AC lodsb -00004681 8AE8 mov ch,al -00004683 AC lodsb -00004684 22C0 and al,al -00004686 7505 jnz 0x468d -00004688 BD0200 mov bp,0x2 -0000468B EB02 jmp short 0x468f -0000468D 33ED xor bp,bp -0000468F AC lodsb -00004690 3C0D cmp al,0xd -00004692 74E3 jz 0x4677 + void unk_010() { + do { +00004677 AC lodsb al = [ds:si++]; +00004678 22C0 and al,al if ( al == 0 ) return; +0000467A 7425 jz 0x46a1 // +0000467C 8AC8 mov cl,al cl = al -1; +0000467E FEC9 dec cl // +00004680 AC lodsb al = [ds:si++]; +00004681 8AE8 mov ch,al ch = al; +00004683 AC lodsb al = [ds:si++]; +00004684 22C0 and al,al if ( al == 0 ) { +00004686 7505 jnz 0x468d // +00004688 BD0200 mov bp,0x2 bp = 2; +0000468B EB02 jmp short 0x468f // + } else { +0000468D 33ED xor bp,bp bp = 0; + } +0000468F AC lodsb al = [ds:si++]; +00004690 3C0D cmp al,0xd // +00004692 74E3 jz 0x4677 } while ( al == 0xd ); 00004694 51 push cx 00004695 53 push bx 00004696 56 push si @@ -7207,7 +7236,10 @@ try_other_candidate_for_mining: 0000469C 59 pop cx 0000469D FEC1 inc cl 0000469F EBEE jmp short 0x468f + } + 000046A1 C3 ret + 000046A2 A06F1F mov al,[0x1f6f] 000046A5 3C02 cmp al,0x2 000046A7 7509 jnz 0x46b2 @@ -7764,6 +7796,7 @@ try_other_candidate_for_mining: 00004B72 58 pop ax 00004B73 1F pop ds 00004B74 CF iretw + 00004B75 50 push ax 00004B76 FA cli 00004B77 E80500 call word 0x4b7f @@ -7820,6 +7853,7 @@ try_other_candidate_for_mining: 00004BD3 1F pop ds 00004BD4 58 pop ax 00004BD5 CF iretw + 00004BD6 50 push ax 00004BD7 53 push bx 00004BD8 51 push cx @@ -7853,6 +7887,7 @@ try_other_candidate_for_mining: 00004C09 5B pop bx 00004C0A 58 pop ax 00004C0B CF iretw + 00004C0C FE061A00 inc byte [0x1a] 00004C10 A01A00 mov al,[0x1a] 00004C13 2401 and al,0x1 @@ -8619,7 +8654,7 @@ try_other_candidate_for_mining: 00005274 C7060400D000 mov word [0x4],0xd0 [0x4] = LEVEL_WIDTH/8; 0000527A C3 ret } - function vga_mem_read_prepare_registers() { + void vga_mem_read_prepare_registers() { 0000527B B800A0 mov ax,0xa000 es = video_mem_base; 0000527E 8EC0 mov es,ax // 00005280 8B7C02 mov di,[si+0x2] di = lemm.y_effective - 16; @@ -11010,7 +11045,7 @@ try_other_candidate_for_mining: 0000655B 7403 jz 0x6560 0000655D 024529 add al,[di+0x29] 00006560 32E4 xor ah,ah -00006562 807D2AFF cmp byte [di+0x2a],0xff if ( [di+0x2a] == FALSE ) ax = 8*ax+bx; +00006562 807D2AFF cmp byte [di+0x2a],0xff if ( [di+0x2a] != TRUE ) ax = 8*ax+bx; 00006566 7408 jz 0x6570 // 00006568 D1E0 shl ax,1 // 0000656A D1E0 shl ax,1 // @@ -12424,7 +12459,7 @@ try_other_candidate_for_mining: 0000709C 8B7417 mov si,[si+0x17] 0000709F 03FE add di,si 000070A1 B504 mov ch,0x4 -000070A3 9A2700330A call word 0xa33:0x27 // equiv to 0x208 + 0x82d7 +000070A3 9A2700330A call word 0xa33:0x27 lib_unk011(bp); // far 000070A8 5E pop si 000070A9 5F pop di 000070AA 59 pop cx @@ -13310,38 +13345,40 @@ try_other_candidate_for_mining: 00007872 EF out dx,ax 00007873 FB sti 00007874 C3 ret -00007875 3C20 cmp al,0x20 -00007877 7445 jz 0x78be -00007879 2C21 sub al,0x21 -0000787B 32E4 xor ah,ah -0000787D 03C0 add ax,ax -0000787F 03C0 add ax,ax -00007881 03C0 add ax,ax -00007883 03C0 add ax,ax -00007885 03C0 add ax,ax -00007887 8BF0 mov si,ax -00007889 03C0 add ax,ax -0000788B 03F0 add si,ax -0000788D 81C68C5F add si,0x5f8c -00007891 8BFE mov di,si -00007893 83C740 add di,byte +0x40 -00007896 8B1EEA1F mov bx,[0x1fea] -0000789A 81C30010 add bx,0x1000 -0000789E 891EE01F mov [0x1fe0],bx -000078A2 8ADD mov bl,ch -000078A4 32FF xor bh,bh -000078A6 8AC1 mov al,cl -000078A8 32E4 xor ah,ah -000078AA B104 mov cl,0x4 -000078AC D3E3 shl bx,cl -000078AE D3E0 shl ax,cl -000078B0 B110 mov cl,0x10 -000078B2 B503 mov ch,0x3 -000078B4 BA1000 mov dx,0x10 -000078B7 55 push bp -000078B8 9A2700330A call word 0xa33:0x27 + +00007875 3C20 cmp al,0x20 if ( al == 0x20 ) return; +00007877 7445 jz 0x78be // +00007879 2C21 sub al,0x21 // +0000787B 32E4 xor ah,ah // +0000787D 03C0 add ax,ax // +0000787F 03C0 add ax,ax // +00007881 03C0 add ax,ax // +00007883 03C0 add ax,ax // +00007885 03C0 add ax,ax // +00007887 8BF0 mov si,ax // +00007889 03C0 add ax,ax // +0000788B 03F0 add si,ax // +0000788D 81C68C5F add si,0x5f8c si = 0x5f8c + (al-0x21)*0x12; +00007891 8BFE mov di,si di = si + 0x40; +00007893 83C740 add di,byte +0x40 // +00007896 8B1EEA1F mov bx,[0x1fea] // +0000789A 81C30010 add bx,0x1000 // +0000789E 891EE01F mov [0x1fe0],bx [0x1fe0] = [0x1fea] + 0x1000; +000078A2 8ADD mov bl,ch bx = ch * 16; +000078A4 32FF xor bh,bh // +000078A6 8AC1 mov al,cl ax = cl * 16; +000078A8 32E4 xor ah,ah // +000078AA B104 mov cl,0x4 // +000078AC D3E3 shl bx,cl // +000078AE D3E0 shl ax,cl // +000078B0 B110 mov cl,0x10 cx = 0x0310; +000078B2 B503 mov ch,0x3 // +000078B4 BA1000 mov dx,0x10 dx = 0x10; +000078B7 55 push bp +000078B8 9A2700330A call word 0xa33:0x27 lib_unk011(bp); 000078BD 5D pop bp 000078BE C3 ret + 000078BF BAC403 mov dx,0x3c4 000078C2 B8020F mov ax,0xf02 000078C5 36A30800 mov [ss:0x8],ax @@ -13587,13 +13624,15 @@ try_other_candidate_for_mining: 00007B1E E85A03 call word 0x7e7b 00007B21 75ED jnz 0x7b10 00007B23 C3 ret + + 00007B24 C3 ret void nop() { 00007B25 C3 ret } - void ???() { /* From mainloop() */ + void video_flip() { 00007B26 A1751F mov ax,[0x1f75] 00007B29 8706731F xchg ax,[0x1f73] 00007B2D A3751F mov [0x1f75],ax @@ -13630,7 +13669,7 @@ try_other_candidate_for_mining: 00007B7D EC in al,dx 00007B7E A808 test al,0x8 00007B80 74FB jz 0x7b7d - void video_flip() { + 00007B82 E855D1 call word 0x4cda _video_flip(); 00007B85 C3 ret } @@ -13709,6 +13748,7 @@ try_other_candidate_for_mining: 00007C54 58 pop ax 00007C55 1F pop ds 00007C56 CF iretw + 00007C57 813E791FFF00 cmp word [0x1f79],0xff 00007C5D 7529 jnz 0x7c88 00007C5F BB3623 mov bx,0x2336 @@ -14509,28 +14549,29 @@ try_other_candidate_for_mining: 000082D1 F7E3 mul bx 000082D3 A30669 mov [0x6906],ax 000082D6 CB retf - + void lib_unk011(bp) { 000082D7 50 push ax 000082D8 52 push dx 000082D9 51 push cx -000082DA 8BC2 mov ax,dx -000082DC D1E8 shr ax,1 -000082DE D1E8 shr ax,1 -000082E0 D1E8 shr ax,1 -000082E2 A30A69 mov [0x690a],ax -000082E5 32ED xor ch,ch -000082E7 F7E1 mul cx -000082E9 A30869 mov [0x6908],ax -000082EC 59 pop cx -000082ED 5A pop dx -000082EE 58 pop ax -000082EF C7060E690000 mov word [0x690e],0x0 -000082F5 C7060C690000 mov word [0x690c],0x0 -000082FB F7C50C00 test bp,0xc -000082FF 7407 jz 0x8308 -00008301 E89A10 call word 0x939e -00008304 23C0 and ax,ax -00008306 7859 js 0x8361 +000082DA 8BC2 mov ax,dx // +000082DC D1E8 shr ax,1 // +000082DE D1E8 shr ax,1 // +000082E0 D1E8 shr ax,1 // +000082E2 A30A69 mov [0x690a],ax [0x690a] = dx / 8; +000082E5 32ED xor ch,ch // +000082E7 F7E1 mul cx [0x6908] = cx * ( dx / 8 ); +000082E9 A30869 mov [0x6908],ax // +000082EC 59 pop cx // +000082ED 5A pop dx // +000082EE 58 pop ax // +000082EF C7060E690000 mov word [0x690e],0x0 [0x690e] = 0x0000; +000082F5 C7060C690000 mov word [0x690c],0x0 [0x690c] = 0x0000; +000082FB F7C50C00 test bp,0xc if ( bp != 0xc ) { +000082FF 7407 jz 0x8308 // +00008301 E89A10 call word 0x939e ???(); +00008304 23C0 and ax,ax +00008306 7859 js 0x8361 if( ax >= 0x8000) return; //far + } 00008308 2E803E4712FF cmp byte [cs:0x1247],0xff 0000830E 7503 jnz 0x8313 00008310 E83811 call word 0x944b @@ -14566,7 +14607,8 @@ try_other_candidate_for_mining: 0000835A E9790A jmp word 0x8dd6 0000835D 7402 jz 0x8361 0000835F EB01 jmp short 0x8362 -00008361 CB retf +00008361 CB retf return; // far + 00008362 803E58AB00 cmp byte [0xab58],0x0 00008367 7503 jnz 0x836c 00008369 E96A0A jmp word 0x8dd6 @@ -16799,6 +16841,7 @@ try_other_candidate_for_mining: 00009445 8A2E59AB mov ch,[0xab59] 00009449 5D pop bp 0000944A C3 ret + 0000944B 56 push si 0000944C 57 push di 0000944D 55 push bp @@ -16842,18 +16885,22 @@ try_other_candidate_for_mining: 000094A4 D1EA shr dx,1 000094A6 D1EA shr dx,1 000094A8 B001 mov al,0x1 + 000094AA 52 push dx 000094AB 56 push si + 000094AC 368804 mov [ss:si],al 000094AF 46 inc si 000094B0 4A dec dx 000094B1 75F9 jnz 0x94ac + 000094B3 5E pop si 000094B4 5A pop dx 000094B5 83C628 add si,byte +0x28 000094B8 3BF5 cmp si,bp 000094BA 7302 jnc 0x94be 000094BC E2EC loop 0x94aa + 000094BE 5A pop dx 000094BF 59 pop cx 000094C0 5B pop bx @@ -16862,6 +16909,7 @@ try_other_candidate_for_mining: 000094C3 5F pop di 000094C4 5E pop si 000094C5 C3 ret + 000094C6 0000 add [bx+si],al 000094C8 0000 add [bx+si],al 000094CA 0000 add [bx+si],al @@ -23276,6 +23324,7 @@ try_other_candidate_for_mining: 0000C269 1E push ds 0000C26A D508 aad 0x8 0000C26C CF iretw + 0000C26D EE out dx,al 0000C26E D6 salc 0000C26F FB sti @@ -23457,6 +23506,7 @@ try_other_candidate_for_mining: 0000C3AC C8EBD1FA enter 0xd1eb,0xfa 0000C3B0 D21C rcr byte [si],cl 0000C3B2 CF iretw + 0000C3B3 FF db 0xff 0000C3B4 D9E8 fld1 0000C3B6 DE db 0xde @@ -25093,7 +25143,9 @@ try_other_candidate_for_mining: 0000D169 6D insw 0000D16A BC25AC mov sp,0xac25 0000D16D CF iretw + 0000D16E CF iretw + 0000D16F E8C54B call word 0x1d37 0000D172 C5 db 0xc5 0000D173 FA cli @@ -25417,6 +25469,7 @@ try_other_candidate_for_mining: 0000D421 263E3A4A0C cmp cl,[ds:bp+si+0xc] 0000D426 51 push cx 0000D427 CF iretw + 0000D428 51 push cx 0000D429 0C44 or al,0x44 0000D42B 3B47FE cmp ax,[bx-0x2] @@ -26526,7 +26579,7 @@ try_other_candidate_for_mining: 0000DF62 2020 and [bx+si],ah 0000DF64 2020 and [bx+si],ah 0000DF66 2020 and [bx+si],ah -0000DF68 20416E and [bx+di+0x6e],al +0000DF68 20416E and [bx+di+0x6e],al // THIS is TEXT !!! "Animation" 0000DF6B 696D617469 imul bp,[di+0x61],word 0x6974 0000DF70 6F outsw 0000DF71 6E outsb -- cgit v1.2.3