; SineML.dsm ; L. Stewart August 24, 1982 12:54 PM C←CODE SEGMENT ASSUME CS:C←CODE, DS:C←DATA ; Generate Sine wave ; int Sine(initialphase, &SineCB); ; where SineCB is a pointer to the control block ; and Sine returns the final phase ; The control block has the fields ; destination pointer ; sample count ; frequency ; sinetable ←Sine PROC NEAR MOV DI,[BX] ; destination MOV DX,CX ; initial phase MOV CX,[2+BX] ; count (bytes) OR CX,CX JZ sdone MOV SI,[4+BX] ; frequency MOV BX,[6+BX] ; sinetable CLD ; increment DI on STOSB sloop: ADD DX,SI ; phase increment MOV AL,DH ; upper 8 bits of phase are table index XLATB ; fetch from table STOSB ; store into destination and increment LOOP sloop ; decrement count and loop sdone: MOV BX,DX RET ←Sine ENDP PUBLIC ←Sine C←CODE ENDS END