]> git.sur5r.net Git - cc65/commitdiff
Implemented clrscr routine for C1P
authorStephan Mühlstrasser <stephan.muehlstrasser@web.de>
Sat, 8 Nov 2014 00:14:46 +0000 (01:14 +0100)
committerStephan Mühlstrasser <stephan.muehlstrasser@web.de>
Sat, 8 Nov 2014 00:14:46 +0000 (01:14 +0100)
libsrc/c1p/c1p.inc [new file with mode: 0644]
libsrc/c1p/clrscr.s [new file with mode: 0644]

diff --git a/libsrc/c1p/c1p.inc b/libsrc/c1p/c1p.inc
new file mode 100644 (file)
index 0000000..525a8e9
--- /dev/null
@@ -0,0 +1,3 @@
+\r
+SCRNBASE       := $D000        ; Base of video RAM\r
+VIDEORAMSIZE   := $0400        ; Size of C1P video RAM (1 kB)\r
diff --git a/libsrc/c1p/clrscr.s b/libsrc/c1p/clrscr.s
new file mode 100644 (file)
index 0000000..f219a45
--- /dev/null
@@ -0,0 +1,23 @@
+;\r
+; void clrscr (void);\r
+;\r
+        .export         _clrscr\r
+        .include        "c1p.inc"\r
+\r
+; Adapted from the Challenger Character Graphics\r
+; Reference Manual, "2.3.3 MACHINE LANGUAGE SCREEN CLEAR"\r
+; This is self-modifying code!\r
+BANKS = VIDEORAMSIZE / $100\r
+\r
+_clrscr:       LDA #$20 ;' '\r
+               LDY #BANKS\r
+               LDX #$00\r
+STALOC:                STA SCRNBASE,X\r
+               INX\r
+               BNE STALOC\r
+               INC STALOC+2\r
+               DEY\r
+               BNE STALOC\r
+               LDA #>(SCRNBASE) ; load high byte\r
+               STA STALOC+2     ; restore base address\r
+               RTS\r