This file contains 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
org 0x0 | |
start: xor d | |
xor e | |
xor b ; clear d, e, b | |
ld hl, 0x92c0 ; load hl with address of back of the VRAM | |
ld de, 2400 ; 2400 bytes of attributes | |
ld b, 0x1b ; color, 0x1b is 011011, should be purple | |
attri: ld (hl), b ; store the color into VRAM address at hl | |
dec hl ; decrease hl to move on to next VRAM address |
This file contains 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
if lotto_underway and current_time() > next_lotto_draw: | |
say("Time for the lottery draw! The winning number is...") | |
time.sleep(2) | |
winning_number = random.randint(1,64) | |
say(str(winning_number) + "!") | |
time.sleep(1) | |
for key in lotto_user_dict: | |
if lotto_user_dict[key] == winning_number: | |
say(key.capitalize() + " won ₽2000! Congrats! PogChamp") | |
this_result = {'winner':key, 'payout':2000, 'winning_number':winning_number, 'timestamp':current_time()} |
This file contains 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
module cpu_vreg( | |
input wire clk, | |
input wire copy_in_progress, | |
input wire cpu_rd, | |
input wire cpu_wr, | |
input wire cpu_mreq, | |
input wire [15:0] cpu_addr, | |
inout wire [7:0] cpu_data, | |
output reg back_vram_wr_low, | |
output reg back_vram_rd_low, |
This file contains 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
org 0x0 | |
xor d | |
xor e | |
xor b | |
ld sp, 0x7fff | |
ld hl, 0x92bf ; fill attribute RAM with 0x3c, yellow | |
ld de, 2400 | |
ld b, 0x3c | |
clear_attri: |
This file contains 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
module cpu_vreg( | |
input wire clk, | |
input wire copy_in_progress, | |
input wire close_to_vlank, | |
input wire cpu_rd, | |
input wire cpu_wr, | |
input wire cpu_mreq, | |
output reg [7:0] copy_enable, | |
input wire [15:0] cpu_addr, |
This file contains 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
vram_char_base_addr .equ 0x8000 | |
vram_attri_base_addr .equ 0x8960 | |
org 0x0 | |
xor b | |
xor c | |
xor d | |
xor e | |
ld sp, 0x7fff |
This file contains 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 helper.z80 | |
org 0x0 | |
jmp program_start | |
org 0x10 ; interrupt vector table | |
.dw 0x3000 ; keyboard interrupt at 0x3000 | |
org 0x100 | |
program_start: |
This file contains 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
int main(void) | |
{ | |
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */ | |
HAL_Init(); | |
/* Configure the system clock */ | |
SystemClock_Config(); | |
/* Initialize all configured peripherals */ | |
MX_GPIO_Init(); | |
MX_USART1_UART_Init(); | |
MX_USART3_UART_Init(); |
This file contains 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
import serial | |
NINTENDO_LOGO = [206, 237, 102, 102, 204, 13, 0, 11, 3, 115, 0, 131, 0, 12, 0, 13, 0, 8, 17, 31, 136, 137, 0, 14, 220, 204, 110, 230, 221, 221, 217, 153, 187, 187, 103, 99, 110, 14, 236, 204, 221, 220, 153, 159, 187, 185, 51, 62] | |
gcb_flag_dict = {0x80:"GB compatible GBC game", 0xc0:"GBC only game"} | |
cart_type_dict = {0x00:"ROM ONLY", 0x01:"MBC1", 0x02:"MBC1+RAM", 0x03:"MBC1+RAM+BATTERY", 0x05:"MBC2", 0x06:"MBC2+BATTERY", 0x08:"ROM+RAM", 0x09:"ROM+RAM+BATTERY", 0x0B:"MMM01", 0x0C:"MMM01+RAM", 0x0D:"MMM01+RAM+BATTERY", 0x0F:"MBC3+TIMER+BATTERY", 0x10:"MBC3+TIMER+RAM+BATTERY", 0x11:"MBC3", 0x12:"MBC3+RAM", 0x13:"MBC3+RAM+BATTERY", 0x15:"MBC4", 0x16:"MBC4+RAM", 0x17:"MBC4+RAM+BATTERY", 0x19:"MBC5", 0x1A:"MBC5+RAM", 0x1B:"MBC5+RAM+BATTERY", 0x1C:"MBC5+RUMBLE", 0x1D:"MBC5+RUMBLE+RAM", 0x1E:"MBC5+RUMBLE+RAM+BATTERY", 0xFC:"POCKET CAMERA", 0xFD:"BANDAI TAMA5", 0xFE:"HuC3", 0xFF:"HuC1+RAM+BATTERY"} | |
ROM_size_dict = {0x00:"32KByte (no ROM banking)", 0x01:"64KByte (4 banks)", 0x02:"128KByte (8 banks)", 0x0 |
This file contains 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
module dlatch8( | |
input wire [7:0] data, | |
input wire LE_H, | |
input wire OE_L, | |
output reg [7:0] q | |
); | |
reg [7:0] q_internal; | |
// activates when LE_H or OE_L changes |