Skip to content

Instantly share code, notes, and snippets.

@medvecky
medvecky / data.asm
Last active September 28, 2023 11:11
Fractions calculator for Commodore 64 on 6510 assembly KIckAssembler (data)
usage_1:
.byte $0e,$08
.encoding "petscii_mixed"
.text "Fractions Calculator"
.byte $00
usage_2:
.byte $0e,$08
.encoding "petscii_mixed"
.text "Press any key to continue"
.byte $00
@medvecky
medvecky / definitions.asm
Last active September 28, 2023 11:12
Fractions calculator for Commodore 64 on 6510 assembly KIckAssembler (definitions)
#importonce
#import "subroutines.asm"
.const clearscreen = $e544;
.const print_str = $ab1e;
.const print_char = $ffd2
.const getin = $ffe4
@medvecky
medvecky / subroutines.asm
Last active September 28, 2023 11:12
Fractions calculator for Commodore 64 on 6510 assembly KIckAssembler (subroutines)
#importonce
#import "defenitions.asm"
#import "data.asm"
prepare_screen:
// set gren text color
lda #5
sta text_color
@medvecky
medvecky / main.asm
Last active September 28, 2023 11:10
Fractions calculator for Commodore 64 on 6510 assembly KIckAssembler (main)
#import "subroutines.asm"
BasicUpstart2( $1000 )
*= $1000
main:
jsr prepare_screen
jsr main_usage
menu:
@medvecky
medvecky / fractions.asm
Created August 28, 2023 15:25
Fractions to decimal and percent converter for Commodore 64 on 6510 assembly
.const clearscreen = $e544;
.const print_str = $ab1e;
.const print_char = $ffd2
.const getin = $ffe4
.const fp_string_to_fac = $b7b5;
.const fp_store_fac_to_ram = $bbd4
.const fp_load_ram_to_fac = $bba2
.const fp_fac_print = $aabc;
.const fp_mult = $ba28
@medvecky
medvecky / sqr.asm
Created July 27, 2023 09:49
Square root factorization calculator for Commodore 64 on 6510 assembly
.const print_str = $ab1e;
.const clearscreen = $e544;
.const set_cursor = $e50c;
.const print_char = $ffd2
.const getin = $ffe4
.const fp_string_to_fac = $b7b5;
.const fp_store_fac_to_ram = $bbd4
.const fp_load_ram_to_fac = $bba2
.const fp_fac_print = $aabc;
.const fp_sqr = $bf71;
@medvecky
medvecky / ratios_calculator.asm
Last active July 7, 2023 10:04
Ratios calculator for C64 on 6510 assembly
.const getin = $ffe4
.const clearscreen = $e544;
.const print_str = $ab1e;
.const print_char = $ffd2
.const set_cursor = $e50c;
.const background = $d021;
.const border = $d020;
.const text_color = $0286;
.const fp_string_to_fac = $b7b5;
.const fp_fac_print = $aabc;
@medvecky
medvecky / ratio_calculator.c
Last active July 7, 2023 08:48
Basic ratio calculator for C64 implementation on C (cc65).
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <c64.h>
unsigned char defaultBGColor = 0;
unsigned char defaultBorderColor = 0;
unsigned char defaultTextColor = 0;
void setUpScreen( void );
@medvecky
medvecky / group_anagrams_c.c
Created May 26, 2023 06:56
Hash map of <string, vector<string>> implementation on C for group anagram problem-solving
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#define MAX_STRING_LENGTH 100
#define HASH_SEED 5381