; Davids Sound demo v0.1c ; ; ; Special thanks to Eric Linenberg for fixing up the code! ; ; intro: ; just a demo of sound from the link port, use a 2.5mm ; to 3.5mm (standard) headphone adaptor, avalible from radio ; shack. Its ok if the adaptor is mono though sterio would ; alow you more divercity. Left and Right arrows adjust volume (sort of) ; there is an error in the second delay loop, so occasionaly it changes ; the pitch as well! ; ; Remember!!! if you want to modify this for sterio you must build your ; own adapter, or you will only get sound from one ear!!!! ; you need to swap the red and black wires coming out of the calc ; ; 2.5mm plug tip-----------outer ring 3.5mm jack ; midle ring-----------midle ring ; outer ring-----------tip ; ; ; Revision History ; v0.01 First introdused, just squalked ; v0.1a mutch faster and simpler model, alows for sepret adjustment ; of the delay loops for more interesting sounds! ; v0.1b same as v0.1a but adjustible volume (sort of) ; v0.1C Same as v0.1b but ported to the ti-86 :) ; ; ; David Tucker ; dh90791@goodnet.com ; ; ELinenberg@gnn.com (Eric Linenberg) ; ; Michael Malluck (malluck@bellsouth.net) #include "asm86.h" #include "ti86asm.inc" ;=========================================== ; DEFINES ;=========================================== #define P_HI %11000000 ;code to put port high #define P_LO %11111100 ;code to put port low #define C_PORT %00000111 ;addres of com port .org _asm_exec_ram ;============================================================ ; this just setus up the home screen and loads DE with 255 ;============================================================ ;main: call _clrLCD ; Clear the display ld hl, $0000 ;set the cursor to 0 ld (_curRow), hl ld hl, TitleStr call _putc ;display text LD HL,$8641 ;init loop counter-- the initial delay LD (HL),$FF LD HL,$8642 LD (HL),$FF big_loop: set_low: ld b,P_LO ;set w(white) and r(red) low, 0 0 ld c,C_PORT ;port 7 (link port) out (c),b ;output 0 0 ld a,($8641) ;First delay loop ld b,a ;the one that controlls volume delay1: ;the longer the loop djnz delay1 ;the louder the volume set_high: ld b,P_HI ;set w & r high, 1 1 (default) ld c,C_PORT ;port 7 (com port) out (c),b ;output 1 1,make sure this is the last to be outputted! ;pulse the port high, must be high when quiting testkey: ld a,%00111110 ;this is the mask for the keycheck out (1),a ;send 0 to the keyboard port in a,(1) ;check the keyboard port directly. bit 6,a ;EXIT (among others) pressed? jr z,quit ;jump to quit ld a,%01111110 out (1),a ;send 0 to the keyboard port in a,(1) ;check the keyboard port directly. bit 3,a ;UP (among others) pressed? jr z,up bit 0,a ;DOWN (among other) pressed? jr z,down bit 2,a ;LEFT (among others) pressed? jr z,left bit 1,a ;RIGHT (among other) pressed? jr z,right Back_key: ld a,($8641) ;second delay loop dec a ;corect for the rolover error ld b,a ;used to compensate for the change in the first loop ld a,$FF ;too keep the over all time constant sub b ;so there is no change in pitch ; add a,$01 ld b,a delay2: ;delay loop djnz delay2 ld a,($8642) ;Third delay loop ld b,a ;loop 2 and 3 could be combined into a delay3: ;bigger loop nop ;extra delays to bring down the pitch nop ;if you turnd the loop into a 16 bit loop nop ;you could get the full range without the delay nop nop nop djnz delay3 jr big_loop quit: ret ;=========================================== ; gotten keypresses ;=========================================== up: LD HL,$8642 ;Increase Tone DEC (HL) jr Back_key ; & return down: LD HL,$8642 ;Decrease Tone INC (HL) jr Back_key ; & return left: LD HL,$8641 ;Decrease volume DEC (HL) jr Back_key ; & return right: LD HL,$8641 ;Increase volume INC (HL) jr Back_key ; & return TitleStr: ;Intro to program, rahter wasteful but cute .db " dSound86 " .db "up/down change pitch " .db " L/R change vol " .db " exit to exit ",0 .END .END .END