![]() ![]() 1 Daily Challenge #1 - String Peeler 2 Daily Challenge #2 - String Diamond. 7 * Input ' Length ) - Upper Capacity First, Last : Natural := 0 Char_code : Codings begin for I in Cap_String ' Range loop if Is_In ( Cap_String ( I ), Morse_charset ) then First := Last + 1 if Cap_String ( I ) = ' ' then Result ( First ) := ' ' Last := Last + 1 else Char_code := Table ( Reschars ( Cap_String ( I ))) Last := First + Char_code. To_Upper ( Input ) Result : Morse_Str ( 1. ![]() unsigned := 1280 - in Herz Morse_Sequence : constant Character_Sequence := " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" Morse_charset : constant Character_Set := To_Set ( Morse_Sequence ) function Convert ( Input : String ) return Morse_Str is Cap_String : constant String := Characters. unsigned - durations expressed in ms Freq : constant C. ![]() Maps, Interfaces package body Morse is Dit, Dah, Lettergap, Wordgap : Duration - in seconds Dit_ms, Dah_ms : C. 5 subtype Codes is Morse_Str ( Length ) - using the current ITU standard with 5 signs - only alphanumeric characters are taken into consideration type Codings is record L : Length Code : Codes end record Table : constant array ( Reschars ) of Codings := (' A ' => ( 2, ".- " ), ' B ' => ( 4, ". ' Z ' - restricted set of characters from 16#20# to 16#60# subtype Length is Natural range 1. Package Morse is type Symbols is ( Nul, '-', '.', ' ' ) - Nul is the letter separator, space the word separator Dash : constant Symbols := '-' Dot : constant Symbols := '.' type Morse_Str is array ( Positive range ) of Symbols pragma Pack ( Morse_Str ) function Convert ( Input : String ) return Morse_Str procedure Morsebeep ( Input : Morse_Str ) private subtype Reschars is Character range ' '. PROC ProcessSound(CHAR ARRAY s BYTE last) IntraGapDuration,letterGapDuration,wordGapDuration text org 100 h Set up the PIT to generate a 'C' note cli mov al ,( 2 ? db. Ĝontrol bits SPKR: equ 3 Lower two bits of KBB determine speaker on/off CTR: equ 6 Counter select offset in PIT control byte CBITS: equ 4 Size select offset in PIT control byte B16: equ 3 16-bit mode for the PIT counter MODE: equ 1 Offset of mode in PIT control byte SQWV: equ 3 Square wave mode Software interrupts CLOCK: equ 1 Ah BIOS clock function interrupt DOS: equ 21 h MS-DOS syscall interrupt MS-DOS syscalls read: equ 3 Fh Read from file section. Cpu 8086 bits 16 I/O ports KBB: equ 61 h Keyboard controller port B (also controls speaker) PITC2: equ 42 h Programmable Interrupt Timer, channel 2 (frequency) PITCTL: equ 43 h PIT control port.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |