Post Your Message
Previous Messages Posted Byzbyti on 2021-03-23 05:31:23 Re: Mad Pascal @gerliczer you mean freq constans? Ok, I'll check recommended materials. THX :]
Posted Bygerliczer on 2021-03-23 04:23:11 Re: Mad Pascal That note table looks quite wrong to me. Please, refer to SVS ' excellent Ultimate Map . That has note tables for different TV standard system based on the findings of TLC 's extensive research (see here ) into the operation of TED sound generators back in 2000.
Posted Byzbyti on 2021-03-22 17:07:03 Re: Mad Pascal //----------------------------------------------------------------------------- // Commodore Plus/4, C16 or 264 TED sound frequency tables PAL // https://www.dtech.lv/techarticles_plus4_freq.html //----------------------------------------------------------------------------- const a0 = 7; a1 = 516; a2 = 770; a3 = 897; a4 = 960; a5 = 992; a0is = 64; a1is = 544; a2is = 784; a3is = 904; a4is = 964; a5is = 994; b0 = 118; b1 = 571; b2 = 798; b3 = 911; b4 = 967; b5 = 996; c1 = 169; c2 = 597; c3 = 810; c4 = 917; c5 = 971; c6 = 997; c1is = 217; c2is = 621; c3is = 822; c4is = 923; c5is = 974; d1 = 262; d2 = 643; d3 = 834; d4 = 929; d5 = 976; d1is = 305; d2is = 665; d3is = 844; d4is = 934; d5is = 979; e1 = 345; e2 = 685; e3 = 854; e4 = 939; e5 = 982; f1 = 383; f2 = 704; f3 = 864; f4 = 944; f5 = 984; f1is = 419; f2is = 722; f3is = 873; f4is = 948; f5is = 986; g1 = 453; g2 = 739; g3 = 881; g4 = 953; g5 = 988; g1is = 485; g2is = 755; g3is = 889; g4is = 957; g5is = 990; //----------------------------------------------------------------------------- // Zielony mosteczek //----------------------------------------------------------------------------- const music_notes: array [0..39] of word = ( c3,c3,c3,c3,e3,g3,f3,e3,d3,c3, g3,g3,g3,e3,g3,c4,a3,g3,f3,e3, d3,d3,d3,d3,f3,a3,g3,f3,e3,d3, c3,c3,c3,c3,e3,g3,f3,e3,d3,c3 ); music_duration: array [0..39] of byte = ( 2,2,4,2,2,4,2,2,4,8, 2,2,4,2,2,4,3,1,2,2, 2,2,4,2,2,4,3,1,2,2, 2,2,4,2,2,4,2,2,4,4 ); //----------------------------------------------------------------------------- const TEMPO = 3; //----------------------------------------------------------------------------- {* $FF0E 0-7 Low byte of frequency for voice 1 $FF0F 0-7 Low byte of frequency for voice 2 $FF10 0-1 High 2 bits of frequency for voice 2 $FF11 0-3 Volume 4 Select voice 1 (0 = off, 1 = on) 5 Select voice 2 (0 = off, 1 = on) 6 Select noise for voice 2 (0 = off, 1 = on) 7 Sound switch (0 = on, 1 = off) $FF12 0-1 High 2 bits of frequency for voice 1 2-7 Nonsound uses *} var TED_FF0E : byte absolute $FF0E; TED_FF11 : byte absolute $FF11; TED_FF12 : byte absolute $FF12; //----------------------------------------------------------------------------- var note : word; duration : byte; i, ii : byte; //----------------------------------------------------------------------------- begin //Select voice 1 with maximum volume TED_FF11 := $9f; for i := 0 to SizeOf(music_duration)-1 do begin duration := music_duration[i] shl TEMPO; note := music_notes[i]; TED_FF0E := Lo(note); TED_FF12 := (TED_FF12 and $fc) or Hi(note); //Turn on sound TED_FF11 := TED_FF11 and $7f; for ii := duration downto 1 do pause; //Turn off sound TED_FF11 := TED_FF11 or $80; pause; end; end.
Posted Byzbyti on 2021-03-20 08:16:55 Re: Mad Pascal hgfx_apl.rc APLBIN rcdata 'mp.apl' hires_apl.pas //Mad Pascal logo by @bocianu {$r hgfx_apl.rc} uses aplib; const APLBIN = $3000; LOGO = $5800; var SETBITMAP : byte absolute $ff06; SETMCOLOR : byte absolute $ff07; BITMAPADDR : byte absolute $ff12; VIDEOMATRIX : byte absolute $ff14; BORDER : byte absolute $ff19; begin unapl(pointer(APLBIN), pointer(LOGO)); SETBITMAP := SETBITMAP or $20; SETMCOLOR := (SETMCOLOR and $40) or $8; // (01011xxx) $5800 = 11 * $800; VIDEOMATRIX := %01011000; // (xx011xxx) $6000 = 3 * $2000; bit 2 set to 0 means reading from RAM BITMAPADDR := %00011000 or (BITMAPADDR and %00000011); BORDER := $3d; repeat until false; end.
Posted Byseff on 2021-03-19 15:56:31 Re: Mad Pascal Nice
Posted Byzbyti on 2021-03-19 09:23:40 Mad Pascal Mad Pascal Doc: link msx.rc MUSIC rcdata 'demo.tzp.prg' 2 plasma.pas // 06_plasma.ras, Turbo Rascal example // TEDzakker demo music {$r msx.rc} uses fastmath; //----------------------------------------------------------------------------- const COLOURRAM_ADDR = $0800; SCREEN_ADDR = $0c00; SCR_W = 40; SCR_H = 25; MUSIC = $4000; DATA_CHAR: array [0..127] of byte = ( $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $10, $00, $00, $00, $00, $00, $00, $18, $18, $00, $00, $00, $00, $00, $00, $38, $38, $38, $00, $00, $00, $00, $00, $3c, $3c, $3c, $3c, $00, $00, $00, $7c, $7c, $7c, $7c, $7c, $00, $00, $00, $7e, $7e, $7e, $7e, $7e, $7e, $00, $fe, $fe, $fe, $fe, $fe, $fe, $fe, $00, $00, $7f, $7f, $7f, $7f, $7f, $7f, $7f, $00, $7e, $7e, $7e, $7e, $7e, $7e, $00, $00, $7c, $7c, $7c, $7c, $7c, $00, $00, $00, $00, $3c, $3c, $3c, $3c, $00, $00, $00, $00, $38, $38, $38, $00, $00, $00, $00, $00, $18, $18, $00, $00, $00, $00, $00, $00, $00, $08, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ); //----------------------------------------------------------------------------- var DETIRQSRC : byte absolute $ff09; //detect IRQ source, and clear IRQ flag SETIRQSRC : byte absolute $ff0a; //set IRQ source RC : byte absolute $ff0b; //raser counter bits 0-7 RAMROMSEL : byte absolute $ff12; CHBAS : byte absolute $ff13; BACKGROUND : byte absolute $ff15; BORDER : byte absolute $ff19; VCOUNT : byte absolute $ff1d; //vertical line bits 0-7 IRQVEC : word absolute $fffe; //----------------------------------------------------------------------------- var c1A : byte = 1; c1B : byte = 5; scrn : PByte absolute $60; charset : array [0..0] of byte absolute $3000; sinusTable : array [0..255] of byte absolute $3100; lookupDiv16 : array [0..255] of byte absolute $3200; xbuf : array [0..39] of byte absolute $3300; //----------------------------------------------------------------------------- procedure InitDivision16; var x: byte; begin for x:=0 to 255 do lookupDiv16[x] := x shr 4; // Simply store values divided by 16 end; procedure InitCharset; begin Move(DATA_CHAR, charset, SizeOf(DATA_CHAR)); // set bit 2 RAMROMSEL := RAMROMSEL and %11111011; // 12 = $3000 / $400 on 2-7 bits CHBAS := (CHBAS and %11) or 12 shl 2; end; //----------------------------------------------------------------------------- procedure doPlasma; var _c1a, _c1b : byte; i, ii, tmp : byte; begin scrn := pointer(SCREEN_ADDR); _c1a := c1A; _c1b := c1B; for i := (SCR_W - 1) downto 0 do begin xbuf := sinusTable[_c1a] + sinusTable[_c1b]; Inc(_c1a, 3); Inc(_c1b, 7); end; for ii := (SCR_H - 1) downto 0 do begin tmp := sinusTable[_c1a] + sinusTable[_c1b]; Inc(_c1a, 4); Inc(_c1b, 9); for i := (SCR_W - 1) downto 0 do scrn := lookupDiv16[xbuf + tmp]; Inc(scrn, 40); end; Inc(c1A, 3); Dec(c1B, 5); end; //----------------------------------------------------------------------------- procedure vbi; assembler; interrupt; asm { phr mva #2 DETIRQSRC inc c4p_time+2 bne off inc c4p_time+1 bne off inc c4p_time off: jsr MUSIC+3; plr }; end; //----------------------------------------------------------------------------- begin asm { sei \ sta $ff3f txa:pha \ lda #0 \ jsr MUSIC \ pla:tax }; RC := $d8; SETIRQSRC := 2; DETIRQSRC := 2; IRQVEC := word(@vbi); FillSinHigh(sinusTable); InitDivision16; InitCharset; asm { cli }; repeat Pause; doPlasma; until false; end. VIDEO
Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon