]> git.sur5r.net Git - cc65/commitdiff
Fix writing one byte beyond screen buffer. 15/head
authorChristian Groessler <chris@groessler.org>
Thu, 20 Jun 2013 23:53:13 +0000 (01:53 +0200)
committerChristian Groessler <chris@groessler.org>
Fri, 21 Jun 2013 09:33:55 +0000 (11:33 +0200)
libsrc/atari/clrscr.s

index 58fb6313739e2859ceffcbbbc1d8e3523f21ba70..483cd047e07d20823ba55813802500c26042f707 100644 (file)
@@ -9,26 +9,26 @@
         .importzp       ptr1
         .import         setcursor
 
+SCRSIZE =       960             ; 40x24: size of default atari screen
+
 _clrscr:lda     SAVMSC          ; screen memory
         sta     ptr1
         lda     SAVMSC+1
         clc
-        adc     #>(40*24)
+        adc     #>(SCRSIZE-1)
         sta     ptr1+1
         lda     #0              ; screen code of space char
         sta     OLDCHR
-        ldy     #<(40*24)       ; 40x24: size of default atari screen
-        ldx     #>(40*24)
+        ldy     #<(SCRSIZE-1)
+        ldx     #>(SCRSIZE-1)
 _clr1:  sta     (ptr1),y
         dey
         bne     _clr1
         sta     (ptr1),y
         dex
         bmi     done
-        ldy     ptr1+1
+        dec     ptr1+1
         dey
-        sty     ptr1+1
-        ldy     #255
         jmp     _clr1
 
 done:   sta     COLCRS