write a specific memset only for clearing screen, so we can make it faster!
This commit is contained in:
parent
ef22e5a2ff
commit
0f9db52148
1 changed files with 39 additions and 0 deletions
39
wip-hugo/routines/memory/clear_screen.s
Normal file
39
wip-hugo/routines/memory/clear_screen.s
Normal file
|
@ -0,0 +1,39 @@
|
|||
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
|
||||
|
||||
;; Sets memory in 'A'-registry to all addresses from 'A_start' until 'A_start' + 'length'
|
||||
;; Modifies A, X and A_start
|
||||
.proc clear_screen
|
||||
.include "mem.inc"
|
||||
VIC_bank = $4000
|
||||
length_ = $1f40
|
||||
low_length_3 = $C0 + $03 ;; we need one more.
|
||||
Mov_16 A_start, A_start + 1, #<VIC_bank, #>VIC_bank
|
||||
LDA #$00
|
||||
;; big_set sets the memory in $ff chunks.
|
||||
;; skipp if length >= $ff
|
||||
LDX #>length_
|
||||
BNE big_set
|
||||
JMP small_set
|
||||
big_set: ;sets $ff of memory
|
||||
;; Y value do not matter, will go through all anyway!
|
||||
.repeat $ff
|
||||
STA (A_start), Y
|
||||
DEY
|
||||
.endrepeat
|
||||
STA (A_start), Y ; dont forget Y =0
|
||||
big_set_end:
|
||||
;;set all hole $ff memory chunks!
|
||||
INC A_start + 1
|
||||
DEX ;; length +1 --
|
||||
BEQ small_set
|
||||
JMP big_set
|
||||
|
||||
small_set:
|
||||
LDX big_set + low_length_3
|
||||
LDY #$60
|
||||
STY big_set + low_length_3
|
||||
LDY #<length_
|
||||
JSR big_set
|
||||
STX big_set + low_length_3
|
||||
RTS
|
||||
.endproc
|
Loading…
Add table
Reference in a new issue