From 03ba3f74730e0898dabba33cff6ded1ebecb7d2c Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel Date: Fri, 23 Mar 2018 14:27:15 -0700 Subject: [PATCH 1/2] Added c16/plus4 fast(), isfast() and slow() functions, and updated the documentation accordingly. --- asminc/plus4.inc | 1 + doc/c128.sgml | 16 +++++++++--- doc/c16.sgml | 12 +++++++++ doc/funcref.sgml | 59 +++++++++++++++++++++++++------------------ doc/plus4.sgml | 13 ++++++++++ include/plus4.h | 8 ++++++ libsrc/plus4/fast.s | 22 ++++++++++++++++ libsrc/plus4/isfast.s | 22 ++++++++++++++++ libsrc/plus4/slow.s | 22 ++++++++++++++++ 9 files changed, 148 insertions(+), 27 deletions(-) create mode 100644 libsrc/plus4/fast.s create mode 100644 libsrc/plus4/isfast.s create mode 100644 libsrc/plus4/slow.s diff --git a/asminc/plus4.inc b/asminc/plus4.inc index 3b2f08c54..5ea4dcf88 100644 --- a/asminc/plus4.inc +++ b/asminc/plus4.inc @@ -73,6 +73,7 @@ TED_CURSLO := $FF0D TED_V1FRQLO := $FF0E TED_V2FRQLO := $FF0F TED_V2FRQHI := $FF10 +TED_CLK := $FF13 TED_BGCOLOR := $FF15 TED_COLOR1 := $FF16 TED_COLOR2 := $FF17 diff --git a/doc/c128.sgml b/doc/c128.sgml index 14c874998..2bfb37a3d 100644 --- a/doc/c128.sgml +++ b/doc/c128.sgml @@ -85,9 +85,6 @@ url="funcref.html" name="function reference"> for declaration and usage. videomode c64mode -fast -slow -isfast @@ -123,6 +120,19 @@ declaration and usage. +CBM specific CPU functions

+ +Some CPU related functions are available for some of the Commodore +machines. See the for +declaration and usage. + + +fast +slow +isfast + + + Hardware access

The following pseudo variables declared in the +CBM specific CPU functions

+ +Some CPU related functions are available for some of the Commodore +machines. See the for +declaration and usage. + + +fast +slow +isfast + + Hardware access

The following pseudo variables declared in the

+ + + + + + (incomplete) @@ -502,6 +508,12 @@ It does not declare any functions.

+ + + + + + (incomplete) @@ -3292,21 +3304,21 @@ program, it may not be able to read it. -/ +, +, / -The function is specific to the C128. -2MHz clock will not work in 40 column mode. +The function is specific to the C128, C16 and Plus4. +On the C128 the 2MHz clock will not work in 40 column mode. -, , -, - @@ -3960,19 +3972,18 @@ fastcall function, so it may only be used in presence of a prototype. -/ +, +, / -The function is specific to the C128. +The function is specific to the C128, C16 and Plus4. -, , -, - @@ -6086,20 +6097,20 @@ be used in presence of a prototype. -/ +, +, / -The function is specific to the C128. +The function is specific to the C128, C16 and Plus4. -, , -, - diff --git a/doc/plus4.sgml b/doc/plus4.sgml index 36d53e753..c1b6165f6 100644 --- a/doc/plus4.sgml +++ b/doc/plus4.sgml @@ -124,6 +124,19 @@ declaration and usage. +CBM specific CPU functions

+ +Some CPU related functions are available for some of the Commodore +machines. See the for +declaration and usage. + + +fast +slow +isfast + + + Hardware access

The following pseudo variables declared in the Date: Fri, 23 Mar 2018 14:31:53 -0700 Subject: [PATCH 2/2] Add c16 files as well. --- libsrc/c16/fast.s | 22 ++++++++++++++++++++++ libsrc/c16/isfast.s | 22 ++++++++++++++++++++++ libsrc/c16/slow.s | 22 ++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 libsrc/c16/fast.s create mode 100644 libsrc/c16/isfast.s create mode 100644 libsrc/c16/slow.s diff --git a/libsrc/c16/fast.s b/libsrc/c16/fast.s new file mode 100644 index 000000000..e48813969 --- /dev/null +++ b/libsrc/c16/fast.s @@ -0,0 +1,22 @@ +; +; Marco van den Heuvel, 2018-03-20 +; +; void fast (void); +; /* Switch the CPU into double clock mode. */ +; + + .export _fast + + .include "plus4.inc" + + +.proc _fast + + lda TED_CLK + and #%11111101 + sta TED_CLK + rts + +.endproc + + diff --git a/libsrc/c16/isfast.s b/libsrc/c16/isfast.s new file mode 100644 index 000000000..ff104d97f --- /dev/null +++ b/libsrc/c16/isfast.s @@ -0,0 +1,22 @@ +; +; Marco van den Heuvel, 2018-03-20 +; +; unsigned char isfast (void); +; /* Returns 1 if the CPU is in double clock mode. */ +; + + .export _isfast + + .include "plus4.inc" + + +.proc _isfast + + lda TED_CLK + lsr + and #$01 + ldx #$00 + rts + +.endproc + diff --git a/libsrc/c16/slow.s b/libsrc/c16/slow.s new file mode 100644 index 000000000..18b8c231c --- /dev/null +++ b/libsrc/c16/slow.s @@ -0,0 +1,22 @@ +; +; Marco van den Heuvel, 2018-03-28 +; +; void slow (void); +; /* Switch the CPU into single clock mode. */ +; + + .export _slow + + .include "plus4.inc" + + +.proc _slow + + lda TED_CLK + ora #%00000010 + sta TED_CLK + rts + +.endproc + +