diff --git a/th02/math/randring[bss].asm b/th02/math/randring[bss].asm new file mode 100644 index 00000000..54a67e59 --- /dev/null +++ b/th02/math/randring[bss].asm @@ -0,0 +1,15 @@ +; Ring buffer of random numbers. + +RANDRING_SIZE = 256 + +; TH05 wants it publicly... +public _randring +public _randring_p + +_randring db RANDRING_SIZE dup (?) +if GAME ge 4 + _randring_p dw ? +else + _randring_p db ? + db ? +endif diff --git a/th02/math/randring_fill.asm b/th02/math/randring_fill.asm new file mode 100644 index 00000000..6316fcfd --- /dev/null +++ b/th02/math/randring_fill.asm @@ -0,0 +1,18 @@ +; void randring_fill(void) +public _randring_fill +_randring_fill proc near + push bp + mov bp, sp + push si + xor si, si + +@@loop: + call IRand + mov _randring[si], al + inc si + cmp si, RANDRING_SIZE + jl short @@loop + pop si + pop bp + ret +_randring_fill endp diff --git a/th02/math/randring_next.inc b/th02/math/randring_next.inc new file mode 100644 index 00000000..ed8bdaff --- /dev/null +++ b/th02/math/randring_next.inc @@ -0,0 +1,37 @@ +RANDRING_NEXT_DEF macro instance + ; void randring_next8(void) + public _randring&instance&_next8 + _randring&instance&_next8 proc near + mov bl, _randring_p + inc _randring_p + mov bh, 0 + mov al, _randring[bx] + ret + _randring&instance&_next8 endp + + ; void randring_next8_and(unsigned char mask) + public _randring&instance&_next8_and + _randring&instance&_next8_and proc near + arg @@mask:byte + + push bp + mov bp, sp + mov bl, _randring_p + inc _randring_p + mov bh, 0 + mov al, _randring[bx] + and al, @@mask + pop bp + ret 2 + _randring&instance&_next8_and endp + + ; void randring_next16(void) + public _randring&instance&_next16 + _randring&instance&_next16 proc near + mov bl, _randring_p + inc _randring_p + mov bh, 0 + mov ax, word ptr _randring[bx] + ret + _randring&instance&_next16 endp +endm diff --git a/th02/th02.asm b/th02/th02.asm index d177daf0..6b135022 100644 --- a/th02/th02.asm +++ b/th02/th02.asm @@ -1,6 +1,7 @@ GAME = 2 include defconv_c.inc include th02/hardware/input.inc +include th02/math/randring_next.inc kajacall macro func, param := <0> call _snd_kaja_interrupt pascal, (func shl 8) or (param and 0ffh) diff --git a/th02_main.asm b/th02_main.asm index e40a3a01..1303270a 100644 --- a/th02_main.asm +++ b/th02_main.asm @@ -2229,7 +2229,7 @@ var_C = byte ptr -0Ch call _snd_se_reset call sub_1028C nopcall sub_CA1C - call sub_C224 + call _randring_fill mov PaletteTone, 64h ; 'd' call far ptr palette_show mov ax, 0D0h @@ -3390,72 +3390,8 @@ loc_C222: retf sub_C1E4 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_C224 proc near - push bp - mov bp, sp - push si - xor si, si - -loc_C22A: - call IRand - mov [si+26FAh], al - inc si - cmp si, 100h - jl short loc_C22A - pop si - pop bp - retn -sub_C224 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_C23D proc near - mov bl, byte_2026A - inc byte_2026A - mov bh, 0 - mov al, [bx+26FAh] - retn -sub_C23D endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_C24C proc near - -arg_0 = byte ptr 4 - - push bp - mov bp, sp - mov bl, byte_2026A - inc byte_2026A - mov bh, 0 - mov al, [bx+26FAh] - and al, [bp+arg_0] - pop bp - retn 2 -sub_C24C endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_C264 proc near - mov bl, byte_2026A - inc byte_2026A - mov bh, 0 - mov ax, [bx+26FAh] - retn -sub_C264 endp - +include th02/math/randring_fill.asm +RANDRING_NEXT_DEF 1 ; =============== S U B R O U T I N E ======================================= @@ -4517,7 +4453,7 @@ loc_CB78: loc_CB83: push 8 push 3 - call sub_C24C + call _randring1_next8_and add al, 0BEh push ax call sub_CA62 @@ -4532,7 +4468,7 @@ loc_CB93: loc_CB9D: push [bp+var_2] push 7 - call sub_C24C + call _randring1_next8_and add al, 0BCh push ax @@ -4605,7 +4541,7 @@ loc_CBFD: loc_CC09: push 1Fh - call sub_C24C + call _randring1_next8_and mov ah, 0 add ax, 0B1h mov [bp+var_2], ax @@ -4834,7 +4770,7 @@ loc_CD81: loc_CD8C: push 8 push 3 - call sub_C24C + call _randring1_next8_and add al, 0BEh jmp short loc_CDA0 ; --------------------------------------------------------------------------- @@ -4842,7 +4778,7 @@ loc_CD8C: loc_CD97: push 8 push 7 - call sub_C24C + call _randring1_next8_and add al, 0BCh loc_CDA0: @@ -4863,7 +4799,7 @@ loc_CDAF: loc_CDB1: push 7 - call sub_C24C + call _randring1_next8_and add al, 0BCh push ax call sub_CA62 @@ -4950,7 +4886,7 @@ loc_CE29: loc_CE30: push 1Fh - call sub_C24C + call _randring1_next8_and mov ah, 0 add ax, 0B1h mov [bp+var_2], ax @@ -4994,7 +4930,7 @@ loc_CE5B: call iatan2 mov [bp+var_2], ax push 7 - call sub_C24C + call _randring1_next8_and mov ah, 0 add ax, 0FFFDh add [bp+var_2], ax @@ -5025,7 +4961,7 @@ loc_CE9F: call iatan2 mov [bp+var_2], ax push 7 - call sub_C24C + call _randring1_next8_and mov ah, 0 add ax, 0FFFDh add [bp+var_2], ax @@ -5325,7 +5261,7 @@ loc_D0D2: loc_D0DD: push 8 push 3 - call sub_C24C + call _randring1_next8_and add al, 0BEh jmp short loc_D0F1 ; --------------------------------------------------------------------------- @@ -5333,7 +5269,7 @@ loc_D0DD: loc_D0E8: push 8 push 7 - call sub_C24C + call _randring1_next8_and add al, 0BCh loc_D0F1: @@ -6089,7 +6025,7 @@ sub_D629 proc near mov bp, sp push si push 7 - call sub_C24C + call _randring1_next8_and mov byte_218A0, al xor si, si jmp short loc_D644 @@ -6147,7 +6083,7 @@ loc_D67B: idiv bx or dx, dx jnz short loc_D6C4 - call sub_C264 + call _randring1_next16 and ax, 1FFh cmp ax, 12h jnz short loc_D69F @@ -6341,7 +6277,7 @@ loc_D7B4: jnz short loc_D82B cmp [bp+var_4], 0 jz short loc_D810 - call sub_C23D + call _randring1_next8 mov ah, 0 mov bx, 5 sub bx, di @@ -6354,7 +6290,7 @@ loc_D7B4: ; --------------------------------------------------------------------------- loc_D7FE: - call sub_C23D + call _randring1_next8 mov ah, 0 mov bx, 2 cwd @@ -6367,7 +6303,7 @@ loc_D80B: ; --------------------------------------------------------------------------- loc_D810: - call sub_C23D + call _randring1_next8 mov ah, 0 mov bx, 2 cwd @@ -7976,7 +7912,7 @@ sub_E512 proc near ; --------------------------------------------------------------------------- loc_E525: - call sub_C264 + call _randring1_next16 mov bx, 180h xor dx, dx div bx @@ -7985,7 +7921,7 @@ loc_E525: add bx, si shl bx, 2 mov [bx+3F5Ch], dx - call sub_C264 + call _randring1_next16 mov bx, 170h xor dx, dx div bx @@ -9772,49 +9708,7 @@ main_03_TEXT segment byte public 'CODE' use16 ;org 6 assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing -; =============== S U B R O U T I N E ======================================= - - -sub_FAC6 proc near - mov bl, byte_2026A - inc byte_2026A - mov bh, 0 - mov al, [bx+26FAh] - retn -sub_FAC6 endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_FAD5 proc near - -arg_0 = byte ptr 4 - - push bp - mov bp, sp - mov bl, byte_2026A - inc byte_2026A - mov bh, 0 - mov al, [bx+26FAh] - and al, [bp+arg_0] - pop bp - retn 2 -sub_FAD5 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_FAED proc near - mov bl, byte_2026A - inc byte_2026A - mov bh, 0 - mov ax, [bx+26FAh] - retn -sub_FAED endp - +RANDRING_NEXT_DEF 2 ; =============== S U B R O U T I N E ======================================= @@ -11101,7 +10995,7 @@ loc_10613: ; --------------------------------------------------------------------------- loc_10618: - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov [bp+var_2], ax mov di, 1 @@ -11109,7 +11003,7 @@ loc_10618: ; --------------------------------------------------------------------------- loc_10625: - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov [bp+var_2], ax mov al, [si+10h] @@ -11121,11 +11015,11 @@ loc_10625: ; --------------------------------------------------------------------------- loc_1063C: - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov [bp+var_2], ax push 1Fh - call sub_FAD5 + call _randring2_next8_and mov ah, 0 add [bp+arg_0], ax mov al, [si+10h] @@ -13499,7 +13393,7 @@ loc_11975: push word_22D98 push word_22D9A push 0Fh - call sub_FAD5 + call _randring2_next8_and add al, 0F9h push ax push 19h @@ -13922,7 +13816,7 @@ var_1 = byte ptr -1 call iatan2 mov [bp+var_1], al push 1Fh - call sub_FAD5 + call _randring2_next8_and add al, 10h loc_11CC4: @@ -14073,7 +13967,7 @@ loc_11E0A: mov bx, si add bx, bx push word ptr [bx+531Eh] - call sub_FAC6 + call _randring2_next8 push ax push 83h push 520020h @@ -14107,7 +14001,7 @@ sub_11E40 proc near jnz short loc_11E66 push word_22D98 push word_22D9A - call sub_FAC6 + call _randring2_next8 push ax push word_20670+1 mov ax, word_20650 @@ -14147,7 +14041,7 @@ sub_11E76 proc near or dx, dx jnz short loc_11EBE mov byte_23A70, 1Eh - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov bx, 18h cwd @@ -14190,7 +14084,7 @@ loc_11EE5: ; --------------------------------------------------------------------------- loc_11EFC: - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov bx, 18h cwd @@ -17125,7 +17019,7 @@ loc_134CD: mov es:[bx+4], di mov es:[bx+8], ax push 3 - call sub_FAD5 + call _randring2_next8_and mov ah, 0 add ax, 3 les bx, [bp+var_4] @@ -17408,7 +17302,7 @@ loc_13739: add ax, 3EAh cmp ax, word_1ED94 jge short loc_13771 - call sub_FAED + call _randring2_next16 mov bx, 280h xor dx, dx div bx @@ -18456,7 +18350,7 @@ loc_14083: jnz short loc_140AC mov PaletteTone, 64h ; 'd' call far ptr palette_show - call sub_FAED + call _randring2_next16 and ax, 3FFh add ax, 14h add word_250E4, ax @@ -18486,7 +18380,7 @@ loc_140D4: inc word_1EDA2 test byte ptr word_1EDA2, 1 jnz short loc_140F2 - call sub_FAED + call _randring2_next16 mov bx, 280h xor dx, dx div bx @@ -20119,7 +20013,7 @@ loc_14ED8: mov ax, [bx] add ax, 18h push ax - call sub_FAC6 + call _randring2_next8 push ax push 87h mov ax, si @@ -20219,13 +20113,13 @@ loc_14F8F: loc_14FAE: cmp di, 3 jl short loc_14F8F - call sub_FAED + call _randring2_next16 mov bx, 140h xor dx, dx div bx add dx, 20h ; ' ' mov word_252F0, dx - call sub_FAC6 + call _randring2_next8 mov ah, 0 add ax, 10h mov word_252F2, ax @@ -20292,7 +20186,7 @@ loc_1505F: mov ax, [bx] add ax, 18h push ax - call sub_FAC6 + call _randring2_next8 push ax push 87h lea ax, [di+7Ah] @@ -21862,7 +21756,7 @@ loc_15DD7: loc_15DF2: push 7Fh - call sub_FAD5 + call _randring2_next8_and mov ah, 0 add ax, word_254E6 push ax @@ -21872,7 +21766,7 @@ loc_15DF2: push 40h push 20h ; ' ' push 1Fh - call sub_FAD5 + call _randring2_next8_and mov ah, 0 add ax, 1Eh push ax @@ -21884,7 +21778,7 @@ loc_15E19: cmp word_20650, 1B8h jge short loc_15E7B inc byte_25596 - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov dl, byte_25596 mov dh, 0 @@ -21905,7 +21799,7 @@ loc_15E19: loc_15E4D: push 7Fh - call sub_FAD5 + call _randring2_next8_and mov ah, 0 add ax, word_254E6 push ax @@ -21915,7 +21809,7 @@ loc_15E4D: push word ptr [bp+var_1] push 20h ; ' ' push 1Fh - call sub_FAD5 + call _randring2_next8_and mov ah, 0 add ax, 1Eh push ax @@ -22082,7 +21976,7 @@ sub_15F6F proc near jnz short loc_15F93 push word_253B6 push word_253B8 - call sub_FAC6 + call _randring2_next8 push ax push 27h ; ''' push 55h ; 'U' @@ -22250,7 +22144,7 @@ loc_16122: jnz short loc_16172 push word_253B6 push word_253B8 - call sub_FAC6 + call _randring2_next8 push ax push 27h ; ''' push 50h ; 'P' @@ -22291,7 +22185,7 @@ sub_16176 proc near jnz short loc_1619A push word_253B6 push word_253B8 - call sub_FAC6 + call _randring2_next8 push ax push 25h ; '%' push 32h ; '2' @@ -22681,7 +22575,7 @@ loc_1652F: loc_16540: push word_253B6 push word_253B8 - call sub_FAC6 + call _randring2_next8 push ax push 25h ; '%' push 3Ch ; '<' @@ -22726,7 +22620,7 @@ loc_16589: jnz short loc_165A3 push word_253B6 push word_253B8 - call sub_FAC6 + call _randring2_next8 push ax push 27h ; ''' push 3Ch ; '<' @@ -22909,7 +22803,7 @@ loc_166BE: jnz short loc_166DC push word_253B6 push word_253B8 - call sub_FAC6 + call _randring2_next8 push ax push 25h ; '%' push 3Ch ; '<' @@ -23615,7 +23509,7 @@ arg_6 = word ptr 0Ah mov bx, [bp+arg_2] imul bx, 26h mov word ptr [bx+7B5Ah], 0 - call sub_FAC6 + call _randring2_next8 mov bx, [bp+arg_2] imul bx, 26h mov [bx+7B5Fh], al @@ -23876,7 +23770,7 @@ loc_16F0F: ; --------------------------------------------------------------------------- loc_16F19: - call sub_FAC6 + call _randring2_next8 mov [bp+var_3], al mov al, [bp+var_7] mov ah, 0 @@ -24032,7 +23926,7 @@ loc_17025: ; --------------------------------------------------------------------------- loc_1705E: - call sub_FAED + call _randring2_next16 mov dl, [bp+var_7] mov dh, 0 add dx, word_26C44 @@ -24083,7 +23977,7 @@ loc_170C1: ; --------------------------------------------------------------------------- loc_170CF: - call sub_FAED + call _randring2_next16 mov dl, [bp+var_7] mov dh, 0 add dx, word_26C44 @@ -25969,7 +25863,7 @@ loc_18170: push word_26C58 push word_26C60 push 0Fh - call sub_FAD5 + call _randring2_next8_and add al, 38h ; '8' push ax push word_2066E @@ -26118,7 +26012,7 @@ loc_182DD: mov [bx], dx call grcg_setcolor pascal, (GC_RMW shl 16) + 13 push 7Fh - call sub_FAD5 + call _randring2_next8_and mov [bp+var_1], al mov ah, 0 mov bx, word_2065C @@ -26784,7 +26678,7 @@ loc_1895D: jnz short loc_18985 call _snd_se_play c, 10 mov word_2064E, 86h - call sub_FAC6 + call _randring2_next8 mov byte ptr word_26CDA, al jmp short loc_189DC ; --------------------------------------------------------------------------- @@ -26963,7 +26857,7 @@ loc_18B0D: push word_26C5A push word_26C62 push 3Fh ; '?' - call sub_FAD5 + call _randring2_next8_and add al, 20h ; ' ' push ax push 20h ; ' ' @@ -26972,7 +26866,7 @@ loc_18B0D: push word_26C5A push word_26C62 push 3Fh ; '?' - call sub_FAD5 + call _randring2_next8_and add al, 20h ; ' ' push ax push 20h ; ' ' @@ -27397,7 +27291,7 @@ var_3 = word ptr -3 add ax, 50h ; 'P' mov word_26CE8, ax mov word_26CEA, 4 - call sub_FAC6 + call _randring2_next8 mov byte_26CEC, al jmp loc_19169 ; --------------------------------------------------------------------------- @@ -27927,7 +27821,7 @@ loc_1941F: ; --------------------------------------------------------------------------- loc_19430: - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov bx, 3 cwd @@ -28073,7 +27967,7 @@ loc_1953B: mov byte_26CFA, 0 mov word_26C68, 1 mov word_20650, 0 - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov bx, 3 cwd @@ -28149,7 +28043,7 @@ loc_195F8: jle loc_198A8 mov word_26C68, 3 mov word_20650, 0 - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov bx, 3 cwd @@ -28227,7 +28121,7 @@ loc_196A3: jle loc_198A8 mov word_26C68, 5 mov word_20650, 0 - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov bx, 3 cwd @@ -28308,7 +28202,7 @@ loc_19770: mov word_26C68, 7 mov word_20650, 0 push 7 - call sub_FAD5 + call _randring2_next8_and mov ah, 0 mov word_26C6A, ax mov word_26CBE, 0 @@ -28442,7 +28336,7 @@ loc_198A8: mov word_2064E, 80h mov word_26CBE, 0 mov word_20650, 0 - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov bx, 3 cwd @@ -29419,7 +29313,7 @@ loc_1A1D5: push ax push word_26D00 push 3Fh ; '?' - call sub_FAD5 + call _randring2_next8_and add al, 20h ; ' ' push ax push 20h ; ' ' @@ -29537,7 +29431,7 @@ loc_1A30A: mov ax, 0FFFFh imul word_26CFE mov word_26CFE, ax - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov bx, 5 cwd @@ -29608,7 +29502,7 @@ loc_1A3A3: mov ax, 0FFFFh imul word_26CFE mov word_26CFE, ax - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov bx, 5 cwd @@ -30367,7 +30261,7 @@ loc_1AB43: add bx, bx cmp word ptr [bx-6D4Eh], 6Eh ; 'n' jl short loc_1ABEE - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov bx, 50h ; 'P' cwd @@ -31276,7 +31170,7 @@ sub_1B35F proc near call sub_1B19D cmp word_20650, 32h ; '2' jnz short loc_1B39A - call sub_FAC6 + call _randring2_next8 mov byte ptr word_26D7F+1, al mov al, byte_1EEA4 mov ah, 0 @@ -31550,7 +31444,7 @@ loc_1B592: test byte ptr word_20650, 0Fh jnz short loc_1B654 push 3 - call sub_FAD5 + call _randring2_next8_and mov ah, 0 mov si, ax mov bx, si @@ -32119,7 +32013,7 @@ loc_1BAC5: push ax push 20h ; ' ' push 1Fh - call sub_FAD5 + call _randring2_next8_and mov ah, 0 add ax, 10h push ax @@ -32427,13 +32321,13 @@ loc_1BDBD: loc_1BDC4: push 7 - call sub_FAD5 + call _randring2_next8_and mov dl, byte_1EEA5 shl dl, 4 add al, dl add al, 40h mov byte ptr [bp+var_3], al - call sub_FAED + call _randring2_next16 mov bx, 170h xor dx, dx div bx @@ -32444,13 +32338,13 @@ loc_1BDC4: push 0FFh push 55h ; 'U' push 1Fh - call sub_FAD5 + call _randring2_next8_and mov ah, 0 add ax, 10h push ax call sub_10865 push si - call sub_FAED + call _randring2_next16 mov bx, 140h xor dx, dx div bx @@ -32460,7 +32354,7 @@ loc_1BDC4: push 0FFh push 55h ; 'U' push 1Fh - call sub_FAD5 + call _randring2_next8_and mov ah, 0 add ax, 10h push ax @@ -32547,7 +32441,7 @@ loc_1BEA6: ; --------------------------------------------------------------------------- loc_1BEB2: - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov bx, 3 cwd @@ -32629,7 +32523,7 @@ loc_1BF3A: jz short loc_1BF78 loc_1BF53: - call sub_FAED + call _randring2_next16 mov bx, 180h xor dx, dx div bx @@ -32794,7 +32688,7 @@ loc_1C086: ; --------------------------------------------------------------------------- loc_1C0A5: - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov bx, 5 cwd @@ -32827,7 +32721,7 @@ loc_1C0E4: loc_1C0F2: inc byte_26D4E - call sub_FAC6 + call _randring2_next8 mov ah, 0 mov bx, 3 cwd @@ -37037,72 +36931,7 @@ word_20164 dw ? word_20166 dw ? byte_20168 db ? byte_20169 db ? - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; -byte_2026A db ? - db ? +include th02/math/randring[bss].asm mikoconfig dd ? db ? ; db ? ; diff --git a/th03/math/randring_fill.asm b/th03/math/randring_fill.asm new file mode 100644 index 00000000..3d548b05 --- /dev/null +++ b/th03/math/randring_fill.asm @@ -0,0 +1,17 @@ +; void randring_fill(void) +public _randring_fill +_randring_fill proc near + push si + mov si, RANDRING_SIZE - 1 + +@@loop: + call IRand + mov _randring[si], al + dec si + jge short @@loop +if GAME ge 4 + mov _randring_p, 0 +endif + pop si + ret +_randring_fill endp diff --git a/th03/math/randring_next.inc b/th03/math/randring_next.inc new file mode 100644 index 00000000..2a7753dd --- /dev/null +++ b/th03/math/randring_next.inc @@ -0,0 +1,53 @@ +RANDRING_NEXT_DEF_NOMOD macro instance, dist + ; void randring_next16(void) + public _randring&instance&_next16 + _randring&instance&_next16 proc dist + xor bh, bh + mov bl, _randring_p + add bx, offset _randring + inc _randring_p + mov ax, [bx] + ret + _randring&instance&_next16 endp + nop + + ; void randring_next16_and(unsigned short mask) + public _randring&instance&_next16_and + _randring&instance&_next16_and proc dist + arg @@mask:word + + push bp + mov bp, sp + xor bh, bh + mov bl, _randring_p + add bx, offset _randring + inc _randring_p + mov ax, [bx] + and ax, @@mask + pop bp + ret 2 + _randring&instance&_next16_and endp +endm + +RANDRING_NEXT_DEF macro instance, dist + RANDRING_NEXT_DEF_NOMOD instance, dist + + ; void randring_next16_mod(unsigned short n) + public _randring&instance&_next16_mod + _randring&instance&_next16_mod proc dist + arg @@n:word + + push bp + mov bp, sp + xor bh, bh + mov bl, _randring_p + add bx, offset _randring + inc _randring_p + mov ax, [bx] + xor dx, dx + div @@n + mov ax, dx + pop bp + ret 2 + _randring&instance&_next16_mod endp +endm diff --git a/th03/th03.asm b/th03/th03.asm index 52d965a6..d156e6b6 100644 --- a/th03/th03.asm +++ b/th03/th03.asm @@ -1,2 +1,3 @@ GAME = 3 include defconv_pascal.inc +include th03/math/randring_next.inc diff --git a/th03_main.asm b/th03_main.asm index 5e05c410..14da9aba 100644 --- a/th03_main.asm +++ b/th03_main.asm @@ -614,7 +614,7 @@ loc_9A62: loc_9A94: test word_23AF6, 3FFh jnz short loc_9AB5 - call sub_A3FA + call _randring_fill cmp byte_23B79, 6 jnb short loc_9AAA inc byte_23B79 @@ -1106,7 +1106,7 @@ var_2 = word ptr -2 mov byte_1FBC3, 0 mov byte_1F520, 0 call sub_E313 - call sub_A3FA + call _randring_fill call sub_17384 xor di, di jmp short loc_9EFF @@ -1743,59 +1743,8 @@ loc_A3EB: retf 4 sub_A3D2 endp - -; =============== S U B R O U T I N E ======================================= - - -sub_A3FA proc near - push si - mov si, 0FFh - -loc_A3FE: - call IRand - mov [si+1E52h], al - dec si - jge short loc_A3FE - pop si - retn -sub_A3FA endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_A40C proc near - xor bh, bh - mov bl, byte_1F4B2 - add bx, 1E52h - inc byte_1F4B2 - mov ax, [bx] - retn -sub_A40C endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_A41E proc near - -arg_0 = word ptr 4 - - push bp - mov bp, sp - xor bh, bh - mov bl, byte_1F4B2 - add bx, 1E52h - inc byte_1F4B2 - mov ax, [bx] - and ax, [bp+arg_0] - pop bp - retn 2 -sub_A41E endp - +include th03/math/randring_fill.asm +RANDRING_NEXT_DEF_NOMOD 1, near ; =============== S U B R O U T I N E ======================================= @@ -3007,13 +2956,13 @@ loc_B752: mov ax, word_20E32 add ax, ax push ax - call sub_13A50 + call _randring_far_next16_mod add ax, word_20E2E mov di, ax mov ax, word_20E34 add ax, ax push ax - call sub_13A50 + call _randring_far_next16_mod add ax, word_20E30 mov [bp+arg_2], ax @@ -3663,11 +3612,11 @@ loc_BC1D: mov bx, word_20CE4 mov [bx], di push 1FFh - call sub_A41E + call _randring1_next16_and add ax, 0A80h mov bx, word_20CE4 mov [bx+2], ax - call sub_A40C + call _randring1_next16 mov bx, word_20CE4 mov [bx+6], al call IRand @@ -3699,11 +3648,11 @@ loc_BC7A: mov bx, word_20CE4 mov [bx], di push 1FFh - call sub_A41E + call _randring1_next16_and add ax, 0A80h mov bx, word_20CE4 mov [bx+2], ax - call sub_A40C + call _randring1_next16 mov bx, word_20CE4 mov [bx+6], al call IRand @@ -4768,7 +4717,7 @@ loc_C4E5: loc_C4E8: mov [bp+var_7], 0 - call sub_A40C + call _randring1_next16 mov bx, 3 xor dx, dx div bx @@ -4789,7 +4738,7 @@ loc_C505: inc [bp+var_7] cmp word ptr [si+18h], 500h ja short loc_C52B - call sub_A40C + call _randring1_next16 test al, 3 jnz short loc_C52B push si @@ -5131,7 +5080,7 @@ loc_C735: mov byte ptr [si+16h], 0 loc_C751: - call sub_A40C + call _randring1_next16 mov bx, 3 xor dx, dx div bx @@ -6047,7 +5996,7 @@ loc_CE6F: mov [si+4], ax mov byte ptr [si+6], 0A2h mov byte ptr [si+7], 0F6h - call sub_13A24 + call _randring_far_next16 mov [si+8], al pop si pop bp @@ -8406,7 +8355,7 @@ arg_0 = word ptr 4 jnz short loc_E036 call snd_se_play pascal, 2 push 3Fh ; '?' - call sub_A41E + call _randring1_next16_and mov [si+12h], al cmp word ptr [si], 900h jge short loc_E01C @@ -10726,7 +10675,7 @@ loc_F42B: mov cx, 10h rep movsw push 7 - call sub_13A36 + call _randring_far_next16_and inc al mov byte_1F352, al mov word_1F3B0, 0 @@ -10855,7 +10804,7 @@ var_1 = byte ptr -1 loc_F53B: push 0Fh - call sub_13A36 + call _randring_far_next16_and mov [bp+var_1], al mov al, byte_1F324 mov ah, 0 @@ -11091,7 +11040,7 @@ sub_F72D proc near call sub_F356 test byte ptr word_1F3B0, 1Fh jnz short loc_F7A8 - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov byte ptr word_23E44+1, 26h ; '&' mov ax, word_1F33E @@ -11758,7 +11707,7 @@ loc_FCC6: loc_FD12: cmp word_1F3B0, 40h jnz short loc_FD47 - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov byte ptr word_23E44+1, 25h ; '%' mov word_23E3E, si @@ -11884,7 +11833,7 @@ sub_FE2B proc near cmp word_1F3B0, 1 jnz short loc_FE54 push 1 - call sub_13A36 + call _randring_far_next16_and or ax, ax jz short loc_FE47 mov al, 7 @@ -11896,7 +11845,7 @@ loc_FE47: loc_FE49: mov byte_20E2A, al - call sub_13A24 + call _randring_far_next16 mov byte_20E2B, al loc_FE54: @@ -12454,12 +12403,12 @@ sub_10324 proc near cmp word_1F3B0, 1 jnz short loc_1035A mov byte_1F353, 1 - call sub_13A24 + call _randring_far_next16 mov byte_20E4E, al mov byte_20E4C, 0 mov word_1F356, 100h push 1 - call sub_13A36 + call _randring_far_next16_and or ax, ax jnz short loc_10355 mov al, 3 @@ -12608,15 +12557,15 @@ loc_104A7: mov al, byte_20E4E mov byte ptr word_23E42+1, al push 1Fh - call sub_13A36 + call _randring_far_next16_and add al, byte_1F3A1 mov byte ptr word_23E42, al push 1 - call sub_13A36 + call _randring_far_next16_and inc al mov byte_23E4E, al push 5 - call sub_13A50 + call _randring_far_next16_mod mov bx, ax mov al, [bx+792h] mov byte ptr word_23E44+1, al @@ -12655,10 +12604,10 @@ sub_1050F proc near mov byte ptr word_23E44+1, 20h ; ' ' mov byte ptr word_23E42, 20h ; ' ' push 1 - call sub_13A36 + call _randring_far_next16_and inc al mov byte_23E4E, al - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov ax, word_1F33E mov word_23E3E, ax @@ -12666,13 +12615,13 @@ sub_1050F proc near add ax, 0FE00h mov word_23E40, ax call sub_17730 - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov ax, word_1F340 add ax, 200h mov word_23E40, ax call sub_17730 - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov ax, word_1F33E add ax, 0FE00h @@ -12680,7 +12629,7 @@ sub_1050F proc near mov ax, word_1F340 mov word_23E40, ax call sub_17730 - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov ax, word_1F33E add ax, 200h @@ -12820,10 +12769,10 @@ loc_106B8: loc_106D3: push 1200h - call sub_13A50 + call _randring_far_next16_mod mov word_23E3E, ax push 3Fh ; '?' - call sub_13A36 + call _randring_far_next16_and add al, 20h ; ' ' mov byte ptr word_23E42+1, al call sub_17730 @@ -13487,7 +13436,7 @@ var_1 = byte ptr -1 add ax, 300h mov word_1F344, ax push 1 - call sub_13A36 + call _randring_far_next16_and mov byte_23DC6, al mov byte_23DC7, 10h @@ -13668,7 +13617,7 @@ var_1 = byte ptr -1 cmp word_1F3B0, 0 jnz short loc_10E32 mov byte_1F353, 1 - call sub_13A24 + call _randring_far_next16 mov byte_23DC8, al loc_10E32: @@ -13794,7 +13743,7 @@ loc_10F26: mov word_23E3E, ax mov ax, word_1F340 mov word_23E40, ax - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov byte ptr word_23E44+1, 26h ; '&' mov al, byte_1F3A4 @@ -14532,7 +14481,7 @@ loc_11591: cmp word_1F3B0, 30h ; '0' jnz short loc_115D2 xor si, si - call sub_13A24 + call _randring_far_next16 jmp short loc_115C4 ; --------------------------------------------------------------------------- @@ -14565,7 +14514,7 @@ loc_115D2: cmp word_1F3B0, 60h jnz short loc_1161D xor si, si - call sub_13A24 + call _randring_far_next16 jmp short loc_11606 ; --------------------------------------------------------------------------- @@ -15191,7 +15140,7 @@ arg_0 = word ptr 4 loc_11ACF: cmp [bp+arg_0], 0 jz short loc_11ADD - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al loc_11ADD: @@ -16179,7 +16128,7 @@ loc_1239D: mov word_23E3E, ax mov ax, word_1F340 mov word_23E40, ax - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov byte_23E4E, 2 mov byte ptr word_23E44+1, 25h ; '%' @@ -16246,7 +16195,7 @@ loc_12447: mov word_23E3E, ax mov ax, word_1F340 mov word_23E40, ax - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov byte_23E4E, 2 mov byte ptr word_23E44+1, 26h ; '&' @@ -16635,7 +16584,7 @@ loc_127D6: cmp byte_1F353, 10h ; jumptable 00012744 case 1 jnz short loc_1280B push 5 - call sub_13A50 + call _randring_far_next16_mod add al, al mov [bp+var_2], al mov ah, 0 @@ -16656,7 +16605,7 @@ loc_1280B: jb short loc_12860 ; default mov word_1F3B0, 0 push 0Fh - call sub_13A36 + call _randring_far_next16_and add al, 2 mov byte_1F34F, al inc byte_1F351 @@ -17415,11 +17364,11 @@ var_1 = byte ptr -1 or dx, dx jnz short loc_12EED push 1Fh - call sub_13A36 + call _randring_far_next16_and sub al, 10h mov [bp+var_1], al push 1 - call sub_13A36 + call _randring_far_next16_and or ax, ax jz short loc_12EB0 mov al, 80h @@ -17485,7 +17434,7 @@ loc_12F17: call sub_CE0C mov byte_23DE6, 0C0h push 3 - call sub_13A36 + call _randring_far_next16_and mov byte_23DE7, al cmp byte_23DE7, 0 jnz short loc_12F5A @@ -18063,7 +18012,7 @@ loc_133DE: mov byte ptr word_23E44+1, 16h mov byte ptr word_23E42, 1Ch push 1 - call sub_13A36 + call _randring_far_next16_and or ax, ax jz short loc_1341D mov al, 30h ; '0' @@ -18177,7 +18126,7 @@ loc_134E3: sub dx, ax push dx call sub_CDBD - call sub_13A24 + call _randring_far_next16 mov [bp+var_1], al xor si, si jmp short loc_13532 @@ -18225,7 +18174,7 @@ loc_1353F: ; --------------------------------------------------------------------------- loc_1356B: - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov al, byte ptr word_23E42 add al, 8 @@ -18294,10 +18243,10 @@ loc_135CD: mov [bp+var_1], dl cmp [bp+var_1], 1 jnz short loc_135F8 - call sub_13A24 + call _randring_far_next16 mov byte_23DE8, al push 1 - call sub_13A36 + call _randring_far_next16_and inc al mov byte_23DE9, al @@ -18770,123 +18719,8 @@ main_04_TEXT segment byte public 'CODE' use16 ;org 0Ah assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing -; =============== S U B R O U T I N E ======================================= - - -sub_139DA proc near - xor bh, bh - mov bl, byte_1F4B2 - add bx, 1E52h - inc byte_1F4B2 - mov ax, [bx] - retn -sub_139DA endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_139EC proc near - -arg_0 = word ptr 4 - - push bp - mov bp, sp - xor bh, bh - mov bl, byte_1F4B2 - add bx, 1E52h - inc byte_1F4B2 - mov ax, [bx] - and ax, [bp+arg_0] - pop bp - retn 2 -sub_139EC endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_13A06 proc near - -arg_0 = word ptr 4 - - push bp - mov bp, sp - xor bh, bh - mov bl, byte_1F4B2 - add bx, 1E52h - inc byte_1F4B2 - mov ax, [bx] - xor dx, dx - div [bp+arg_0] - mov ax, dx - pop bp - retn 2 -sub_13A06 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_13A24 proc far - xor bh, bh - mov bl, byte_1F4B2 - add bx, 1E52h - inc byte_1F4B2 - mov ax, [bx] - retf -sub_13A24 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_13A36 proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - xor bh, bh - mov bl, byte_1F4B2 - add bx, 1E52h - inc byte_1F4B2 - mov ax, [bx] - and ax, [bp+arg_0] - pop bp - retf 2 -sub_13A36 endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_13A50 proc far - -arg_0 = word ptr 6 - - push bp - mov bp, sp - xor bh, bh - mov bl, byte_1F4B2 - add bx, 1E52h - inc byte_1F4B2 - mov ax, [bx] - xor dx, dx - div [bp+arg_0] - mov ax, dx - pop bp - retf 2 -sub_13A50 endp - +RANDRING_NEXT_DEF 2, near +RANDRING_NEXT_DEF _far, far ; =============== S U B R O U T I N E ======================================= @@ -20518,7 +20352,7 @@ loc_146C6: cmp al, [bp+var_2] jnz short loc_14723 push 1Fh - call sub_139EC + call _randring2_next16_and neg ax shl ax, 4 mov dl, byte ptr word_1FE88 @@ -20851,10 +20685,10 @@ loc_14967: or dx, dx jnz loc_14A1C push 1200h - call sub_13A06 + call _randring2_next16_mod mov word_1FE52, ax push 1700h - call sub_13A06 + call _randring2_next16_mod mov word_1FE54, ax push word_1FE52 push ax @@ -21915,13 +21749,13 @@ loc_1522B: mov bx, word_207E0 mov byte ptr [bx], 1 push 7Fh - call sub_139EC + call _randring2_next16_and mov dx, 0FFA0h sub dx, ax mov bx, word_207E0 mov [bx+6], dx push 1200h - call sub_13A06 + call _randring2_next16_mod mov bx, word_207E0 mov [bx+2], ax mov word ptr [bx+4], 1800h @@ -22510,7 +22344,7 @@ loc_156F8: cmp al, [bp+var_2] jnz short loc_15786 push 1 - nopcall sub_13A36 + nopcall _randring_far_next16_and or ax, ax jnz short loc_15717 mov al, 0F9h @@ -25679,7 +25513,7 @@ loc_170A5: or dx, dx jnz short loc_17129 push 1200h - call sub_13A06 + call _randring2_next16_mod mov dl, byte ptr word_1FE88 mov dh, 0 shl dx, 5 @@ -26351,14 +26185,14 @@ loc_17628: ; --------------------------------------------------------------------------- loc_1762D: - call sub_139DA + call _randring2_next16 mov [bp+var_2], ax mov di, 1 jmp short loc_176A8 ; --------------------------------------------------------------------------- loc_17638: - call sub_139DA + call _randring2_next16 mov [bp+var_2], ax mov al, byte_23E47 mov ah, 0 @@ -26368,10 +26202,10 @@ loc_17638: ; --------------------------------------------------------------------------- loc_17649: - call sub_139DA + call _randring2_next16 mov [bp+var_2], ax push 1Fh - call sub_139EC + call _randring2_next16_and add al, [bp+var_9] mov [bp+var_9], al mov al, byte_23E47 @@ -26383,7 +26217,7 @@ loc_17649: loc_17665: push 1Fh - call sub_139EC + call _randring2_next16_and mov [bp+var_2], ax sub [bp+var_2], 10h mov al, byte_23E47 @@ -26656,7 +26490,7 @@ loc_1787E: call sub_A2D0 mov [bp+var_8], ax push 1200h - call sub_13A06 + call _randring2_next16_mod mov [bp+var_6], ax mov [si+6], ax push ax @@ -26682,7 +26516,7 @@ loc_1787E: shl ax, 4 push ax push 0FFh - call sub_139EC + call _randring2_next16_and push ax push 0 push ds @@ -27345,7 +27179,7 @@ loc_17DD4: mov al, [bx+8] mov [si+8], al push 1Fh - call sub_139EC + call _randring2_next16_and mov dl, byte_23AF8 mov dh, 0 push ax @@ -27397,13 +27231,13 @@ loc_17E45: cmp ax, 100h jnb short loc_17E6F push 1200h - call sub_13A06 + call _randring2_next16_mod jmp short loc_17E83 ; --------------------------------------------------------------------------- loc_17E6F: push 1FFh - call sub_139EC + call _randring2_next16_and mov dl, [bp+var_7] mov dh, 0 shl dx, 7 @@ -28361,7 +28195,7 @@ loc_18667: mov ax, word_1FBBE add ax, 6 push ax - call sub_13A24 + call _randring_far_next16 push ax push 0E0h call vector2 @@ -29291,7 +29125,7 @@ loc_18F38: or dx, dx jnz short loc_18F71 push 3FFh - call sub_13A36 + call _randring_far_next16_and mov si, ax jmp short loc_18F6B ; --------------------------------------------------------------------------- @@ -29403,7 +29237,7 @@ loc_19000: push [bp+arg_4] push [bp+arg_2] push 1140h - call sub_13A50 + call _randring_far_next16_mod add ax, 60h push ax push 0 @@ -29414,7 +29248,7 @@ loc_19000: push [bp+arg_4] push [bp+arg_2] push 1140h - call sub_13A50 + call _randring_far_next16_mod add ax, 60h push ax push 1780h @@ -29905,15 +29739,15 @@ arg_4 = word ptr 0Ah push si mov [bp+var_5], 0 push 0C80h - call sub_13A50 + call _randring_far_next16_mod add ax, 2C0h mov [bp+var_2], ax push 0C80h - call sub_13A50 + call _randring_far_next16_mod add ax, 500h mov [bp+var_4], ax push 1 - call sub_13A36 + call _randring_far_next16_and or ax, ax jnz short loc_19423 mov al, 0FFh @@ -29925,7 +29759,7 @@ loc_19423: loc_19425: mov [bp+var_6], al - call sub_13A24 + call _randring_far_next16 mov [bp+var_7], al mov al, byte ptr [bp+arg_0] mov ah, 0 @@ -30437,7 +30271,7 @@ arg_4 = word ptr 0Ah push si push di push 1200h - call sub_13A50 + call _randring_far_next16_mod mov [bp+var_2], ax mov al, byte ptr [bp+arg_0] mov ah, 0 @@ -30456,13 +30290,13 @@ loc_19847: push [bp+arg_2] push [bp+var_2] push 800h - call sub_13A50 + call _randring_far_next16_mod push ax push [bp+arg_0] push 5Ah ; 'Z' call sub_1A1ED push 1Fh - call sub_13A36 + call _randring_far_next16_and sub al, 0Fh mov [si+12h], al cmp [bp+var_2], 900h @@ -30821,7 +30655,7 @@ loc_19AD2: push [bp+arg_4] push [bp+arg_2] push 1200h - call sub_13A50 + call _randring_far_next16_mod push ax push 1700h push [bp+arg_0] @@ -31215,20 +31049,20 @@ loc_19D76: push [bp+arg_4] push [bp+arg_2] push 1200h - call sub_13A50 + call _randring_far_next16_mod push ax push 400h - call sub_13A50 + call _randring_far_next16_mod push ax push [bp+arg_0] push 5Ah ; 'Z' call sub_1A1ED push 0FFFh - call sub_13A36 + call _randring_far_next16_and add ax, 600h mov [si+0Eh], ax push 1Fh - call sub_13A36 + call _randring_far_next16_and add ax, 10h mov [si+14h], ax mov byte ptr [si+12h], 0 @@ -31581,7 +31415,7 @@ loc_1A020: cmp byte ptr [si+11h], 0 jz loc_1A0D5 mov byte ptr word_23E42, 1Ch - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov byte ptr word_23E44+1, 26h ; '&' mov al, [bp+var_1] @@ -31610,7 +31444,7 @@ loc_1A08B: jnz short loc_1A0D5 call sub_19EF9 mov byte ptr word_23E42, 18h - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov byte ptr word_23E44+1, 26h ; '&' mov al, [bp+var_1] @@ -31922,10 +31756,10 @@ loc_1A294: push [bp+arg_4] push [bp+arg_2] push 1200h - call sub_13A50 + call _randring_far_next16_mod push ax push 7FFh - call sub_13A36 + call _randring_far_next16_and push ax push [bp+arg_0] push 5Ah ; 'Z' @@ -32321,10 +32155,10 @@ loc_1A58A: or al, al jz short loc_1A5E5 push 1Fh - call sub_13A36 + call _randring_far_next16_and mov [bp+var_1], al push 1 - call sub_13A36 + call _randring_far_next16_and imul ax, 60h add al, [bp+var_1] add al, 80h @@ -32441,10 +32275,10 @@ loc_1A641: push [bp+arg_4] push [bp+arg_2] push 1200h - call sub_13A50 + call _randring_far_next16_mod push ax push 1200h - call sub_13A50 + call _randring_far_next16_mod push ax push [bp+arg_0] push 5Ah ; 'Z' @@ -32721,7 +32555,7 @@ loc_1A87E: call sub_1A1A7 or al, al jz short loc_1A8BE - call sub_13A24 + call _randring_far_next16 mov [si+12h], al mov byte ptr [si+13h], 0 mov word ptr [si+6], 0 @@ -32826,10 +32660,10 @@ loc_1A918: push [bp+arg_4] push [bp+arg_2] push 1200h - call sub_13A50 + call _randring_far_next16_mod push ax push 1000h - call sub_13A50 + call _randring_far_next16_mod add ax, 600h push ax push [bp+arg_0] @@ -33642,18 +33476,18 @@ loc_1AFB8: push [bp+arg_4] push [bp+arg_2] push 1200h - call sub_13A50 + call _randring_far_next16_mod push ax push 100h push [bp+arg_0] push 64h ; 'd' call sub_1A1ED push 1 - call sub_13A36 + call _randring_far_next16_and mov [si+17h], al mov byte ptr [si+12h], 40h push 0Fh - call sub_13A36 + call _randring_far_next16_and add al, 20h ; ' ' mov [si+13h], al jmp short loc_1B000 @@ -34606,7 +34440,7 @@ loc_1B68E: mov [bx+4], ax mov ax, [bp+arg_0] mov [bx+6], ax - call sub_13A24 + call _randring_far_next16 mov bx, word_1F868 mov [bx+2], al mov byte ptr [bx+3], 50h ; 'P' @@ -34653,7 +34487,7 @@ loc_1B6E1: mov [bx+4], ax mov ax, [bp+arg_0] mov [bx+6], ax - call sub_13A24 + call _randring_far_next16 mov bx, word_1F868 mov [bx+2], al mov byte ptr [bx+3], 50h ; 'P' @@ -35166,7 +35000,7 @@ loc_1BB55: mov bx, ax cmp word ptr [bx+2002h], 900h jge loc_1BBFA - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov al, byte ptr word_1FE88 mov ah, 0 @@ -35205,7 +35039,7 @@ loc_1BB55: push ax call sub_CE0C call sub_17730 - call sub_13A24 + call _randring_far_next16 mov byte ptr word_23E42+1, al mov al, byte ptr word_1FE88 mov ah, 0 @@ -36220,7 +36054,7 @@ loc_1C2F6: mov bx, dx mov [bx+2D58h], al push 1 - call sub_13A36 + call _randring_far_next16_and mov dl, byte ptr word_1FE88 mov dh, 0 shl dx, 2 @@ -36253,7 +36087,7 @@ loc_1C36B: cmp byte ptr [bx+28F8h], 0 jnz short loc_1C3A5 push 0A00h - call sub_13A50 + call _randring_far_next16_mod add ax, 400h push ax push 0 @@ -38381,6 +38215,7 @@ byte_1F3A5 db ? dd ? ; db ? ; word_1F3B0 dw ? +include th02/math/randring[bss].asm dd ? ; dd ? ; dd ? ; @@ -38406,72 +38241,6 @@ word_1F3B0 dw ? dd ? ; dd ? ; dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; -byte_1F4B2 db ? - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - db ? ; db ? ; db ? ; word_1F51A dw ? diff --git a/th04/math/randring_next.inc b/th04/math/randring_next.inc new file mode 100644 index 00000000..56626421 --- /dev/null +++ b/th04/math/randring_next.inc @@ -0,0 +1,40 @@ +RANDRING_NEXT_DEF macro instance + ; void randring_next16(void) + public _randring&instance&_next16 + _randring&instance&_next16 proc near + mov bx, _randring_p + mov ax, word ptr _randring[bx] + inc byte ptr _randring_p + ret + _randring&instance&_next16 endp + nop + + ; void randring_next16_and(unsigned char mask) + public _randring&instance&_next16_and + _randring&instance&_next16_and proc near + arg @@mask:byte + + mov bx, _randring_p + mov ax, word ptr _randring[bx] + inc byte ptr _randring_p + mov bx, sp + and ax, ss:[bx+2] + ret 2 + _randring&instance&_next16_and endp + nop + + ; void randring_next16_mod(unsigned short n) + public _randring&instance&_next16_mod + _randring&instance&_next16_mod proc near + arg @@n:word + + mov bx, _randring_p + mov ax, word ptr _randring[bx] + inc byte ptr _randring_p + xor dx, dx + mov bx, sp + div word ptr ss:[bx+2] + mov ax, dx + ret 2 + _randring&instance&_next16_mod endp +endm diff --git a/th04/th04.asm b/th04/th04.asm index 9c71a7c2..65ea7c94 100644 --- a/th04/th04.asm +++ b/th04/th04.asm @@ -2,3 +2,4 @@ GAME = 4 include defconv_pascal.inc include th04/formats/map.inc +include th04/math/randring_next.inc diff --git a/th04_main.asm b/th04_main.asm index 63efcdfa..b9f2d2ff 100644 --- a/th04_main.asm +++ b/th04_main.asm @@ -1065,7 +1065,7 @@ sub_B1D0 proc near mov byte_255BC, 1 call sub_1042A nopcall sub_11DE6 - call sub_BC58 + call _randring_fill call sub_1DA1B call sub_FFA4 call sub_C314 @@ -2274,63 +2274,9 @@ sub_BC38 proc near retn 2 sub_BC38 endp - -; =============== S U B R O U T I N E ======================================= - - -sub_BC58 proc near - push si - mov si, 0FFh - -loc_BC5C: - call IRand - mov [si+3DCCh], al - dec si - jge short loc_BC5C - mov word_2520C, 0 - pop si - retn -sub_BC58 endp - -; --------------------------------------------------------------------------- - mov bx, word_2520C - mov ax, [bx+3DCCh] - inc byte ptr word_2520C - retn -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_BC7E proc near - mov bx, word_2520C - mov ax, [bx+3DCCh] - inc byte ptr word_2520C - mov bx, sp - and ax, ss:[bx+2] - retn 2 -sub_BC7E endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_BC94 proc near - mov bx, word_2520C - mov ax, [bx+3DCCh] - inc byte ptr word_2520C - xor dx, dx - mov bx, sp - div word ptr ss:[bx+2] - mov ax, dx - retn 2 -sub_BC94 endp - -; --------------------------------------------------------------------------- - nop +include th03/math/randring_fill.asm +RANDRING_NEXT_DEF 1 + nop ; =============== S U B R O U T I N E ======================================= @@ -6714,7 +6660,7 @@ loc_DA70: add ax, 0Ah push ax push 7 - call sub_BC7E + call _randring1_next16_and add al, 0BCh push ax call sub_11DCA @@ -6814,7 +6760,7 @@ loc_DB62: lea ax, [si+0Ah] push ax push 7 - call sub_BC7E + call _randring1_next16_and add al, 0BCh push ax call sub_11DCA @@ -7123,7 +7069,7 @@ loc_DDA9: lea ax, [si+0Ah] push ax push 7 - call sub_BC7E + call _randring1_next16_and add al, 0BCh push ax call sub_11DCA @@ -7268,7 +7214,7 @@ loc_DEA3: lea ax, [si+0Ch] push ax push 7 - call sub_BC7E + call _randring1_next16_and add al, 0BCh push ax push 100h @@ -7334,7 +7280,7 @@ loc_DF23: lea ax, [si+0Ch] push ax push 7 - call sub_BC7E + call _randring1_next16_and add al, 0BCh push ax push 100h @@ -10006,7 +9952,7 @@ loc_F38D: add ax, 0Ah push ax push 7 - call sub_BC7E + call _randring1_next16_and add al, 0BCh push ax call sub_11DCA @@ -10050,7 +9996,7 @@ loc_F3FA: lea ax, [si+0Ah] push ax push 0Fh - call sub_BC7E + call _randring1_next16_and add al, 0B8h push ax call sub_11DCA @@ -10073,7 +10019,7 @@ loc_F426: jz short loc_F43A push si push 7 - call sub_BC7E + call _randring1_next16_and sub al, 4 push ax call sub_F33C @@ -10157,7 +10103,7 @@ loc_F4BC: jz short loc_F4D0 push si push 7 - call sub_BC7E + call _randring1_next16_and sub al, 4 push ax call sub_F33C @@ -10238,7 +10184,7 @@ loc_F558: jz short loc_F56C push si push 7 - call sub_BC7E + call _randring1_next16_and sub al, 4 push ax call sub_F33C @@ -10319,7 +10265,7 @@ loc_F5F4: jz short loc_F608 push si push 7 - call sub_BC7E + call _randring1_next16_and sub al, 4 push ax call sub_F33C @@ -10400,7 +10346,7 @@ loc_F690: jz short loc_F6A4 push si push 7 - call sub_BC7E + call _randring1_next16_and sub al, 4 push ax call sub_F33C @@ -10513,7 +10459,7 @@ loc_F760: jz short loc_F774 push si push 7 - call sub_BC7E + call _randring1_next16_and sub al, 4 push ax call sub_F33C @@ -10615,7 +10561,7 @@ loc_F813: jz short loc_F827 push si push 7 - call sub_BC7E + call _randring1_next16_and sub al, 4 push ax call sub_F33C @@ -10736,7 +10682,7 @@ loc_F8F2: jz short loc_F908 push si push 7 - call sub_BC7E + call _randring1_next16_and sub al, 4 push ax call sub_F33C @@ -10835,7 +10781,7 @@ loc_F98F: lea ax, [si+0Ah] push ax push 0Fh - call sub_BC7E + call _randring1_next16_and add al, 0B8h push ax call sub_11DCA @@ -11866,7 +11812,7 @@ loc_1015E: add ax, 0FFB0h shl ax, 3 push ax - call sub_BC94 + call _randring1_next16_mod mov dl, byte_256A9 mov dh, 0 add dx, 0FFC0h @@ -11882,7 +11828,7 @@ loc_101B6: sub dx, ax shl dx, 3 push dx - call sub_BC94 + call _randring1_next16_mod mov dl, byte_256A9 mov dh, 0 mov bx, 0A1h @@ -12056,10 +12002,10 @@ arg_0 = word ptr 4 loc_10321: push 1800h - call sub_BC94 + call _randring1_next16_mod mov [si], ax push 1700h - call sub_BC94 + call _randring1_next16_mod mov [si+2], ax cmp [bp+arg_0], 0 jnz short loc_1036F @@ -12069,7 +12015,7 @@ loc_10321: loc_1033E: push 1800h - call sub_BC94 + call _randring1_next16_mod mov [si], ax loc_10346: @@ -12101,7 +12047,7 @@ loc_10364: loc_1036F: mov byte ptr [si+4], 0E0h push 7Fh - call sub_BC7E + call _randring1_next16_and add al, 0A0h loc_1037A: @@ -12156,14 +12102,14 @@ loc_103D6: jz short loc_103EB mov word ptr [si], 0FF80h push 1700h - call sub_BC94 + call _randring1_next16_mod mov [si+2], ax jmp short loc_103F8 ; --------------------------------------------------------------------------- loc_103EB: push 1800h - call sub_BC94 + call _randring1_next16_mod mov [si], ax mov word ptr [si+2], 1780h @@ -16514,13 +16460,13 @@ loc_12647: loc_12651: push 1800h - call sub_BC94 + call _randring1_next16_mod mov [si], ax push 1700h - call sub_BC94 + call _randring1_next16_mod mov [si+2], ax push 0Fh - call sub_BC7E + call _randring1_next16_and add al, 0B8h mov [si+4], al mov byte ptr [si+5], 48h ; 'H' @@ -16653,10 +16599,10 @@ loc_12743: loc_12773: push 1800h - call sub_BC94 + call _randring1_next16_mod mov [si], ax push 1700h - call sub_BC94 + call _randring1_next16_mod mov [si+2], ax mov byte ptr [si+4], 40h mov byte ptr [si+5], 0C0h @@ -16846,10 +16792,10 @@ var_1 = byte ptr -1 loc_128E7: push 1800h - call sub_BC94 + call _randring1_next16_mod mov [si], ax push 1700h - call sub_BC94 + call _randring1_next16_mod mov [si+2], ax mov byte ptr [si+4], 60h mov byte ptr [si+5], 10h @@ -19287,50 +19233,7 @@ sub_13D32 proc near retn 2 sub_13D32 endp - -; =============== S U B R O U T I N E ======================================= - - -sub_13D52 proc near - mov bx, word_2520C - mov ax, [bx+3DCCh] - inc byte ptr word_2520C - retn -sub_13D52 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_13D60 proc near - mov bx, word_2520C - mov ax, [bx+3DCCh] - inc byte ptr word_2520C - mov bx, sp - and ax, ss:[bx+2] - retn 2 -sub_13D60 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_13D76 proc near - mov bx, word_2520C - mov ax, [bx+3DCCh] - inc byte ptr word_2520C - xor dx, dx - mov bx, sp - div word ptr ss:[bx+2] - mov ax, dx - retn 2 -sub_13D76 endp - -; --------------------------------------------------------------------------- +RANDRING_NEXT_DEF 2 db 0 ; =============== S U B R O U T I N E ======================================= @@ -19419,7 +19322,7 @@ loc_13E40: mov ax, [bp+arg_4] mov [si+4], ax push 1Fh - call sub_13D60 + call _randring2_next16_and add ax, [bp+arg_2] lea bx, [si+0Ah] push bx @@ -20019,7 +19922,7 @@ sub_14383 proc near mov byte_266EC, 26h ; '&' mov byte_266EF, 20h ; ' ' mov byte_266EE, 28h ; '(' - call sub_13D52 + call _randring2_next16 mov byte_266ED, al call fp_2D004 call sub_1CFA2 @@ -20082,7 +19985,7 @@ sub_14425 proc near mov bp, sp cmp word_26706, 1 jnz short loc_14435 - call sub_13D52 + call _randring2_next16 mov byte_26709, al loc_14435: @@ -20149,10 +20052,10 @@ var_1 = byte ptr -1 mov word_266FC, 0 mov word_266FE, 0 push 3 - call sub_13D60 + call _randring2_next16_and mov byte_25598, al push 1 - call sub_13D60 + call _randring2_next16_and mov byte_25599, al mov byte_2559A, 0 jmp loc_1468D @@ -20441,7 +20344,7 @@ sub_1476F proc near jnz short loc_14796 mov byte_266EC, 26h ; '&' mov byte_266EF, 20h ; ' ' - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov byte_266EE, 30h ; '0' call fp_2D004 @@ -20466,7 +20369,7 @@ sub_14798 proc near mov byte_266E3, 39h ; '9' mov byte_266EC, 26h ; '&' mov byte_266EF, 20h ; ' ' - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov ax, word_26706 mov bx, 4 @@ -20501,7 +20404,7 @@ sub_147DB proc near mov byte_266E3, 3Bh ; ';' mov byte_266EE, 20h ; ' ' push 0Fh - call sub_13D60 + call _randring2_next16_and add al, 0B8h mov byte_266ED, al call fp_2D004 @@ -20526,14 +20429,14 @@ sub_14828 proc near jnz short loc_1486C mov byte_266EC, 26h ; '&' mov byte_266EF, 20h ; ' ' - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov byte_266EE, 20h ; ' ' call fp_2D004 call fp_2D000 mov byte_266EC, 26h ; '&' mov byte_266EF, 10h - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov byte_266EE, 30h ; '0' call fp_2D004 @@ -21224,7 +21127,7 @@ loc_14E20: mov word_2A8CE, 600h cmp byte_255B3, 1 jnz short loc_14E5E - call sub_13D52 + call _randring2_next16 test al, 1 jz short loc_14E4C mov byte_26704, 1 @@ -21374,11 +21277,11 @@ loc_14F9B: mov byte_266EF, 2 mov byte_266F0, 6 push 18h - call sub_13D76 + call _randring2_next16_mod add al, 20h ; ' ' mov byte_266EE, al push 60h - call sub_13D76 + call _randring2_next16_mod sub al, 30h ; '0' mov byte_266ED, al call fp_2D004 @@ -21386,11 +21289,11 @@ loc_14F9B: mov byte_266E2, 2 mov byte_266E3, 3Ah ; ':' push 18h - call sub_13D76 + call _randring2_next16_mod add al, 20h ; ' ' mov byte_266EE, al push 60h - call sub_13D76 + call _randring2_next16_mod sub al, 30h ; '0' mov byte_266ED, al call fp_2D000 @@ -21565,12 +21468,12 @@ loc_15142: jnz short loc_1517E mov byte_266EC, 2Eh ; '.' push 3 - call sub_13D60 + call _randring2_next16_and add al, al inc al mov byte_266EF, al push 7 - call sub_13D60 + call _randring2_next16_and add al, 0Ah mov byte_266F0, al mov byte_266EE, 32h ; '2' @@ -22316,7 +22219,7 @@ loc_157D7: ; --------------------------------------------------------------------------- loc_157E2: - call sub_13D52 + call _randring2_next16 mov [si+1Eh], al jmp loc_158BE ; --------------------------------------------------------------------------- @@ -22405,7 +22308,7 @@ loc_158AE: ; --------------------------------------------------------------------------- loc_158B8: - call sub_13D52 + call _randring2_next16 mov [si+37h], al loc_158BE: @@ -23280,11 +23183,11 @@ loc_15EEA: cmp [bp+arg_0], 0 jnz short loc_15F23 push 1000h - call sub_13D76 + call _randring2_next16_mod add ax, 400h mov si, ax push 400h - call sub_13D76 + call _randring2_next16_mod add ax, 400h mov di, ax jmp short loc_15F29 @@ -23638,7 +23541,7 @@ loc_1626B: idiv bx or dx, dx jnz short locret_16290 - call sub_13D52 + call _randring2_next16 mov byte_266ED, al call fp_2D002 call snd_se_play pascal, 9 @@ -24557,7 +24460,7 @@ loc_16B0A: loc_16B1A: push 1 - call sub_13D60 + call _randring2_next16_and or ax, ax jz short loc_16B28 mov ax, 10h @@ -24588,7 +24491,7 @@ loc_16B4E: push 3 loc_16B50: - call sub_13D60 ; jumptable 0001EA6B case 7819 + call _randring2_next16_and ; jumptable 0001EA6B case 7819 mov [bp+var_1], al cmp [bp+var_1], 0 jnz short loc_16B61 @@ -24721,7 +24624,7 @@ var_1 = byte ptr -1 push offset unk_22D9E mov cx, 8 call SCOPY@ - call sub_13D52 + call _randring2_next16 mov [bp+var_1], al mov si, 0B204h xor di, di @@ -24982,11 +24885,11 @@ loc_16E2E: or dx, dx jnz short loc_16E84 push 3 - call sub_13D60 + call _randring2_next16_and inc al mov byte_266EF, al push 1Fh - call sub_13D60 + call _randring2_next16_and add al, 20h ; ' ' mov byte_266EE, al mov al, byte_266ED @@ -24995,11 +24898,11 @@ loc_16E2E: sub word ptr dword_266E4, 60h call fp_2D000 push 3 - call sub_13D60 + call _randring2_next16_and inc al mov byte_266EF, al push 1Fh - call sub_13D60 + call _randring2_next16_and add al, 20h ; ' ' mov byte_266EE, al add word ptr dword_266E4, 0C0h @@ -25517,11 +25420,11 @@ loc_1729F: or dx, dx jnz loc_17331 push 3 - call sub_13D60 + call _randring2_next16_and inc al mov byte_266EF, al push 1Fh - call sub_13D60 + call _randring2_next16_and add al, 10h mov byte_266EE, al test byte_2D02D, 1 @@ -25540,11 +25443,11 @@ loc_172D5: sub word ptr dword_266E4, 60h call fp_2D000 push 3 - call sub_13D60 + call _randring2_next16_and inc al mov byte_266EF, al push 1Fh - call sub_13D60 + call _randring2_next16_and add al, 10h mov byte_266EE, al add word ptr dword_266E4, 0C0h @@ -25670,19 +25573,19 @@ loc_173D3: loc_17409: push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A add dx, 0FCC0h add ax, dx mov word ptr dword_266E4, ax push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A+2 add dx, 0FD80h add ax, dx mov word ptr dword_266E4+2, ax push 60h - call sub_13D76 + call _randring2_next16_mod add ax, 10h mov [bp+var_2], ax mov al, byte ptr [bp+var_2] @@ -25698,7 +25601,7 @@ loc_1744D: sub ax, [bp+var_2] mov [bp+var_2], ax push ax - call sub_13D76 + call _randring2_next16_mod push ax mov ax, [bp+var_2] cwd @@ -25906,7 +25809,7 @@ loc_17615: cmp byte_2D02D, 0 jnz short loc_17634 push 1Fh - call sub_13D60 + call _randring2_next16_and mov dl, 80h sub dl, al mov byte_266ED, dl @@ -26001,41 +25904,41 @@ loc_17707: jnz locret_17811 mov word ptr dword_266E4, 0 push 0C00h - call sub_13D76 + call _randring2_next16_mod mov word ptr dword_266E4+2, ax push 1Fh - call sub_13D60 + call _randring2_next16_and add al, 10h mov byte_266EE, al push 1Fh - call sub_13D60 + call _randring2_next16_and mov dl, 30h ; '0' sub dl, al mov byte_266ED, dl call fp_2D002 mov word ptr dword_266E4, 1800h push 0C00h - call sub_13D76 + call _randring2_next16_mod mov word ptr dword_266E4+2, ax push 1Fh - call sub_13D60 + call _randring2_next16_and add al, 10h mov byte_266EE, al push 1Fh - call sub_13D60 + call _randring2_next16_and add al, 50h ; 'P' mov byte_266ED, al call fp_2D002 push 1800h - call sub_13D76 + call _randring2_next16_mod mov word ptr dword_266E4, ax mov word ptr dword_266E4+2, 0 push 1Fh - call sub_13D60 + call _randring2_next16_and add al, 10h mov byte_266EE, al push 1Fh - call sub_13D60 + call _randring2_next16_and add al, 30h ; '0' mov byte_266ED, al call fp_2D002 @@ -26055,7 +25958,7 @@ loc_1779E: cmp byte_2D02D, 0 jnz short loc_177B8 push 1Fh - call sub_13D60 + call _randring2_next16_and mov byte_266ED, al mov byte_2D02D, 1 @@ -26113,7 +26016,7 @@ var_1 = byte ptr -1 mov byte_266EE, 38h ; '8' call fp_2D004 push 1 - call sub_13D60 + call _randring2_next16_and or ax, ax jnz short loc_17848 mov al, 1 @@ -26173,7 +26076,7 @@ var_1 = byte ptr -1 jnz short loc_178AD mov byte_2D02C, 20h ; ' ' push 1 - call sub_13D60 + call _randring2_next16_and mov byte_2D02D, al loc_178AD: @@ -26471,7 +26374,7 @@ loc_17B1E: loc_17B56: push 1 - call sub_13D60 + call _randring2_next16_and add al, 0Ah mov byte_2671D, al jmp short loc_17B84 @@ -26479,7 +26382,7 @@ loc_17B56: loc_17B62: push 7 - call sub_13D76 + call _randring2_next16_mod inc ax mov [bp+var_2], ax mov al, byte_2566E @@ -26680,14 +26583,14 @@ loc_17D0E: cmp di, 3E70h jnz short loc_17D3C push 1800h - call sub_13D76 + call _randring2_next16_mod mov di, ax loc_17D3C: cmp [bp+arg_2], 3E70h jnz short loc_17D4C push 1700h - call sub_13D76 + call _randring2_next16_mod mov [bp+arg_2], ax loc_17D4C: @@ -26726,7 +26629,7 @@ loc_17D96: loc_17D98: mov [si+2Bh], al - call sub_13D52 + call _randring2_next16 mov [si+3Eh], al mov byte ptr [si+3Fh], 80h mov byte ptr [si+36h], 41h ; 'A' @@ -27479,10 +27382,10 @@ loc_1832E: mov byte_266EC, 26h ; '&' mov byte_266EF, 8 mov byte_266EE, 20h ; ' ' - call sub_13D52 + call _randring2_next16 mov byte_266ED, al push 1 - call sub_13D60 + call _randring2_next16_and mov byte_2D02D, al pop bp retn @@ -27631,7 +27534,7 @@ loc_18473: mov byte_266EC, 26h ; '&' mov byte_266EF, 28h ; '(' mov byte_266EE, 10h - call sub_13D52 + call _randring2_next16 mov byte_266ED, al call fp_2D000 call snd_se_play pascal, 15 @@ -27680,17 +27583,17 @@ loc_184D9: mov byte_266E2, 2 mov byte_266E3, 3Ah ; ':' push 3Fh ; '?' - call sub_13D60 + call _randring2_next16_and add al, 10h mov byte_266EE, al push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A add dx, 0FE00h add ax, dx mov word ptr dword_266E4, ax push 200h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A+2 add dx, 0FE60h add ax, dx @@ -27699,7 +27602,7 @@ loc_184D9: mov byte_2CFF8, 40h call fp_2D002 push 3Fh ; '?' - call sub_13D60 + call _randring2_next16_and add al, 10h mov byte_266EE, al mov byte_266ED, 80h @@ -27751,26 +27654,26 @@ loc_18580: cmp byte_266CE, 0 jnz short loc_185E2 push 1 - call sub_13D60 + call _randring2_next16_and mov byte_266E2, al mov byte_266E3, 39h ; '9' push 3Fh ; '?' - call sub_13D60 + call _randring2_next16_and add al, 10h mov byte_266EE, al push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A add dx, 0FE00h add ax, dx mov word ptr dword_266E4, ax push 200h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A+2 add dx, 0FE60h add ax, dx mov word ptr dword_266E4+2, ax - call sub_13D52 + call _randring2_next16 mov byte_266ED, al call fp_2D000 call snd_se_play pascal, 3 @@ -27856,7 +27759,7 @@ sub_18655 proc near mov byte_266EF, 20h ; ' ' mov byte_266E3, 4Ch ; 'L' mov byte_266E2, 2 - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov byte_266EE, 70h ; 'p' call fp_2D000 @@ -28047,7 +27950,7 @@ loc_187FC: cmp word_2671A, 10h ; jumptable 000187E2 case 255 jle short loc_18856 ; default push 3 - call sub_13D60 + call _randring2_next16_and or ax, ax jnz short loc_18814 mov fp_259E8, offset sub_180BB @@ -28059,7 +27962,7 @@ loc_18814: loc_1881A: push 5 - call sub_13D76 + call _randring2_next16_mod mov [bp+var_1], al mov al, byte_2671F cmp al, [bp+var_1] @@ -28550,7 +28453,7 @@ loc_18C1F: jnz short loc_18C3E mov byte_26718, 0 push 0FF40000Fh - call sub_13D60 + call _randring2_next16_and mov dl, 18h sub dl, al push dx @@ -28615,7 +28518,7 @@ loc_18CAF: jnz short loc_18CCC mov byte_26718, 0 push 0C0000Fh - call sub_13D60 + call _randring2_next16_and add al, 68h ; 'h' push ax call sub_18A14 @@ -28688,7 +28591,7 @@ loc_18D51: jnz short loc_18D7E mov byte_26718, 0 push 0Fh - call sub_13D60 + call _randring2_next16_and add al, 68h ; 'h' mov [bp+var_1], al push 0C0h @@ -28756,7 +28659,7 @@ loc_18DCF: mov byte_266EF, 10h mov byte_266F2, 81h mov byte_266EE, 30h ; '0' - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov byte_2CFF7, 1 test byte_259F0, 1 @@ -28776,7 +28679,7 @@ loc_18E1B: add al, 80h mov byte_2CFF8, al mov byte_266EE, 20h ; ' ' - call sub_13D52 + call _randring2_next16 mov byte_266ED, al call fp_2D002 inc byte_259F0 @@ -29051,12 +28954,12 @@ sub_1905A proc near cmp word_2671A, 10h jnz short loc_1908E push 0Fh - call sub_13D60 + call _randring2_next16_and mov dl, 0E0h sub dl, al mov byte_2D02D, dl push 0Fh - call sub_13D60 + call _randring2_next16_and add al, 0A0h mov byte_2D02C, al mov byte_2D02B, 0 @@ -29080,12 +28983,12 @@ loc_1908E: cmp byte_2D02B, 0Ah jbe short loc_190D7 push 0Fh - call sub_13D60 + call _randring2_next16_and mov dl, 0E0h sub dl, al mov byte_2D02D, dl push 0Fh - call sub_13D60 + call _randring2_next16_and add al, 0A0h mov byte_2D02C, al mov byte_2D02B, 0 @@ -29127,7 +29030,7 @@ loc_190DE: mov byte_266ED, 0 mov byte_266E2, 1 push 0Fh - call sub_13D60 + call _randring2_next16_and add al, 20h ; ' ' mov byte_266EE, al mov byte_266F2, 0FFh @@ -29254,7 +29157,7 @@ loc_19279: jl loc_19309 mov word_2671A, 0 push 3 - call sub_13D60 + call _randring2_next16_and inc al mov byte_2671D, al inc byte_2671F @@ -29268,7 +29171,7 @@ loc_19279: mov byte_266E3, 37h ; '7' mov byte_266EC, 26h ; '&' mov byte_266EF, 16h - call sub_13D52 + call _randring2_next16 mov byte_266ED, al call fp_2D004 mov byte_266EE, 10h @@ -29378,7 +29281,7 @@ loc_19387: jl loc_19417 mov word_2671A, 0 push 3 - call sub_13D76 + call _randring2_next16_mod inc al mov byte_2671D, al inc byte_2671F @@ -29392,7 +29295,7 @@ loc_19387: mov byte_266E3, 37h ; '7' mov byte_266EC, 26h ; '&' mov byte_266EF, 16h - call sub_13D52 + call _randring2_next16 mov byte_266ED, al call fp_2D004 mov byte_266EE, 10h @@ -29658,11 +29561,11 @@ var_2 = word ptr -2 cmp word_2671A, 10h jnz short loc_19647 push 1400h - call sub_13D76 + call _randring2_next16_mod add ax, 200h mov [bp+var_2], ax push 600h - call sub_13D76 + call _randring2_next16_mod add ax, 400h mov [bp+var_4], ax mov ax, [bp+var_2] @@ -29733,7 +29636,7 @@ sub_19686 proc near cmp word_2671A, 56h ; 'V' jnz short loc_196C2 push 1 - call sub_13D60 + call _randring2_next16_and mov byte_2671F, al cmp byte_2671F, 0 jnz short loc_196AD @@ -30017,7 +29920,7 @@ loc_1993D: loc_19942: mov byte_266EE, 20h ; ' ' push 1 - call sub_13D60 + call _randring2_next16_and or ax, ax jnz short loc_19954 mov al, 1 @@ -30029,13 +29932,13 @@ loc_19954: loc_19956: mov byte_266E2, al - call sub_13D52 + call _randring2_next16 mov byte_266ED, al call fp_2D004 call fp_2D000 add word ptr dword_266E4, 400h push 1 - call sub_13D60 + call _randring2_next16_and or ax, ax jnz short loc_1997A mov al, 1 @@ -30047,7 +29950,7 @@ loc_1997A: loc_1997C: mov byte_266E2, al - call sub_13D52 + call _randring2_next16 mov byte_266ED, al call fp_2D000 @@ -30305,7 +30208,7 @@ loc_19C23: loc_19C29: push 3 - call sub_13D60 + call _randring2_next16_and inc al mov byte_2671D, al mov al, byte_2D02C @@ -30718,7 +30621,7 @@ arg_0 = word ptr 4 loc_19F9F: push 800h - call sub_13D76 + call _randring2_next16_mod add ax, [bp+var_2] mov si, ax or si, si @@ -30735,7 +30638,7 @@ loc_19FB2: loc_19FBB: push si push 800h - call sub_13D76 + call _randring2_next16_mod add ax, [bp+var_4] push ax push 500h @@ -30782,7 +30685,7 @@ arg_0 = word ptr 4 loc_1A009: push 800h - call sub_13D76 + call _randring2_next16_mod add ax, [bp+var_2] mov si, ax or si, si @@ -30799,7 +30702,7 @@ loc_1A01C: loc_1A025: push si push 800h - call sub_13D76 + call _randring2_next16_mod add ax, [bp+var_4] push ax push 500h @@ -32588,18 +32491,18 @@ loc_1ACD9: mov byte_266EF, 4 mov byte_266F2, 88h push 18h - call sub_13D76 + call _randring2_next16_mod add al, 8 mov byte_266EE, al mov ax, word ptr dword_2670A add ax, 0FEC0h mov word ptr dword_266E4, ax - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov byte_2CFF7, 1 call fp_2D004 call sub_1CFB5 - call sub_13D52 + call _randring2_next16 mov byte_266ED, al add word ptr dword_266E4, 2C0h call sub_1CFB5 @@ -32696,7 +32599,7 @@ sub_1ADDB proc near jnz short loc_1AE40 mov byte_266E2, 2 mov byte_266E3, 3Ch ; '<' - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov byte_266EC, 26h ; '&' mov byte_266EF, 10h @@ -32887,7 +32790,7 @@ loc_1AFD0: mov byte_266EC, 2Dh ; '-' mov byte_266EF, 5 push 1Fh - call sub_13D60 + call _randring2_next16_and add al, 0Ch mov byte_266EE, al mov byte_266F0, 10h @@ -32895,7 +32798,7 @@ loc_1AFD0: mov ah, 0 add ax, ax push ax - call sub_13D76 + call _randring2_next16_mod mov dl, 40h sub dl, byte_2D02D add al, dl @@ -32907,7 +32810,7 @@ loc_1AFD0: mov ah, 0 add ax, ax push ax - call sub_13D76 + call _randring2_next16_mod mov dl, 40h sub dl, byte_2D02D add al, dl @@ -33044,7 +32947,7 @@ loc_1B13C: cmp byte_25688, 0 jz short loc_1B196 push 1 - call sub_13D60 + call _randring2_next16_and or ax, ax jz short loc_1B18F mov al, 1 @@ -33153,11 +33056,11 @@ sub_1B22B proc near mov byte_26718, al cmp byte_266CE, 0 jnz short loc_1B26D - call sub_13D52 + call _randring2_next16 push ax push 20h ; ' ' call sub_1A087 - call sub_13D52 + call _randring2_next16 push ax push 20h ; ' ' call sub_1A087 @@ -33456,7 +33359,7 @@ loc_1B4EB: mov word_25A0A, 0 mov byte_25A06, 1 push 1 - call sub_13D60 + call _randring2_next16_and mov byte_25A07, al jmp loc_1B8EA ; --------------------------------------------------------------------------- @@ -33553,7 +33456,7 @@ loc_1B5DB: loc_1B5E0: push 1200h - call sub_13D76 + call _randring2_next16_mod add ax, 300h push ax push 500h @@ -33670,7 +33573,7 @@ loc_1B6F7: loc_1B6FC: push 900h ; jumptable 0001B6E9 case 255 - call sub_13D76 + call _randring2_next16_mod add ax, 300h push ax push 500h @@ -33680,7 +33583,7 @@ loc_1B6FC: loc_1B710: push 3 - call sub_13D76 + call _randring2_next16_mod mov byte_2671D, al mov al, byte_25A02 cmp al, byte_2671D @@ -34931,23 +34834,23 @@ sub_1C1CF proc near mov byte_266EE, 20h ; ' ' mov byte_266EC, 26h ; '&' mov byte_266EF, 10h - call sub_13D52 + call _randring2_next16 mov byte_266ED, al sub word ptr dword_266E4, 200h call fp_2D004 call fp_2D000 - call sub_13D52 + call _randring2_next16 mov byte_266ED, al add word ptr dword_266E4, 400h call fp_2D000 - call sub_13D52 + call _randring2_next16 loc_1C21B: mov byte_266ED, al sub word ptr dword_266E4, 200h sub word ptr dword_266E4+2, 200h call fp_2D000 - call sub_13D52 + call _randring2_next16 mov byte_266ED, al add word ptr dword_266E4+2, 400h call fp_2D000 @@ -36956,7 +36859,7 @@ loc_1D0EB: ; --------------------------------------------------------------------------- loc_1D10C: - call sub_13D52 + call _randring2_next16 mov [bp+var_2], ax loc_1D112: @@ -36965,7 +36868,7 @@ loc_1D112: ; --------------------------------------------------------------------------- loc_1D119: - call sub_13D52 + call _randring2_next16 mov [bp+var_2], ax mov al, byte_266EF mov ah, 0 @@ -36976,10 +36879,10 @@ loc_1D119: ; --------------------------------------------------------------------------- loc_1D12B: - call sub_13D52 + call _randring2_next16 mov [bp+var_2], ax push 1Fh - call sub_13D60 + call _randring2_next16_and add al, [bp+var_3] mov [bp+var_3], al mov al, byte_266EF @@ -36992,7 +36895,7 @@ loc_1D12B: loc_1D148: push 1Fh - call sub_13D60 + call _randring2_next16_and mov [bp+var_2], ax sub [bp+var_2], 10h mov al, byte_266EF @@ -38129,12 +38032,12 @@ var_2 = word ptr -2 push si push di push 5 - call sub_13D76 + call _randring2_next16_mod mov [bp+var_6], ax loc_1DADC: push 5 - call sub_13D76 + call _randring2_next16_mod mov [bp+var_A], ax cmp ax, [bp+var_6] jz short loc_1DADC @@ -38188,7 +38091,7 @@ loc_1DB19: cmp [bp+var_6], di jz short loc_1DB6B push 1 - call sub_13D60 + call _randring2_next16_and mov [bp+var_8], ax jmp short loc_1DB70 ; --------------------------------------------------------------------------- @@ -39290,11 +39193,11 @@ loc_1E6B2: loc_1E6C8: push 800h - call sub_13D76 + call _randring2_next16_mod add ax, [bp+var_2] push ax push 800h - call sub_13D76 + call _randring2_next16_mod add ax, [bp+var_4] push ax mov bx, di @@ -40187,7 +40090,7 @@ sub_1EE21 proc near mov byte_2D056, 38h ; '8' mov eax, dword_2670A mov dword_2D044, eax - call sub_13D52 + call _randring2_next16 push ax mov al, byte_2D01E mov ah, 0 @@ -40231,18 +40134,18 @@ var_1 = byte ptr -1 or dx, dx jnz short loc_1EEF5 push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A add dx, 0FE00h add ax, dx mov word ptr dword_266E4, ax push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A+2 add dx, 0FE00h add ax, dx mov word ptr dword_266E4+2, ax - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov byte_266E2, 5 mov byte_266E3, 39h ; '9' @@ -40264,18 +40167,18 @@ loc_1EEF5: cmp dx, 10h jnz short loc_1EF6C push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A add dx, 0FE00h add ax, dx mov word ptr dword_266E4, ax push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A+2 add dx, 0FE00h add ax, dx mov word ptr dword_266E4+2, ax - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov byte_266E2, 1 mov byte_266EE, 18h @@ -40284,7 +40187,7 @@ loc_1EEF5: mov byte_266F0, 8 call fp_2D004 xor si, si - call sub_13D52 + call _randring2_next16 jmp short loc_1EF5D ; --------------------------------------------------------------------------- @@ -40335,7 +40238,7 @@ var_1 = byte ptr -1 mov byte_266E2, 1 mov byte_266EE, 80h push 7 - call sub_13D60 + call _randring2_next16_and add al, 0BCh mov byte_266ED, al mov byte_266EC, 2Dh ; '-' @@ -40351,13 +40254,13 @@ var_1 = byte ptr -1 or dx, dx jnz short loc_1F034 push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A add dx, 0FE00h add ax, dx mov word ptr dword_266E4, ax push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A+2 add dx, 0FE00h add ax, dx @@ -40443,7 +40346,7 @@ loc_1F0B0: mov byte_266E3, 39h ; '9' mov byte_266EC, 26h ; '&' mov byte_266EF, 20h ; ' ' - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov byte_266EE, 30h ; '0' mov byte_266F2, 82h @@ -40546,18 +40449,18 @@ loc_1F1AA: or dx, dx jnz short loc_1F227 push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A add dx, 0FE00h add ax, dx mov word ptr dword_266E4, ax push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A+2 add dx, 0FE00h add ax, dx mov word ptr dword_266E4+2, ax - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov byte_266E2, 1 mov byte_266EE, 18h @@ -40566,7 +40469,7 @@ loc_1F1AA: mov byte_266F0, 0Ah call fp_2D004 xor si, si - call sub_13D52 + call _randring2_next16 jmp short loc_1F218 ; --------------------------------------------------------------------------- @@ -40629,23 +40532,23 @@ loc_1F263: or dx, dx jnz short loc_1F2D9 push 1Fh - call sub_13D60 + call _randring2_next16_and add al, 10h mov byte_266EE, al mov byte_266EC, 2Dh ; '-' push 3 - call sub_13D60 + call _randring2_next16_and add al, 2 mov byte_266EF, al call fp_2D004 push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A add dx, 0FE00h add ax, dx mov word ptr dword_266E4, ax push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A+2 add dx, 0FE00h add ax, dx @@ -40948,7 +40851,7 @@ loc_1F547: cmp byte_2D028, 2 ja short loc_1F568 push 1 - call sub_13D60 + call _randring2_next16_and or ax, ax jz short loc_1F561 inc byte_2D028 @@ -41657,7 +41560,7 @@ loc_1FABE: mov byte_266EE, 46h ; 'F' mov byte_266EC, 26h ; '&' mov byte_266EF, 5Ah ; 'Z' - call sub_13D52 + call _randring2_next16 mov byte_266ED, al call fp_2D000 call snd_se_play pascal, 9 @@ -41712,11 +41615,11 @@ loc_1FB36: cmp byte_266CC, 0 jnz short loc_1FB84 push 3Fh ; '?' - call sub_13D60 + call _randring2_next16_and add al, 8 mov byte_266EE, al push 3 - call sub_13D60 + call _randring2_next16_and add al, 5 mov byte_266EF, al mov al, byte_2D02D @@ -41777,17 +41680,17 @@ loc_1FBAD: mov byte_266E2, 2 mov byte_266E3, 3Bh ; ';' push 3Fh ; '?' - call sub_13D60 + call _randring2_next16_and add al, 2Ah ; '*' mov byte_266EE, al push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A add dx, 0FE00h add ax, dx mov word ptr dword_266E4, ax push 200h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A+2 add dx, 0FE00h add ax, dx @@ -41795,7 +41698,7 @@ loc_1FBAD: mov byte_266ED, 0E0h call fp_2D002 push 3Fh ; '?' - call sub_13D60 + call _randring2_next16_and add al, 2Ah ; '*' mov byte_266EE, al mov byte_266ED, 0A0h @@ -41855,11 +41758,11 @@ loc_1FC68: mov byte_266E2, 2 mov byte_266E3, 3Ah ; ':' push 3Fh ; '?' - call sub_13D60 + call _randring2_next16_and add al, 10h mov byte_266EE, al push 400h - call sub_13D76 + call _randring2_next16_mod loc_1FC93: mov dx, word ptr dword_2670A ; jumptable 0001EA6B case 32792 @@ -41867,13 +41770,13 @@ loc_1FC93: add ax, dx mov word ptr dword_266E4, ax push 200h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A+2 add dx, 0FE60h add ax, dx mov word ptr dword_266E4+2, ax push 3Fh ; '?' - call sub_13D60 + call _randring2_next16_and add al, 10h mov byte_266EE, al mov byte_266ED, 80h @@ -41894,7 +41797,7 @@ loc_1FCE0: mov ax, word ptr dword_266E4+2 mov word ptr dword_2A8C6+2, ax push 1400h - call sub_13D76 + call _randring2_next16_mod add ax, 200h mov word ptr dword_2A8C6, ax mov byte_266EC, 2Ch ; ',' @@ -42135,7 +42038,7 @@ var_1 = byte ptr -1 cmp word_2671A, 1 jnz short loc_1FF2E push 1 - call sub_13D60 + call _randring2_next16_and mov [bp+var_1], al mov si, 0B204h xor di, di @@ -42153,7 +42056,7 @@ loc_1FEFB: loc_1FF0C: push 0C0h - call sub_13D76 + call _randring2_next16_mod mov dx, di imul dx, 180h add dx, 60h @@ -42285,16 +42188,16 @@ sub_20050 proc near mov byte_26718, 80h cmp byte_266CE, 0 jnz short loc_200B4 - call sub_13D52 + call _randring2_next16 mov byte_266ED, al push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A add dx, 0FE00h add ax, dx mov word ptr dword_266E4, ax push 200h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A+2 add dx, 0FE60h add ax, dx @@ -42304,7 +42207,7 @@ sub_20050 proc near mov byte_266E2, 2 mov byte_266E3, 4Ch ; 'L' push 3Fh ; '?' - call sub_13D60 + call _randring2_next16_and add al, 10h mov byte_266EE, al call fp_2D000 @@ -42353,7 +42256,7 @@ loc_200F6: mov byte_266EF, 3 mov byte_266E3, 39h ; '9' push 200h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A+2 add dx, 0FE60h add ax, dx @@ -42421,23 +42324,23 @@ loc_201AB: push 1 loc_201B4: - call sub_13D60 ; jumptable 0001F539 case 36296 + call _randring2_next16_and ; jumptable 0001F539 case 36296 mov byte_266E2, al push 400h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A add dx, 0FE00h add ax, dx mov word ptr dword_266E4, ax push 200h - call sub_13D76 + call _randring2_next16_mod mov dx, word ptr dword_2670A+2 add dx, 0FE60h add ax, dx mov word ptr dword_266E4+2, ax mov byte_266EC, 26h ; '&' mov byte_266EF, 20h ; ' ' - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov byte_266EE, 64h ; 'd' call fp_2D000 @@ -42497,7 +42400,7 @@ sub_2023B proc near mov byte_266EF, 20h ; ' ' mov byte_266E3, 4Ch ; 'L' mov byte_266E2, 2 - call sub_13D52 + call _randring2_next16 mov byte_266ED, al mov byte_266EE, 70h ; 'p' call fp_2D000 @@ -42610,7 +42513,7 @@ loc_20354: loc_20364: push 1000h - call sub_13D76 + call _randring2_next16_mod add ax, 400h mov word_2D05A, ax @@ -42689,7 +42592,7 @@ loc_203FB: loc_2040B: push 1000h - call sub_13D76 + call _randring2_next16_mod add ax, 400h mov word_2D05A, ax @@ -42768,7 +42671,7 @@ loc_204A2: loc_204B2: push 1000h - call sub_13D76 + call _randring2_next16_mod add ax, 400h mov word_2D05A, ax @@ -42847,7 +42750,7 @@ loc_20549: loc_20559: push 1000h - call sub_13D76 + call _randring2_next16_mod add ax, 400h mov word_2D05A, ax @@ -46966,72 +46869,8 @@ byte_25104 db ? word_25105 dw ? word_25107 dw ? word_25109 dw ? - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; db ? ; -word_2520C dw ? +include th02/math/randring[bss].asm byte_2520E db ? byte_2520F db ? dd ? ; diff --git a/th05/th05.asm b/th05/th05.asm index 97a748e2..19e27b89 100644 --- a/th05/th05.asm +++ b/th05/th05.asm @@ -2,3 +2,4 @@ GAME = 5 include defconv_pascal.inc include th04/formats/map.inc +include th04/math/randring_next.inc diff --git a/th05_main.asm b/th05_main.asm index fdbf9744..39574184 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -1199,7 +1199,7 @@ sub_B55A proc near mov fp_2C92E, offset sub_EE58 mov byte_2CE00, 1 nopcall sub_E4FC - call sub_BFFA + call _randring_fill call sub_16D67 call sub_C473 call sub_C264 @@ -2520,68 +2520,8 @@ sub_BFDA proc near retn 2 sub_BFDA endp - -; =============== S U B R O U T I N E ======================================= - - -sub_BFFA proc near - push si - mov si, 0FFh - -loc_BFFE: - call IRand - mov [si+3582h], al - dec si - jge short loc_BFFE - mov word_24062, 0 - pop si - retn -sub_BFFA endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_C012 proc near - mov bx, word_24062 - mov ax, [bx+3582h] - inc byte ptr word_24062 - retn -sub_C012 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_C020 proc near - mov bx, word_24062 - mov ax, [bx+3582h] - inc byte ptr word_24062 - mov bx, sp - and ax, ss:[bx+2] - retn 2 -sub_C020 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_C036 proc near - mov bx, word_24062 - mov ax, [bx+3582h] - inc byte ptr word_24062 - xor dx, dx - mov bx, sp - div word ptr ss:[bx+2] - mov ax, dx - retn 2 -sub_C036 endp - -; --------------------------------------------------------------------------- +include th03/math/randring_fill.asm +RANDRING_NEXT_DEF 1 nop ; =============== S U B R O U T I N E ======================================= @@ -3438,11 +3378,11 @@ var_2 = word ptr -2 loc_C583: push 1400h - call sub_C036 + call _randring1_next16_mod add ax, 200h mov [si], ax push 1700h - call sub_C036 + call _randring1_next16_mod mov [si+2], ax mov eax, [si] mov [di], eax @@ -3460,11 +3400,11 @@ loc_C583: mov [di], eax add di, 64h ; 'd' push 7Fh - call sub_C020 + call _randring1_next16_and add ax, 0A0h mov [bp+var_2], ax push 30h ; '0' - call sub_C036 + call _randring1_next16_mod sub al, 18h add al, 40h mov byte ptr [bp+var_5], al @@ -4051,7 +3991,7 @@ loc_CAA7: mov eax, dword_2CEA0 mov [si], eax mov word ptr [si+6], 100h - call sub_C012 + call _randring1_next16 mov [si+8], al loc_CAE0: @@ -5404,14 +5344,14 @@ loc_D471: mov word ptr [si+2], 0B80h mov word ptr [si+4], 0C00h mov word ptr [si+6], 0B80h - call sub_C012 + call _randring1_next16 mov [si+0Eh], al mov word ptr [si+0Ch], 0 lea ax, [si+8] push ax pushd 0 push 3Fh ; '?' - call sub_C020 + call _randring1_next16_and add ax, 20h ; ' ' push ax mov al, [si+0Eh] @@ -5733,10 +5673,10 @@ loc_D707: loc_D713: push 1800h - call sub_C036 + call _randring1_next16_mod mov [si], ax push 1800h - call sub_C036 + call _randring1_next16_mod mov [si+2], ax mov ax, [si] mov [si+4], ax @@ -5744,7 +5684,7 @@ loc_D713: mov word ptr [si+8], 0 mov word ptr [si+0Ah], 0 push 3 - call sub_C020 + call _randring1_next16_and add al, 0ACh ; '¬' mov [si+0Fh], al inc di @@ -13819,7 +13759,7 @@ arg_0 = word ptr 4 cmp di, 3E8h jge short loc_111EF push 20h ; ' ' - call sub_C036 + call _randring1_next16_mod add al, 30h ; '0' mov [si+1], al mov al, [si+1] @@ -13843,7 +13783,7 @@ loc_111EF: add ax, 30h ; '0' mov [bp+var_2], ax push 20h ; ' ' - call sub_C036 + call _randring1_next16_mod add al, byte ptr [bp+var_2] mov [si+1], al mov ax, di @@ -13865,7 +13805,7 @@ loc_11235: cmp di, 7D0h jge short loc_1125C push 20h ; ' ' - call sub_C036 + call _randring1_next16_mod add al, 40h mov [si+1], al mov al, [si+1] @@ -13890,7 +13830,7 @@ loc_1125C: sub dx, ax mov [bp+var_2], dx push 20h ; ' ' - call sub_C036 + call _randring1_next16_mod add al, byte ptr [bp+var_2] mov [si+1], al mov ax, di @@ -13911,7 +13851,7 @@ loc_112A0: cmp di, 0BB8h jge short loc_112C7 push 20h ; ' ' - call sub_C036 + call _randring1_next16_mod add al, 30h ; '0' mov [si+1], al mov al, [si+1] @@ -13936,7 +13876,7 @@ loc_112C7: sub dx, ax mov [bp+var_2], dx push 20h ; ' ' - call sub_C036 + call _randring1_next16_mod add al, byte ptr [bp+var_2] mov [si+1], al mov ax, di @@ -13961,7 +13901,7 @@ loc_1130F: cmp di, 0F80h jge short loc_11331 push 20h ; ' ' - call sub_C036 + call _randring1_next16_mod add al, 20h ; ' ' mov [si+1], al mov al, [si+1] @@ -13982,7 +13922,7 @@ loc_11331: add ax, 20h ; ' ' mov [bp+var_2], ax push 20h ; ' ' - call sub_C036 + call _randring1_next16_mod add al, byte ptr [bp+var_2] mov [si+1], al mov ax, di @@ -14181,7 +14121,7 @@ loc_114F8: mov si, ax mov byte ptr [si], 1 push 20h ; ' ' - call sub_C036 + call _randring1_next16_mod add al, 30h ; '0' mov [si+1], al mov al, [si+1] @@ -16603,7 +16543,7 @@ loc_128CA: loc_128D8: mov eax, [si] mov dword_25FFC, eax - call sub_C012 + call _randring1_next16 mov byte ptr word_26006, al call sub_15DE2 @@ -16747,7 +16687,7 @@ sub_129A1 proc near add ax, 0Ah push ax push 7 - call sub_C020 + call _randring1_next16_and add al, 0BCh push ax call sub_E4DE @@ -16785,7 +16725,7 @@ loc_129E9: lea ax, [si+0Ah] push ax push 0Fh - call sub_C020 + call _randring1_next16_and add al, 0B8h push ax call sub_E4DE @@ -17027,7 +16967,7 @@ loc_12B93: jnz short loc_12BAA sub word ptr [si+2], 180h push 3 - call sub_C020 + call _randring1_next16_and add al, 0B6h mov [bp-2], al jmp short loc_12BC3 @@ -17036,7 +16976,7 @@ loc_12B93: loc_12BAA: add word ptr [si+2], 180h push 3 - call sub_C020 + call _randring1_next16_and add al, 0C6h mov [bp-2], al cmp byte ptr [bp-3], 0 @@ -17113,7 +17053,7 @@ loc_12C30: jnz short loc_12C47 sub word ptr [si+2], 180h push 3 - call sub_C020 + call _randring1_next16_and add al, 0B6h mov [bp-2], al jmp short loc_12C60 @@ -17122,7 +17062,7 @@ loc_12C30: loc_12C47: add word ptr [si+2], 180h push 3 - call sub_C020 + call _randring1_next16_and add al, 0C6h mov [bp-2], al cmp byte ptr [bp-3], 0 @@ -17199,7 +17139,7 @@ loc_12CCD: jnz short loc_12CE4 sub word ptr [si+2], 180h push 3 - call sub_C020 + call _randring1_next16_and add al, 0B6h mov [bp-2], al jmp short loc_12CFD @@ -17208,7 +17148,7 @@ loc_12CCD: loc_12CE4: add word ptr [si+2], 180h push 3 - call sub_C020 + call _randring1_next16_and add al, 0C6h mov [bp-2], al cmp byte ptr [bp-3], 0 @@ -17278,7 +17218,7 @@ loc_12D5B: jnz short loc_12D6F sub word ptr [si+2], 180h push 3 - call sub_C020 + call _randring1_next16_and add al, 0B6h jmp short loc_12D7B ; --------------------------------------------------------------------------- @@ -17286,7 +17226,7 @@ loc_12D5B: loc_12D6F: add word ptr [si+2], 180h push 3 - call sub_C020 + call _randring1_next16_and add al, 0C6h loc_12D7B: @@ -17443,7 +17383,7 @@ loc_12E80: lea ax, [si+0Ah] push ax push 0Fh - call sub_C020 + call _randring1_next16_and add al, 0B8h push ax call sub_E4DE @@ -18543,7 +18483,7 @@ loc_136F8: lea ax, [si+0Ah] push ax push 0Fh - call sub_C020 + call _randring1_next16_and add al, 0B8h push ax call sub_E4DE @@ -19324,7 +19264,7 @@ loc_13C1D: cmp byte ptr [bp+var_2+1], 1 jnz short loc_13C33 push 0Fh - call sub_C020 + call _randring1_next16_and add al, 0B8h mov byte ptr [bp+var_2], al mov byte ptr [si+10h], 9 @@ -19501,7 +19441,7 @@ loc_13D41: jnz short loc_13D58 sub word ptr [si+2], 180h push 7 - call sub_C020 + call _randring1_next16_and add al, 0B4h mov byte ptr [bp+var_2], al jmp short loc_13D71 @@ -19510,7 +19450,7 @@ loc_13D41: loc_13D58: add word ptr [si+2], 180h push 7 - call sub_C020 + call _randring1_next16_and add al, 0C4h ; 'A' mov byte ptr [bp+var_2], al cmp [bp+var_3], 0 @@ -22099,7 +22039,7 @@ loc_154FF: ; --------------------------------------------------------------------------- loc_15507: - call sub_157D6 + call _randring2_next16 mov [si+1Ah], al mov al, 1 jmp loc_15740 @@ -22166,7 +22106,7 @@ loc_1557A: ; --------------------------------------------------------------------------- loc_1557F: - call sub_157D6 + call _randring2_next16 mov [si+34h], al mov al, 1 jmp loc_15740 @@ -22538,49 +22478,7 @@ off_1575F dw offset loc_15388 ; --------------------------------------------------------------------------- nop -; =============== S U B R O U T I N E ======================================= - - -sub_157D6 proc near - mov bx, word_24062 - mov ax, [bx+3582h] - inc byte ptr word_24062 - retn -sub_157D6 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_157E4 proc near - mov bx, word_24062 - mov ax, [bx+3582h] - inc byte ptr word_24062 - mov bx, sp - and ax, ss:[bx+2] - retn 2 -sub_157E4 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_157FA proc near - mov bx, word_24062 - mov ax, [bx+3582h] - inc byte ptr word_24062 - xor dx, dx - mov bx, sp - div word ptr ss:[bx+2] - mov ax, dx - retn 2 -sub_157FA endp - -; --------------------------------------------------------------------------- +RANDRING_NEXT_DEF 2 db 0 ; =============== S U B R O U T I N E ======================================= @@ -22750,7 +22648,7 @@ loc_15930: mov ax, [bp+arg_4] mov [si+4], ax push 1Fh - call sub_157E4 + call _randring2_next16_and add ax, [bp+arg_2] lea bx, [si+0Ah] push bx @@ -23143,9 +23041,9 @@ loc_15B83: ; --------------------------------------------------------------------------- loc_15B9D: - mov si, word_24062 - mov al, [si+3582h] - inc byte ptr word_24062 + mov si, _randring_p + mov al, _randring[si] + inc byte ptr _randring_p and al, 1Fh add cl, al @@ -23156,10 +23054,10 @@ loc_15BAD: inc di loc_15BB4: - mov si, word_24062 - mov si, [si+3582h] + mov si, _randring_p + mov si, word ptr _randring[si] and si, 0FFh - inc byte ptr word_24062 + inc byte ptr _randring_p jmp short loc_15BF8 ; --------------------------------------------------------------------------- @@ -23705,7 +23603,7 @@ loc_15F30: cmp di, 3E70h jnz short loc_15F6D push 1800h - call sub_157FA + call _randring2_next16_mod mov di, ax loc_15F6D: @@ -23724,7 +23622,7 @@ loc_15F7C: cmp [bp+var_4], 3E70h jnz short loc_15F8F push 1700h - call sub_157FA + call _randring2_next16_mod mov [bp+var_4], ax loc_15F8F: @@ -23753,7 +23651,7 @@ loc_15FB9: mov byte ptr [si+1Eh], 0 mov byte ptr [si+22h], 0 mov byte ptr [si+24h], 0 - call sub_157D6 + call _randring2_next16 mov [si+26h], al mov byte ptr [si+27h], 80h mov byte ptr [si+2Eh], 0Fh @@ -25172,7 +25070,7 @@ arg_0 = word ptr 4 cmp word_26335+1, 900h jge short loc_16BF5 push 60h - call sub_157FA + call _randring2_next16_mod sub al, 30h ; '0' jmp short loc_16C09 ; --------------------------------------------------------------------------- @@ -25181,13 +25079,13 @@ loc_16BF5: cmp word_26335+1, 0F00h jle short loc_16C06 push 60h - call sub_157E4 + call _randring2_next16_and add al, 30h ; '0' jmp short loc_16C09 ; --------------------------------------------------------------------------- loc_16C06: - call sub_157D6 + call _randring2_next16 loc_16C09: mov byte ptr word_2634A, al @@ -25528,12 +25426,12 @@ var_2 = word ptr -2 push si push di push 5 - call sub_157FA + call _randring2_next16_mod mov [bp+var_6], ax loc_16E37: push 5 - call sub_157FA + call _randring2_next16_mod mov [bp+var_A], ax cmp ax, [bp+var_6] jz short loc_16E37 @@ -25587,7 +25485,7 @@ loc_16E74: cmp [bp+var_6], di jz short loc_16EC6 push 1 - call sub_157E4 + call _randring2_next16_and mov [bp+var_8], ax jmp short loc_16ECB ; --------------------------------------------------------------------------- @@ -26231,7 +26129,7 @@ arg_0 = word ptr 4 loc_173DD: push 800h - call sub_157FA + call _randring2_next16_mod add ax, [bp+var_2] mov si, ax or si, si @@ -26248,7 +26146,7 @@ loc_173F0: loc_173F9: push si push 800h - call sub_157FA + call _randring2_next16_mod add ax, [bp+var_4] push ax push 500h @@ -26294,7 +26192,7 @@ arg_0 = word ptr 4 loc_17448: push 800h - call sub_157FA + call _randring2_next16_mod add ax, [bp+var_2] mov si, ax or si, si @@ -26311,7 +26209,7 @@ loc_1745B: loc_17464: push si push 800h - call sub_157FA + call _randring2_next16_mod add ax, [bp+var_4] push ax push 3E8h @@ -27877,7 +27775,7 @@ loc_18029: mov byte ptr word_26006+1, 18h mov byte ptr word_25FFA+1, 2Ch ; ',' call fp_25344 - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al push word ptr dword_26320 push 200h @@ -28284,14 +28182,14 @@ sub_183F5 proc near mov ax, word_26346 add ax, ax push ax - call sub_157FA + call _randring2_next16_mod sub al, byte ptr word_26346 add al, 40h mov byte ptr word_26006, al mov word ptr dword_26002, 303h mov byte_26001, 0Ah push 1Fh - call sub_157E4 + call _randring2_next16_and add al, 10h mov byte ptr word_26006+1, al call fp_25344 @@ -28302,12 +28200,12 @@ sub_183F5 proc near mov ax, word_26346 add ax, ax push ax - call sub_157FA + call _randring2_next16_mod sub al, byte ptr word_26346 add al, 40h mov byte ptr word_26006, al push 1Fh - call sub_157E4 + call _randring2_next16_and add al, 18h mov byte ptr word_26006+1, al call fp_25344 @@ -28336,7 +28234,7 @@ sub_1847D proc near mov byte ptr word_25FFA, 2 mov byte ptr word_25FFA+1, 30h ; '0' mov byte_26000, 4 - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al mov byte ptr word_26006+1, 20h ; ' ' mov byte ptr dword_26002, 0Ch @@ -28672,7 +28570,7 @@ loc_187BA: loc_187DE: push 4 - call sub_157FA + call _randring2_next16_mod inc al mov byte_26349, al cmp al, byte_2D080 @@ -28732,7 +28630,7 @@ loc_18843: loc_18862: push 4 - call sub_157FA + call _randring2_next16_mod inc al mov byte_26349, al cmp al, byte_2D080 @@ -28888,7 +28786,7 @@ sub_18987 proc near mov byte_26000, 6 mov word ptr dword_26002+2, 803h mov byte ptr word_26006+1, 18h - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al call fp_25344 call sub_15A5C @@ -28909,7 +28807,7 @@ loc_189DB: loc_189E8: mov byte ptr word_26006+1, 18h - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al call fp_25344 call sub_15A5C @@ -28934,7 +28832,7 @@ sub_189FC proc near mov byte_26000, 6 mov word ptr dword_26002+2, 0F03h mov byte ptr word_26006+1, 18h - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al call fp_25344 call sub_15A5C @@ -29096,7 +28994,7 @@ arg_2 = word ptr 6 enter 2, 0 cmp word_26346, 1 jnz short loc_18BDC - call sub_157D6 + call _randring2_next16 mov [bp+var_1], al push ds push offset word_2633E @@ -29504,7 +29402,7 @@ loc_18ED9: mov word_26318, 1Eh mov word_26314, 68h ; 'h' push 1 - call sub_157E4 + call _randring2_next16_and mov byte_2D085, al loc_18F04: @@ -29589,7 +29487,7 @@ loc_18F93: mov byte_26001, 2 mov byte_2C976, 1 push 1 - call sub_157E4 + call _randring2_next16_and or ax, ax jz short loc_18FBB mov byte_2C977, 20h ; ' ' @@ -30504,17 +30402,17 @@ loc_1978A: or di, di jz short loc_197D9 push 1400h - call sub_157FA + call _randring2_next16_mod add ax, 200h mov [si+6], ax push 0A00h - call sub_157FA + call _randring2_next16_mod add ax, 100h mov [si+8], ax cmp [bp+var_2], 0 jnz short loc_197C2 push 3 - call sub_157E4 + call _randring2_next16_and add ax, ax mov bx, ax mov ax, off_22768[bx] @@ -30524,7 +30422,7 @@ loc_1978A: loc_197C2: push 3 - call sub_157E4 + call _randring2_next16_and add ax, ax mov bx, ax mov ax, off_22768[bx] @@ -30658,7 +30556,7 @@ loc_198CF: mov byte_26000, 0 mov eax, [si+2] mov dword_25FFC, eax - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al call fp_25344 call sub_15A5C @@ -30983,16 +30881,16 @@ loc_19B57: loc_19B59: mov byte ptr word_25FFA+1, al push 3Fh ; '?' - call sub_157E4 + call _randring2_next16_and add al, 0Ch mov byte ptr word_26006+1, al push 300h - call sub_157FA + call _randring2_next16_mod add ax, word_26335+1 sub ax, 180h mov word ptr dword_25FFC, ax push 300h - call sub_157FA + call _randring2_next16_mod add ax, word_26338 sub ax, 200h mov word ptr dword_25FFC+2, ax @@ -31613,7 +31511,7 @@ loc_1A1A2: cmp byte ptr word_2634A+1, 18h jnb short loc_1A1F8 push 3 - call sub_157FA + call _randring2_next16_mod add ax, ax mov dl, byte_2D07D mov dh, 0 @@ -31899,7 +31797,7 @@ arg_4 = word ptr 8 cmp word ptr [si], 900h jge short loc_1A47E push 60h - call sub_157FA + call _randring2_next16_mod sub al, 30h ; '0' jmp short loc_1A490 ; --------------------------------------------------------------------------- @@ -31908,13 +31806,13 @@ loc_1A47E: cmp word ptr [si], 0F00h jle short loc_1A48D push 60h - call sub_157E4 + call _randring2_next16_and add al, 30h ; '0' jmp short loc_1A490 ; --------------------------------------------------------------------------- loc_1A48D: - call sub_157D6 + call _randring2_next16 loc_1A490: mov [si+14h], al @@ -32127,7 +32025,7 @@ sub_1A5EB proc near mov byte ptr word_25FFA, 12h mov byte_26000, 7 push 3Fh ; '?' - call sub_157E4 + call _randring2_next16_and sub al, 20h ; ' ' mov byte ptr word_26006, al mov byte ptr word_25FFA+1, 2Fh ; '/' @@ -32138,7 +32036,7 @@ sub_1A5EB proc near mov word ptr dword_25FFC+2, ax mov word ptr dword_26002+2, 602h push 1Fh - call sub_157E4 + call _randring2_next16_and add al, 10h mov byte ptr word_26006+1, al call fp_25344 @@ -32431,7 +32329,7 @@ loc_1A843: or dx, dx jnz short loc_1A8B2 push 7 - call sub_157E4 + call _randring2_next16_and add al, 10h mov dl, byte_2D085 sub dl, al @@ -32474,7 +32372,7 @@ sub_1A8C9 proc near mov byte ptr word_25FFA, 10h mov byte_26000, 3 push 3Fh ; '?' - call sub_157E4 + call _randring2_next16_and sub al, 20h ; ' ' mov byte ptr word_26006, al mov byte ptr word_25FFA+1, 32h ; '2' @@ -32486,7 +32384,7 @@ sub_1A8C9 proc near mov word ptr dword_26002, 507h mov byte_26001, 0Ah push 1Fh - call sub_157E4 + call _randring2_next16_and add al, 10h mov byte ptr word_26006+1, al call fp_25344 @@ -32514,7 +32412,7 @@ sub_1A921 proc near jnz short loc_1A966 mov byte ptr word_25FFA, 10h mov byte_26000, 4 - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al mov byte ptr word_25FFA+1, 32h ; '2' mov ax, word ptr dword_2634E @@ -32652,7 +32550,7 @@ sub_1AA4C proc near jnz short loc_1AA97 mov byte ptr word_25FFA, 10h mov byte_26000, 2 - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al mov byte ptr word_25FFA+1, 0 mov ax, word ptr dword_2634E @@ -32662,7 +32560,7 @@ sub_1AA4C proc near mov word ptr dword_25FFC+2, ax mov word ptr dword_26002, 202h push 1Fh - call sub_157E4 + call _randring2_next16_and add al, 18h mov byte ptr word_26006+1, al call fp_25344 @@ -32717,7 +32615,7 @@ loc_1AAAF: or dx, dx jnz short loc_1AB1B push 7 - call sub_157E4 + call _randring2_next16_and add al, byte_2D084 add al, 10h mov byte_2D084, al @@ -33291,11 +33189,11 @@ loc_1B039: cmp si, 20h ; ' ' jnz short loc_1B058 push 1000h - call sub_157FA + call _randring2_next16_mod add ax, 400h mov word_2CE3A, ax push 200h - call sub_157FA + call _randring2_next16_mod add ax, 400h mov word ptr dword_26320+2, ax jmp short loc_1B09F @@ -33394,12 +33292,12 @@ loc_1B0FC: loc_1B0FE: mov byte ptr word_25FFA+1, al push 300h - call sub_157FA + call _randring2_next16_mod add ax, word ptr dword_26320 sub ax, 180h mov word ptr dword_25FFC, ax push 300h - call sub_157FA + call _randring2_next16_mod add ax, word ptr dword_26320+2 sub ax, 200h mov word ptr dword_25FFC+2, ax @@ -33908,7 +33806,7 @@ sub_1B557 proc near mov bp, sp cmp word_26346, 30h ; '0' jnz short loc_1B599 - call sub_157D6 + call _randring2_next16 mov byte_2D085, al mov byte_2D084, 1 mov byte ptr word_25FFA, 10h @@ -34016,11 +33914,11 @@ loc_1B64D: or dx, dx jnz short loc_1B68E push 1Fh - call sub_157E4 + call _randring2_next16_and add al, 8 mov byte ptr word_26006+1, al push 7 - call sub_157E4 + call _randring2_next16_and mov byte ptr dword_26002, al mov byte ptr dword_26002+1, 6 call fp_25344 @@ -34086,10 +33984,10 @@ loc_1B6ED: idiv bx or dx, dx jnz short loc_1B71B - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al push 1Fh - call sub_157E4 + call _randring2_next16_and add al, 20h ; ' ' mov byte ptr word_26006+1, al call sub_15A5C @@ -34158,7 +34056,7 @@ loc_1B799: or dx, dx jnz short loc_1B7F9 push 1Fh - call sub_157E4 + call _randring2_next16_and add al, 10h mov byte ptr word_26006+1, al call sub_15A5C @@ -35328,7 +35226,7 @@ var_2 = word ptr -2 jnz short loc_1C2AB mov byte_26344, 0C0h push 0Fh - call sub_157E4 + call _randring2_next16_and add ax, 10h mov [bp+var_2], ax mov word_26318, 20h ; ' ' @@ -35434,7 +35332,7 @@ var_2 = word ptr -2 jnz short loc_1C3B0 mov byte_26309, 8 mov byte_26313, 8 - call sub_157D6 + call _randring2_next16 mov [bp+var_2], ax mov al, byte_25FEB mov ah, 0 @@ -35561,7 +35459,7 @@ loc_1C460: cmp [bp+var_2], 0D4h jle short loc_1C483 push 1Fh - call sub_157E4 + call _randring2_next16_and or ax, ax jnz short loc_1C483 mov ax, 0FFh @@ -36185,7 +36083,7 @@ arg_2 = word ptr 6 enter 2, 0 cmp word_26346, 1 jnz short loc_1C9E7 - call sub_157D6 + call _randring2_next16 mov [bp+var_1], al push ds push offset word_2633E @@ -36253,7 +36151,7 @@ sub_1CA42 proc near mov byte_2BC88, 50h ; 'P' mov byte ptr word_2BC71, 70h ; 'p' push 1 - call sub_157E4 + call _randring2_next16_and mov byte_2D085, al pop bp retn @@ -36340,13 +36238,13 @@ loc_1CB23: idiv bx or dx, dx jnz short loc_1CB5D - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al push 561Ch push word_26335+1 push word_26338 push 200h - call sub_157FA + call _randring2_next16_mod push ax mov al, byte ptr word_26006 mov ah, 0 @@ -36450,14 +36348,14 @@ loc_1CC3E: or dx, dx jnz short loc_1CC7F push 1Fh - call sub_157E4 + call _randring2_next16_and sub al, 0Fh mov [bp+var_1], al push 600h - call sub_157FA + call _randring2_next16_mod mov word_2BC74, ax push 1600h - call sub_157FA + call _randring2_next16_mod add ax, 100h mov word_2BC71+1, ax push ax @@ -36773,7 +36671,7 @@ loc_1CFC3: jnz short loc_1D030 mov word ptr dword_2630A+2, 200h push 1000h - call sub_157FA + call _randring2_next16_mod add ax, 400h mov word ptr dword_2630A, ax push ax @@ -36788,14 +36686,14 @@ loc_1CFC3: loc_1CFFA: push 1Fh - call sub_157E4 + call _randring2_next16_and sub al, 0Fh mov [bp+var_1], al push 600h - call sub_157FA + call _randring2_next16_mod mov word_2BC74, ax push 1600h - call sub_157FA + call _randring2_next16_mod add ax, 100h mov word_2BC71+1, ax push ax @@ -36870,7 +36768,7 @@ sub_1D085 proc near mov word_2BC7E, 20h ; ' ' mov byte_2BC88, 40h push 200h - call sub_157FA + call _randring2_next16_mod mov word ptr dword_2634E+2, ax push 28001Eh push 180010h @@ -36918,7 +36816,7 @@ loc_1D148: cmp word ptr dword_2634E+2, 1780h jl short loc_1D1C4 push 200h - call sub_157FA + call _randring2_next16_mod mov word ptr dword_2634E+2, ax inc byte_2D083 pop bp @@ -37496,11 +37394,11 @@ sub_1D667 proc near mov byte ptr word_26006+1, 20h ; ' ' mov byte_26000, 4 mov byte_26001, 0Ah - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al mov byte ptr dword_26002, 10h push 1 - call sub_157E4 + call _randring2_next16_and or ax, ax jz short loc_1D6A2 mov al, 2 @@ -37557,7 +37455,7 @@ sub_1D6E1 proc near mov byte ptr word_25FFA, 12h mov byte ptr word_25FFA+1, 2Ch ; ',' mov byte_26000, 4 - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al mov byte ptr dword_26002, 10h push 10000Ch @@ -37579,7 +37477,7 @@ loc_1D719: push word_26335+1 push word_26338 push 200h - call sub_157FA + call _randring2_next16_mod push ax mov al, byte ptr word_26006 mov ah, 0 @@ -37811,22 +37709,22 @@ loc_1D954: loc_1D972: push 1000h - call sub_157FA + call _randring2_next16_mod add ax, word_26335+1 sub ax, 800h mov word ptr dword_25FFC, ax push 400h - call sub_157FA + call _randring2_next16_mod mov dx, word_26338 sub dx, ax add dx, 100h mov word ptr dword_25FFC+2, dx push 60h - call sub_157FA + call _randring2_next16_mod add al, 10h mov byte ptr word_26006, al push 3Fh ; '?' - call sub_157E4 + call _randring2_next16_and add al, 18h mov byte ptr word_26006+1, al call sub_15A5C @@ -37914,15 +37812,15 @@ sub_1DA1C proc near or dx, dx jnz short loc_1DA6A push 1800h - call sub_157FA + call _randring2_next16_mod mov word_2BC71+1, ax push 400h - call sub_157FA + call _randring2_next16_mod add ax, 200h mov word_2BC74, ax mov byte ptr word_2BC71, 40h push 1Fh - call sub_157E4 + call _randring2_next16_and add al, 30h ; '0' mov byte_2BC88, al mov word_2BC82, 0C8h @@ -37937,12 +37835,12 @@ loc_1DA6A: or dx, dx jnz short loc_1DAD0 push 1000h - call sub_157FA + call _randring2_next16_mod add ax, word_26335+1 sub ax, 800h mov word ptr dword_25FFC, ax push 400h - call sub_157FA + call _randring2_next16_mod mov dx, word_26338 sub dx, ax mov word ptr dword_25FFC+2, dx @@ -38001,7 +37899,7 @@ loc_1DB10: mov byte ptr word_25FFA, 12h mov byte_26000, 2 push 1Fh - call sub_157E4 + call _randring2_next16_and add al, 30h ; '0' mov byte ptr word_26006+1, al mov word ptr dword_26002, 806h @@ -38014,7 +37912,7 @@ loc_1DB10: mov word_2BC82, 0Bh mov byte_2BC88, 40h push 3 - call sub_157FA + call _randring2_next16_mod shl al, 6 mov byte ptr word_2BC71, al call sub_17687 @@ -38070,22 +37968,22 @@ loc_1DBB8: loc_1DBCA: push 1000h - call sub_157FA + call _randring2_next16_mod add ax, word_26335+1 sub ax, 800h mov word_2BC71+1, ax push 400h - call sub_157FA + call _randring2_next16_mod mov dx, word_26338 sub dx, ax add dx, 100h mov word_2BC74, dx push 40h - call sub_157FA + call _randring2_next16_mod add al, 20h ; ' ' mov byte ptr word_2BC71, al push 3Fh ; '?' - call sub_157E4 + call _randring2_next16_and add al, 20h ; ' ' mov byte_2BC88, al call sub_1D53A @@ -38374,12 +38272,12 @@ loc_1DEEA: or dx, dx jnz short loc_1DF41 push 1000h - call sub_157FA + call _randring2_next16_mod add ax, word_26335+1 sub ax, 800h mov word_2BC71+1, ax push 400h - call sub_157FA + call _randring2_next16_mod mov dx, word_26338 sub dx, ax add dx, 100h @@ -39155,7 +39053,7 @@ sub_1E60E proc near cmp word_26332, 5Eh ; '^' jnz short loc_1E62A push 1 - call sub_157E4 + call _randring2_next16_and or ax, ax jz short loc_1E625 mov al, 1 @@ -39534,11 +39432,11 @@ sub_1E922 proc near mov bp, sp mov byte ptr word_25FFA, 10h push 1Fh - call sub_157E4 + call _randring2_next16_and add al, 28h ; '(' mov byte ptr word_26006+1, al push 7Fh - call sub_157E4 + call _randring2_next16_and and al, 0F8h sub al, 40h mov byte ptr word_26006, al @@ -39713,12 +39611,12 @@ loc_1EAA9: or dx, dx jnz short loc_1EAE3 push 600h - call sub_157FA + call _randring2_next16_mod add ax, word ptr dword_25FFC sub ax, 300h mov word_2CE52, ax push 400h - call sub_157FA + call _randring2_next16_mod add ax, word ptr dword_25FFC+2 sub ax, 200h mov word_2CE54, ax @@ -39798,11 +39696,11 @@ sub_1EB52 proc near jnz loc_1EBF0 mov byte ptr word_25FFA, 10h push 1Fh - call sub_157E4 + call _randring2_next16_and add al, 0Ch mov byte ptr word_26006+1, al push 7Fh - call sub_157E4 + call _randring2_next16_and add al, 80h mov byte ptr word_26006, al mov byte_26000, 2 @@ -39820,12 +39718,12 @@ sub_1EB52 proc near call snd_se_play pascal, 3 mov byte ptr word_25FFA, 12h push 600h - call sub_157FA + call _randring2_next16_mod sub ax, 300h add ax, word ptr dword_25FFC mov word ptr dword_25FFC, ax push 400h - call sub_157FA + call _randring2_next16_mod sub ax, 200h add ax, word ptr dword_25FFC+2 mov word ptr dword_25FFC+2, ax @@ -39991,7 +39889,7 @@ sub_1ECD4 proc near mov byte ptr word_25FFA, 10h mov byte ptr word_25FFA+1, 44h ; 'D' mov byte_26000, 4 - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al mov byte ptr word_26006+1, 40h mov word ptr dword_26002, 0A20h @@ -40088,7 +39986,7 @@ sub_1EDC1 proc near mov word ptr dword_26002, 907h mov byte ptr word_25FFA+1, 44h ; 'D' push 300h - call sub_157FA + call _randring2_next16_mod sub ax, 180h add ax, word ptr dword_25FFC mov word ptr dword_25FFC, ax @@ -40475,7 +40373,7 @@ sub_1F13B proc near call snd_se_play pascal, 8 mov byte ptr word_25FFA+1, 74h ; 't' mov byte_26000, 2 - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al mov word ptr dword_26002, 1505h mov byte_2D085, 0 @@ -41186,16 +41084,16 @@ sub_1F7BA proc near mov byte_26000, 4 mov byte ptr dword_26002, 10h push 400h - call sub_157FA + call _randring2_next16_mod sub ax, 200h add ax, word ptr dword_25FFC mov word ptr dword_25FFC, ax push 400h - call sub_157FA + call _randring2_next16_mod sub ax, 200h add ax, word ptr dword_25FFC+2 mov word ptr dword_25FFC+2, ax - call sub_157D6 + call _randring2_next16 mov byte ptr word_26006, al call sub_15A5C call snd_se_play pascal, 3 @@ -41665,11 +41563,11 @@ loc_1FB2D: loc_1FB43: push 800h - call sub_157FA + call _randring2_next16_mod add ax, [bp+var_2] push ax push 800h - call sub_157FA + call _randring2_next16_mod add ax, [bp+var_4] push ax mov bx, di @@ -45539,71 +45437,7 @@ fp_23F5A dw ? byte_23F5E db ? db ? ; word_23F60 dw ? - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; -word_24062 dw ? +include th02/math/randring[bss].asm byte_24064 db ? byte_24065 db ? dd ? ;