diff --git a/th04/formats/cdg_put_noalpha.asm b/th04/formats/cdg_put_noalpha.asm new file mode 100644 index 00000000..fe25e518 --- /dev/null +++ b/th04/formats/cdg_put_noalpha.asm @@ -0,0 +1,67 @@ +; Displays the CDG image in the given [slot] at (⌊x/8⌋*8, y), disregarding its +; alpha plane. + +; void pascal _cdg_put_noalpha(int x, int y, int slot); +public _cdg_put_noalpha +_cdg_put_noalpha proc far + +@@slot = word ptr 6 +@@y = word ptr 8 +@@x = word ptr 10 + + push bp + mov bp, sp + push si + push di + push ds + mov ax, [bp+@@y] + mov bx, ax + shl ax, 2 + add ax, bx + add ax, 0A800h + mov es, ax + add ax, 3800h + push ax + sub ax, 2800h + push ax + sub ax, 800h + push ax + mov si, [bp+@@slot] + shl si, 4 + add si, offset _cdg_slots + mov bx, [bp+@@x] + sar bx, 3 + add bx, [si+CDGSlot.vram_byte_at_bottom_left] + mov ax, [si+CDGSlot.width_divided_by_32] + mov bp, ax + shl ax, 2 + add ax, (640 / 8) + mov dx, ax + mov ax, [si+CDGSlot.sgm_colors] + mov ds, ax + xor si, si + mov al, 4 + cld + nop + +@@plane: + mov di, bx + +@@row: + mov cx, bp + rep movsd + sub di, dx + jns short @@row + dec al + jz short @@ret + pop es + jmp short @@plane + +@@ret: + pop ds + pop di + pop si + pop bp + retf 6 +_cdg_put_noalpha endp + align 2 diff --git a/th04_main.asm b/th04_main.asm index f6055c7e..4e26d36a 100644 --- a/th04_main.asm +++ b/th04_main.asm @@ -1371,9 +1371,9 @@ loc_B64C: loc_B65A: mov PaletteTone, 0 call far ptr palette_show - push 200070h + push (32 shl 16) or 112 push 31 - call sub_136B4 + call _cdg_put_noalpha call _cdg_free pascal, 31 push 1 call palette_black_in @@ -11677,9 +11677,9 @@ var_1 = byte ptr -1 mov dx, 7Ch mov al, GC_OFF out dx, al - push 200038h + push (32 shl 16) or 56 push 0 - call sub_136B4 + call _cdg_put_noalpha cmp byte_256A9, 50h ; 'P' ja short loc_10096 mov byte_25592, 9 @@ -11756,9 +11756,9 @@ var_2 = word ptr -2 mov dx, 7Ch mov al, GC_OFF out dx, al - push 200038h + push (32 shl 16) or 56 push 0 - call sub_136B4 + call _cdg_put_noalpha cmp byte_256A9, 50h ; 'P' ja short loc_1015E mov byte_25592, 0Fh @@ -15754,15 +15754,12 @@ sub_12124 endp sub_12157 proc near arg_0 = byte ptr 4 -arg_2 = word ptr 6 -arg_4 = word ptr 8 +@@y = word ptr 6 +@@x = word ptr 8 push bp mov bp, sp - push [bp+arg_4] - push [bp+arg_2] - push 10h - call sub_136B4 + call _cdg_put_noalpha pascal, [bp+@@x], [bp+@@y], 16 call sub_C15C mov ah, [bp+arg_0] call sub_C162 @@ -16012,9 +16009,9 @@ loc_12309: mov dx, 7Ch mov al, GC_OFF out dx, al - push 600048h - push 10h - call sub_136B4 + push (96 shl 16) or 72 + push 16 + call _cdg_put_noalpha loc_12327: mov ax, word_2D02E @@ -16094,9 +16091,9 @@ loc_12396: mov dx, 7Ch mov al, GC_OFF out dx, al - push 800080h - push 10h - call sub_136B4 + push (128 shl 16) or 128 + push 16 + call _cdg_put_noalpha loc_123B4: mov ax, word_2D02E @@ -16895,9 +16892,9 @@ loc_129B4: mov dx, 7Ch mov al, GC_OFF out dx, al - push 200010h - push 10h - call sub_136B4 + push (32 shl 16) or 16 + push 16 + call _cdg_put_noalpha loc_129D2: mov ax, word_2D02E @@ -18120,76 +18117,7 @@ sub_13666 endp ; --------------------------------------------------------------------------- db 0 -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_136B4 proc far - -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - push bp - mov bp, sp - push si - push di - push ds - mov ax, [bp+arg_2] - mov bx, ax - shl ax, 2 - add ax, bx - add ax, 0A800h - mov es, ax - add ax, 3800h - push ax - sub ax, 2800h - push ax - sub ax, 800h - push ax - mov si, [bp+arg_0] - shl si, 4 - add si, 3978h - mov bx, [bp+arg_4] - sar bx, 3 - add bx, [si+6] - mov ax, [si+8] - mov bp, ax - shl ax, 2 - add ax, 50h ; 'P' - mov dx, ax - mov ax, [si+0Eh] - mov ds, ax - xor si, si - mov al, 4 - cld - nop - -loc_13700: - mov di, bx - -loc_13702: - mov cx, bp - rep movsd - sub di, dx - jns short loc_13702 - dec al - jz short loc_13712 - pop es - jmp short loc_13700 -; --------------------------------------------------------------------------- - -loc_13712: - pop ds - pop di - pop si - pop bp - retf 6 -sub_136B4 endp - -; --------------------------------------------------------------------------- - nop - +include th04/formats/cdg_put_noalpha.asm loc_1371A: push bp mov bp, sp diff --git a/th04_op.asm b/th04_op.asm index efccaa35..0c399b01 100644 --- a/th04_op.asm +++ b/th04_op.asm @@ -4760,14 +4760,14 @@ sub_D3A2 proc near mov bp, sp cmp byte_132B8, 0 jnz short loc_D407 - push 28002Ch - push 28h ; '(' - call sub_E176 + push (40 shl 16) or 44 + push 40 + call _cdg_put_noalpha push 1 call sub_D0FF - push 1500034h - push 29h ; ')' - call sub_E176 + push (336 shl 16) or 52 + push 41 + call _cdg_put_noalpha push 1 call sub_D20A call grcg_setcolor pascal, (GC_RMW shl 16) + 1 @@ -4785,14 +4785,14 @@ sub_D3A2 proc near ; --------------------------------------------------------------------------- loc_D407: - push 148002Ch - push 29h ; ')' - call sub_E176 + push (328 shl 16) or 44 + push 41 + call _cdg_put_noalpha push 0 call sub_D0FF - push 300034h - push 28h ; '(' - call sub_E176 + push (48 shl 16) or 52 + push 40 + call _cdg_put_noalpha push 0 call sub_D20A call grcg_setcolor pascal, (GC_RMW shl 16) + 1 @@ -5054,17 +5054,17 @@ sub_D650 proc near mov bp, sp cmp byte_132B8, 0 jnz short loc_D664 - push 0B8002Ch - push 28h ; '(' + push (184 shl 16) or 44 + push 40 jmp short loc_D66C ; --------------------------------------------------------------------------- loc_D664: - push 0B8002Ch - push 29h ; ')' + push (184 shl 16) or 44 + push 41 loc_D66C: - call sub_E176 + call _cdg_put_noalpha call grcg_setcolor pascal, (GC_RMW shl 16) + 1 push 370034h push 37011Fh @@ -5916,76 +5916,7 @@ sub_E0F4 endp ; --------------------------------------------------------------------------- db 0 - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_E176 proc far - -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - push bp - mov bp, sp - push si - push di - push ds - mov ax, [bp+arg_2] - mov bx, ax - shl ax, 2 - add ax, bx - add ax, 0A800h - mov es, ax - add ax, 3800h - push ax - sub ax, 2800h - push ax - sub ax, 800h - push ax - mov si, [bp+arg_0] - shl si, 4 - add si, 2716h - mov bx, [bp+arg_4] - sar bx, 3 - add bx, [si+6] - mov ax, [si+8] - mov bp, ax - shl ax, 2 - add ax, 50h ; 'P' - mov dx, ax - mov ax, [si+0Eh] - mov ds, ax - xor si, si - mov al, 4 - cld - nop - -loc_E1C2: - mov di, bx - -loc_E1C4: - mov cx, bp - rep movsd - sub di, dx - jns short loc_E1C4 - dec al - jz short loc_E1D4 - pop es - jmp short loc_E1C2 -; --------------------------------------------------------------------------- - -loc_E1D4: - pop ds - pop di - pop si - pop bp - retf 6 -sub_E176 endp - -; --------------------------------------------------------------------------- - nop +include th04/formats/cdg_put_noalpha.asm include th04/hardware/input_sense.asm include th04/snd/se.asm diff --git a/th05_main.asm b/th05_main.asm index 992005e0..d55a16e5 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -1640,9 +1640,9 @@ loc_BA9C: loc_BAAA: mov PaletteTone, 0 call far ptr palette_show - push 500070h + push (80 shl 16) or 112 push 31 - call sub_14C7C + call _cdg_put_noalpha call _cdg_free pascal, 31 push 1 call palette_black_in @@ -3453,9 +3453,9 @@ sub_C567 endp sub_C73A proc near push bp mov bp, sp - push 500010h + push (80 shl 16) or 16 push 0 - call sub_14C7C + call _cdg_put_noalpha call sub_CEC2 call sub_C567 mov byte_2C92C, 9 @@ -3737,9 +3737,9 @@ sub_C84F endp sub_C99E proc near push bp mov bp, sp - push 700010h + push (112 shl 16) or 16 push 0 - call sub_14C7C + call _cdg_put_noalpha call sub_CEF2 cmp byte_2429B, 10h jnb short loc_C9D0 @@ -3935,9 +3935,9 @@ sub_CB30 proc near push bp mov bp, sp push si - push 400040h + push (64 shl 16) or 64 push 0 - call sub_14C7C + call _cdg_put_noalpha call sub_CF50 call grcg_setcolor pascal, (GC_RMW shl 16) + 7 push 0D10010h @@ -4131,9 +4131,9 @@ sub_CC9E endp sub_CD1C proc near push bp mov bp, sp - push 600010h + push (96 shl 16) or 16 push 0 - call sub_14C7C + call _cdg_put_noalpha call sub_CFBA call sub_CC9E mov byte_2C92C, 9 @@ -4647,10 +4647,7 @@ arg_4 = word ptr 8 push bp mov bp, sp - push [bp+arg_4] - push [bp+arg_2] - push 10h - call sub_14C7C + call _cdg_put_noalpha pascal, [bp+arg_4], [bp+arg_2], 16 call sub_E6E8 mov ah, [bp+arg_0] call sub_E6EE @@ -4762,9 +4759,9 @@ loc_D124: mov dx, 7Ch mov al, GC_OFF out dx, al - push 200010h - push 10h - call sub_14C7C + push (32 shl 16) or 16 + push 16 + call _cdg_put_noalpha loc_D142: mov byte_24498, 0 @@ -4842,9 +4839,9 @@ loc_D1B0: mov dx, 7Ch mov al, GC_OFF out dx, al - push 2000DDh - push 10h - call sub_14C7C + push (32 shl 16) or 221 + push 16 + call _cdg_put_noalpha loc_D1CE: mov byte_24498, 0Fh @@ -4923,9 +4920,9 @@ loc_D23E: mov dx, 7Ch mov al, GC_OFF out dx, al - push 600048h - push 10h - call sub_14C7C + push (96 shl 16) or 72 + push 16 + call _cdg_put_noalpha loc_D25C: mov byte_24498, 9 @@ -5000,9 +4997,9 @@ loc_D2C7: mov dx, 7Ch mov al, GC_OFF out dx, al - push 200010h - push 10h - call sub_14C7C + push (32 shl 16) or 16 + push 16 + call _cdg_put_noalpha loc_D2E5: mov byte_24498, 0Fh @@ -6132,9 +6129,9 @@ loc_DAFB: ; --------------------------------------------------------------------------- loc_DB0A: - push 200100h - push 11h - call sub_14C7C + push (32 shl 16) or 256 + push 17 + call _cdg_put_noalpha call sub_E950 call sub_DA25 call grcg_setcolor pascal, (GC_RMW shl 16) + 6 @@ -20864,74 +20861,7 @@ include th03/formats/hfliplut.asm include th04/snd/pmd_res.asm include th02/snd/mmd_res.asm include th04/snd/detmodes.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_14C7C proc far - -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - push bp - mov bp, sp - push si - push di - push ds - mov ax, [bp+arg_2] - mov bx, ax - shl ax, 2 - add ax, bx - add ax, 0A800h - mov es, ax - add ax, 3800h - push ax - sub ax, 2800h - push ax - sub ax, 800h - push ax - mov si, [bp+arg_0] - shl si, 4 - add si, 307Eh - mov bx, [bp+arg_4] - sar bx, 3 - add bx, [si+6] - mov ax, [si+8] - mov bp, ax - shl ax, 2 - add ax, 50h ; 'P' - mov dx, ax - mov ax, [si+0Eh] - mov ds, ax - xor si, si - mov al, 4 - cld - nop - -loc_14CC8: - mov di, bx - -loc_14CCA: - mov cx, bp - rep movsd - sub di, dx - jns short loc_14CCA - dec al - jz short loc_14CDA - pop es - jmp short loc_14CC8 -; --------------------------------------------------------------------------- - -loc_14CDA: - pop ds - pop di - pop si - pop bp - retf 6 -sub_14C7C endp - +include th04/formats/cdg_put_noalpha.asm include th04/snd/se.asm include th04/formats/cdg_put.asm diff --git a/th05_maine.asm b/th05_maine.asm index 25ce0241..fe77c4f4 100644 --- a/th05_maine.asm +++ b/th05_maine.asm @@ -7050,7 +7050,7 @@ sub_DCFC proc near var_4 = word ptr -4 var_2 = word ptr -2 arg_0 = word ptr 4 -arg_2 = word ptr 6 +@@slot = word ptr 6 arg_4 = word ptr 8 arg_6 = word ptr 0Ah @@ -7082,10 +7082,7 @@ arg_6 = word ptr 0Ah mov word_151C4, ax mov word_151C6, 0 inc word_11848 - push [bp+arg_6] - push di - push [bp+arg_2] - call sub_EA6E + call _cdg_put_noalpha pascal, [bp+arg_6], di, [bp+@@slot] mov [bp+var_2], 0 jmp short loc_DDB1 ; --------------------------------------------------------------------------- @@ -7237,7 +7234,7 @@ sub_DE74 proc near var_4 = word ptr -4 var_2 = word ptr -2 arg_0 = word ptr 4 -arg_2 = word ptr 6 +@@slot = word ptr 6 arg_4 = word ptr 8 arg_6 = word ptr 0Ah @@ -7269,10 +7266,7 @@ arg_6 = word ptr 0Ah mov word_151C8, ax mov word_151CA, 0 inc word_1184A - push [bp+arg_6] - push di - push [bp+arg_2] - call sub_EA6E + call _cdg_put_noalpha pascal, [bp+arg_6], di, [bp+@@slot] mov [bp+var_2], 0 jmp short loc_DF29 ; --------------------------------------------------------------------------- @@ -8516,78 +8510,7 @@ loc_EA68: retn sub_EA5E endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_EA6E proc far - -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - push bp - mov bp, sp - push si - push di - push ds - mov ax, [bp+arg_2] - mov bx, ax - shl ax, 2 - add ax, bx - add ax, 0A800h - mov es, ax - assume es:nothing - add ax, 3800h - push ax - sub ax, 2800h - push ax - sub ax, 800h - push ax - mov si, [bp+arg_0] - shl si, 4 - add si, 29FEh - mov bx, [bp+arg_4] - sar bx, 3 - add bx, [si+6] - mov ax, [si+8] - mov bp, ax - shl ax, 2 - add ax, 50h ; 'P' - mov dx, ax - mov ax, [si+0Eh] - mov ds, ax - xor si, si - mov al, 4 - cld - nop - -loc_EABA: - mov di, bx - -loc_EABC: - mov cx, bp - rep movsd - sub di, dx - jns short loc_EABC - dec al - jz short loc_EACC - pop es - jmp short loc_EABA -; --------------------------------------------------------------------------- - -loc_EACC: - pop ds - pop di - pop si - pop bp - retf 6 -sub_EA6E endp - -; --------------------------------------------------------------------------- - nop - +include th04/formats/cdg_put_noalpha.asm include th04/snd/se.asm ; =============== S U B R O U T I N E ======================================= diff --git a/th05_op.asm b/th05_op.asm index 6d6526c0..10f52f34 100644 --- a/th05_op.asm +++ b/th05_op.asm @@ -4707,7 +4707,7 @@ loc_CF59: push ax mov al, byte ptr word_14118 mov ah, 0 - add ax, 28h ; '(' + add ax, 40 push ax jmp short loc_CF8C ; --------------------------------------------------------------------------- @@ -4717,10 +4717,10 @@ loc_CF82: push ax lea ax, [di-8] push ax - push 2Dh ; '-' + push 45 loc_CF8C: - call sub_D590 + call _cdg_put_noalpha call grcg_setcolor pascal, (GC_RMW shl 16) + 1 lea ax, [si+0D8h] mov bx, 8 @@ -4801,10 +4801,10 @@ loc_D012: loc_D050: push si push di - push 2Dh ; '-' + push 45 loc_D054: - call sub_D590 + call _cdg_put_noalpha mov al, byte ptr word_14118 mov ah, 0 imul ax, 5 @@ -5360,75 +5360,7 @@ loc_D58A: retn sub_D580 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_D590 proc far - -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - push bp - mov bp, sp - push si - push di - push ds - mov ax, [bp+arg_2] - mov bx, ax - shl ax, 2 - add ax, bx - add ax, 0A800h - mov es, ax - assume es:nothing - add ax, 3800h - push ax - sub ax, 2800h - push ax - sub ax, 800h - push ax - mov si, [bp+arg_0] - shl si, 4 - add si, 3A96h - mov bx, [bp+arg_4] - sar bx, 3 - add bx, [si+6] - mov ax, [si+8] - mov bp, ax - shl ax, 2 - add ax, 50h ; 'P' - mov dx, ax - mov ax, [si+0Eh] - mov ds, ax - xor si, si - mov al, 4 - cld - nop - -loc_D5DC: - mov di, bx - -loc_D5DE: - mov cx, bp - rep movsd - sub di, dx - jns short loc_D5DE - dec al - jz short loc_D5EE - pop es - jmp short loc_D5DC -; --------------------------------------------------------------------------- - -loc_D5EE: - pop ds - pop di - pop si - pop bp - retf 6 -sub_D590 endp - +include th04/formats/cdg_put_noalpha.asm include th04/snd/se.asm ; =============== S U B R O U T I N E =======================================