From 8775ebaf4372af38599fce3d24bf552c0349d5c5 Mon Sep 17 00:00:00 2001 From: Mattias Hansson Date: Sun, 17 May 2026 15:26:46 +0200 Subject: [PATCH] Fixed multdiv demo and removed redundant demo --- examples/multdiv_demo/multdiv_demo.c65 | 6 + examples/multdivlib_demo/cm.sh | 3 - examples/multdivlib_demo/multdivlib_demo.c65 | 168 ------------------- examples/multdivlib_demo/start_in_vice.sh | 2 - 4 files changed, 6 insertions(+), 173 deletions(-) delete mode 100644 examples/multdivlib_demo/cm.sh delete mode 100644 examples/multdivlib_demo/multdivlib_demo.c65 delete mode 100644 examples/multdivlib_demo/start_in_vice.sh diff --git a/examples/multdiv_demo/multdiv_demo.c65 b/examples/multdiv_demo/multdiv_demo.c65 index 5410ee9..50844dd 100644 --- a/examples/multdiv_demo/multdiv_demo.c65 +++ b/examples/multdiv_demo/multdiv_demo.c65 @@ -4,9 +4,15 @@ // human-readable decimal output via decoutlib //----------------------------------------------------------- +#PRAGMA _P_REMOVE_UNUSED 1 + #INCLUDE #INCLUDE + +#PRAGMA _P_REMOVE_UNUSED 0 #INCLUDE +#PRAGMA _P_REMOVE_UNUSED 1 + #INCLUDE #INCLUDE diff --git a/examples/multdivlib_demo/cm.sh b/examples/multdivlib_demo/cm.sh deleted file mode 100644 index d6107db..0000000 --- a/examples/multdivlib_demo/cm.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -PROGNAME="multdivlib_demo" -c65gm ${PROGNAME}.c65 diff --git a/examples/multdivlib_demo/multdivlib_demo.c65 b/examples/multdivlib_demo/multdivlib_demo.c65 deleted file mode 100644 index b586324..0000000 --- a/examples/multdivlib_demo/multdivlib_demo.c65 +++ /dev/null @@ -1,168 +0,0 @@ -//----------------------------------------------------------- -// MultDiv Library Demo -// Demonstrates multiplication and division routines -//----------------------------------------------------------- - -#INCLUDE -#INCLUDE -#INCLUDE -#INCLUDE - -#PRAGMA _P_USE_CBM_STRINGS 1 - -GOTO start - -WORD high -BYTE i - -//----------------------------------------------------------- -// Wait for key -//----------------------------------------------------------- -FUNC wait_key - BYTE key - - WHILE 1 - key = PEEK $c5 - IF key = 64 - BREAK - ENDIF - WEND - - WHILE 1 - key = PEEK $c5 - IF key != 64 - BREAK - ENDIF - WEND - - POKE $c6 WITH 0 -FEND - -//----------------------------------------------------------- -// Main demo -//----------------------------------------------------------- -FUNC main - - lib_cbmio_cls() - - lib_cbmio_printlf("multdivlib demo") - lib_cbmio_printlf("===============") - lib_cbmio_lf() - - WORD a - WORD b - - //----------------------------------------- - // Test 1: mult - 123 * 456 (16-bit result) - // io:lib_multdiv_acc is input/output - // result in lib_multdiv_acc, high in lib_multdiv_ext - //----------------------------------------- - lib_cbmio_printlf("lib_multdiv_mult: 123 * 456 =") - - a = 123 - b = 456 - lib_multdiv_mult(a, b) - - lib_cbmio_print(" result: ") - lib_cbmio_hexoutw(lib_multdiv_acc) - lib_cbmio_lf() - lib_cbmio_lf() - - lib_cbmio_print("press any key...") - wait_key() - lib_cbmio_lf() - lib_cbmio_lf() - - //----------------------------------------- - // Test 2: mult32 - 65000 * 100 (32-bit result) - // out:high gets the high word - //----------------------------------------- - lib_cbmio_printlf("mult32: 65000 * 100 =") - - a = 65000 - b = 100 - lib_multdiv_mult32(a, b, high) - - lib_cbmio_print(" low: $") - lib_cbmio_hexoutw(lib_multdiv_acc) - lib_cbmio_print(" high: $") - lib_cbmio_hexoutw(high) - lib_cbmio_lf() - lib_cbmio_lf() - - lib_cbmio_print("press any key...") - wait_key() - lib_cbmio_lf() - lib_cbmio_lf() - - //----------------------------------------- - // Test 3: div - 1337 / 7 - // quotient in lib_multdiv_acc, remainder in lib_multdiv_ext - //----------------------------------------- - lib_cbmio_printlf("lib_multdiv_div: 1337 / 7 =") - - a = 1337 - b = 7 - lib_multdiv_div(a, b) - - lib_cbmio_print(" quotient: ") - lib_cbmio_hexoutw(lib_multdiv_acc) - lib_cbmio_lf() - - lib_cbmio_print(" remainder: ") - lib_cbmio_hexoutw(lib_multdiv_ext) - lib_cbmio_lf() - lib_cbmio_lf() - - //----------------------------------------- - // Test 4: divmod - 1000 / 13 - // out:high gets the remainder - //----------------------------------------- - lib_cbmio_printlf("divmod: 1000 / 13 =") - - a = 1000 - b = 13 - lib_multdiv_divmod(a, b, high) - - lib_cbmio_print(" quotient: ") - lib_cbmio_hexoutw(lib_multdiv_acc) - lib_cbmio_lf() - - lib_cbmio_print(" remainder: $") - lib_cbmio_hexoutw(high) - lib_cbmio_lf() - lib_cbmio_lf() - - lib_cbmio_print("press any key...") - wait_key() - lib_cbmio_lf() - lib_cbmio_lf() - - //----------------------------------------- - // Test 5: Loop 0-9 multiplied by 10 - //----------------------------------------- - lib_cbmio_printlf("loop: 0*10 through 9*10:") - lib_cbmio_lf() - - i = 0 - WHILE i < 10 - a = i - b = 10 - lib_multdiv_mult(a, b) - - lib_cbmio_print(" ") - lib_cbmio_hexoutb(i) - lib_cbmio_print(" * 10 = ") - lib_cbmio_hexoutw(lib_multdiv_acc) - lib_cbmio_lf() - - i++ - WEND - lib_cbmio_lf() - - lib_cbmio_printlf("done!") -FEND - -LABEL start - main() - SUBEND diff --git a/examples/multdivlib_demo/start_in_vice.sh b/examples/multdivlib_demo/start_in_vice.sh deleted file mode 100644 index 4e495f5..0000000 --- a/examples/multdivlib_demo/start_in_vice.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -x64 -autostartprgmode 1 multdivlib_demo.prg