Skip to content

Instantly share code, notes, and snippets.

@medvecky
Last active September 28, 2023 11:10
Show Gist options
  • Save medvecky/e1fd9f9658489a295b91e93187e4885a to your computer and use it in GitHub Desktop.
Save medvecky/e1fd9f9658489a295b91e93187e4885a to your computer and use it in GitHub Desktop.
Fractions calculator for Commodore 64 on 6510 assembly KIckAssembler (main)
#import "subroutines.asm"
BasicUpstart2( $1000 )
*= $1000
main:
jsr prepare_screen
jsr main_usage
menu:
jsr show_menu
wait_for_continue:
jsr getin
beq wait_for_continue
cmp #q_sym
beq go_to_exit
cmp #one_sym
beq hadnle_simplifying
cmp #two_sym
beq hadnle_mixed_to_improper
cmp #three_sym
beq hadnle_multiplication
cmp #four_sym
beq hadnle_dividing
cmp #five_sym
beq hadnle_addition
cmp #six_sym
beq hadnle_subtraction
jsr clearscreen
jmp menu
hadnle_simplifying:
jsr simplifying_handler
jmp continue_or_exit
hadnle_mixed_to_improper:
jsr mixed_to_improper_handler
jmp continue_or_exit
hadnle_multiplication:
jsr multiplication_handler
jmp continue_or_exit
hadnle_dividing:
jsr dividing_handler
jmp continue_or_exit
hadnle_addition:
jsr addition_handler
jmp continue_or_exit
hadnle_subtraction:
jsr subtraction_handler
jmp continue_or_exit
go_to_exit:
jmp restore_and_exit
continue_or_exit:
jsr usage_at_exit
wait_for_input:
jsr getin
beq wait_for_input
cmp #q_sym
bne continue
jmp restore_and_exit
continue:
jsr clearscreen
jmp menu
restore_and_exit:
jsr restore_screen
rts
// END OF MAIN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment