152b INCLUDELIB GRAPHICS INCLUDELIB SOUND INCLUDELIB XMS INCLUDE GRAPHICS.INC INCLUDE SOUND.INC INCLUDE XMS.INC INCLUDE DOS.INC INCLUDE BIOS.INC calc_offs MACRO x_val,y_val mov ax,y_val mov dx,320 mul dx add ax,x_val ENDM plot MACRO wdth,hght,src_seg,src_offs,dest_seg,dest_offs LOCAL y_lp, x_lp, skip_palreg0,w_hor mov bx,hght mov cx,0 mov es,dest_seg mov di,dest_offs push ds mov si,src_offs mov ds,src_seg y_lp: mov ax,wdth x_lp: mov cl,ds:[si] jcxz skip_palreg0 mov es:[di],cl skip_palreg0: inc si inc di dec ax jnz x_lp add si,320-wdth ;next line add di,320-wdth dec bx jnz y_lp pop ds ENDM plotx MACRO wdth,hght,src_seg,src_offs,dest_seg,dest_offs LOCAL y_rlp mov bx,hght mov es,dest_seg mov di,dest_offs push ds mov si,src_offs mov ds,src_seg y_rlp: mov cx,wdth/2 rep movsw add si,320-wdth add di,320-wdth dec bx jnz y_rlp pop ds ENDM rest MACRO wdth,hght,src_seg,src_offs,dest_seg,dest_offs LOCAL y_rlp mov bx,hght mov es,dest_seg mov di,dest_offs push ds mov si,src_offs mov ds,src_seg y_rlp: mov cx,wdth/2 rep movsw add si,320-wdth add di,320-wdth dec bx jnz y_rlp pop ds ENDM DOSSEG .MODEL SMALL .386 .STACK 100h .DATA sampname1 db 'queensr.voc',0 sampname2 db 'yes.voc',0 sample1 dw ? sample2 dw ? backname db 'back.LBM',0 spritename db 'balls.LBM',0 inbyte db ? handle dw ? vidseg dw 0A000h backseg dw ? backdupseg dw ? spriteseg dw ? ball1_pos dw ? ball2_pos dw ? ball3_pos dw ? sampseg dw ? samp1_off dw ? samp2_off dw ? samp3_off dw ? samp4_off dw ? ball1_table dw 32120,31813,31187,30239,28970,27698,25785,24188,22269,20348,18423,16816,15207,14236 dw 13263,12929,12915,12902,13849,14797,16067,17658,19253,21170,23090,25012,26938,28545 dw 29835,30807,31460,31794,31808,31501,30874,29605,28335,26742,24827,22909,20989,19065 dw 17459,15851,14560,13588,12935,12921,12907,13534,14161,15431,17022,18615,20531,22450 dw 24371,25975,27902,29191,30482,31454,31788,0ffffh ball2_table dw 07BE8h,08EB8h,09B52h,0A1BCh,097DEh,08A38h,07B48h,06C5Ah,068B8h,0740Ch,08596h,09FD2h,0B000h,0B12Ah,0AD58h dw 0AD48h,0B376h,0BD68h,0C758h,0D140h,0D25Eh,0C840h,0B07Ah,09A08h,08256h,0695Eh,057DCh,05190h,04F02h,048B6h dw 0426Eh,04266h,04620h,04B1Eh,0551Ch,0619Ch,06F62h,0ffffh ball3_table dw 0141Eh,02598h,03996h,05298h,066AAh,070C2h,0771Ah,07874h,0738Ah,06C20h,065ECh,05FB8h,05842h,0548Ch,04E58h dw 04E62h,04FAEh,04E7Ah,04702h,03A82h,0307Ch,02B72h,02522h,0214Ch,01C28h,01E94h,024CAh,02C40h,03132h,0311Ch dw 02990h,01BC8h,0107Eh,00DF2h,0ffffh table_off1 dw 0 table_off2 dw 0 table_off3 dw 0 ball_delay dw 0 .CODE .STARTUP @ModBlock 65536/16 ; call init_ctvoice ; call xms_setup ; mov dx,offset sampname1 ; call xms_load ; mov sample1,ax @SetMode 13h call ld_back call ld_balls call dis_clock ; mov dx,sample1 ; mov di,0 ; mov si,1ah ; call play_xms_sample again: call do_balls mov cx,2 vlp: call vsync loop vlp plotx 64,55,backseg,ball1_pos,vidseg,ball1_pos ; plotx 64,55,backseg,ball2_pos,vidseg,ball2_pos ; plotx 64,55,backseg,ball3_pos,vidseg,ball3_pos mov ah,1 int 16h jnz quit rest 64,55,backdupseg,ball1_pos,backseg,ball1_pos ; rest 64,55,backdupseg,ball2_pos,backseg,ball2_pos ; rest 64,55,backdupseg,ball3_pos,backseg,ball3_pos add table_off1,2 add table_off2,2 add table_off3,2 jmp again quit: @GetChar ; call stop_sample ;stop any voice ; call exit_ctvoice ; mov dx,sample1 ; call xms_free call ena_clock mov es,backseg @FreeBlock mov es,backdupseg @FreeBlock mov es,spriteseg @FreeBlock @SetMode 3 .EXIT do_balls PROC NEAR mov bx,table_off1 cmp ball1_table[bx],0ffffh jnz no_reset1 mov bx,0 mov table_off1,0 no_reset1: mov dx,ball1_table[bx] mov ball1_pos,dx plot 64,55,spriteseg,649,backseg,ball1_pos jmp only_oneball ;---------------------------------------------- mov bx,table_off2 ;draw green ball cmp ball2_table[bx],0ffffh jnz no_reset2 mov bx,0 mov table_off2,0 no_reset2: mov dx,ball2_table[bx] mov ball2_pos,dx plot 64,55,spriteseg,712,backseg,ball2_pos ;----------------------------------------------------------- mov bx,table_off3 cmp ball3_table[bx],0ffffh jnz no_reset3 mov bx,0 mov table_off3,0 no_reset3: mov dx,ball3_table[bx] mov ball3_pos,dx plot 64,55,spriteseg,776,backseg,ball3_pos only_oneball: ret do_balls ENDP ld_back PROC INVOKE load_iff,1,offset backname mov backseg,ax mov si,0 mov di,0 mov es,vidseg push ds mov ds,backseg mov cx,64000/4 rep movsd pop ds @getblock 64000/16 mov backdupseg,ax mov si,0 mov di,0 mov es,backdupseg push ds mov ds,backseg mov cx,64000/4 rep movsd pop ds ret ld_back ENDP ld_balls PROC @GetBlock 500 INVOKE load_iff,1,offset spritename mov spriteseg,ax ret ld_balls ENDP dis_clock PROC mov dx,21h in al,dx or al,1 out dx,al ret dis_clock ENDP ena_clock PROC mov dx,21h in al,dx and al,0feh out dx,al ret ena_clock ENDP END . 0