From 5d7a24241cee19434f1ac8352c7f74eac7b410de Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20M=C3=BChlstrasser?= Date: Sat, 8 Nov 2014 01:14:46 +0100 Subject: [PATCH] Implemented clrscr routine for C1P --- libsrc/c1p/c1p.inc | 3 +++ libsrc/c1p/clrscr.s | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 libsrc/c1p/c1p.inc create mode 100644 libsrc/c1p/clrscr.s diff --git a/libsrc/c1p/c1p.inc b/libsrc/c1p/c1p.inc new file mode 100644 index 000000000..525a8e9ee --- /dev/null +++ b/libsrc/c1p/c1p.inc @@ -0,0 +1,3 @@ + +SCRNBASE := $D000 ; Base of video RAM +VIDEORAMSIZE := $0400 ; Size of C1P video RAM (1 kB) diff --git a/libsrc/c1p/clrscr.s b/libsrc/c1p/clrscr.s new file mode 100644 index 000000000..f219a4550 --- /dev/null +++ b/libsrc/c1p/clrscr.s @@ -0,0 +1,23 @@ +; +; void clrscr (void); +; + .export _clrscr + .include "c1p.inc" + +; Adapted from the Challenger Character Graphics +; Reference Manual, "2.3.3 MACHINE LANGUAGE SCREEN CLEAR" +; This is self-modifying code! +BANKS = VIDEORAMSIZE / $100 + +_clrscr: LDA #$20 ;' ' + LDY #BANKS + LDX #$00 +STALOC: STA SCRNBASE,X + INX + BNE STALOC + INC STALOC+2 + DEY + BNE STALOC + LDA #>(SCRNBASE) ; load high byte + STA STALOC+2 ; restore base address + RTS -- 2.39.5