This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Mutex: | |
| fun lock(): | |
| pass | |
| fun unlock(): | |
| pass | |
| class ConditionVariable: | |
| fun wait(mutex): | |
| # lock the variable | |
| fun notify_all(mutex): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .DATA | |
| ADDR_7SEG EQU 02H ; 2 Decimal | |
| ; 7-Segment Encoding Table (Common Cathode) | |
| ; Maps index 0-F to segment patterns (gfedcba) | |
| HEX_TABLE | |
| DB | |
| 3FH, ; 0 | |
| 06H, ; 1 | |
| 5BH, ; 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .DATA | |
| ADDR_LEDS EQU 12H ; 18 Decimal (Address of the 74x373 Latch) | |
| ; Shadow variable to store current state of LEDs (initially all OFF) | |
| LED_SHADOW DB 0FFH | |
| ; Bit Definitions for LEDs (0 to 7 - one hot encoded) | |
| LED0_MASK EQU 01H ; 0000 0001B | |
| LED1_MASK EQU 02H ; 0000 0010B | |
| LED2_MASK EQU 04H ; 0000 0100B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .DATA | |
| ADDR_KBD_IN EQU 16H ; 22 Decimal | |
| ADDR_KBD_OUT EQU 18H ; 24 Decimal | |
| ; Column Selection Masks (Active Low) | |
| COL_1_MASK EQU 11111110B ; Select Column 1 | |
| COL_2_MASK EQU 11111101B ; Select Column 2 | |
| COL_3_MASK EQU 11111011B ; Select Column 3 | |
| ; Row Input Masks have a 1 hot encoding because TEST does bitwise AND comparing the result with "0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .DATA | |
| ; Port Addresses | |
| ADDR_8255_A EQU 0250H | |
| ADDR_8255_C EQU 0254H | |
| ADDR_8255_CTRL EQU 0256H | |
| ; Strobe: 1 (Idle) -> 0 (Trigger) -> 1 (Idle) | |
| STROBE_IDLE EQU 01H ; Bit 0 is 1 | |
| STROBE_ACTIVE EQU 00H ; Bit 0 is 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .DATA | |
| ADDR_8251_CTRL EQU 04D0H | |
| ADDR_8251_DATA EQU 04D2H | |
| ; Status Masks | |
| MASK_TXRDY EQU 00000001B ; Bit 0 is TxRDY (Transmitter Ready) | |
| MASK_RXRDY EQU 00000010B ; Bit 1 is RxRDY (Receiver Ready) | |
| .CODE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .DATA | |
| ADDR_8255_CTRL EQU 0256H ; Control Register Address | |
| ; Control Word for 8255: | |
| ; Bit 7=1 (Mode Set Flag) | |
| ; Bit 6-5=00 (Group A Mode 0 - Basic I/O) | |
| ; Bit 4=0 (Port A = Output) | |
| ; Bit 3=0 (Port C Upper = Output) | |
| ; Bit 2=0 (Group B Mode 0) | |
| ; Bit 1=1 (Port B = Input - Common default) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cstring> | |
| using namespace std; | |
| char vowels[] = {'a', 'e', 'i', 'o', 'u'}; | |
| char *last_vowel(char* sentence) { | |
| char* last_vowel_found; |