How do you clear the screen in machine language?
Moderator: Moderators
How do you clear the screen in machine language?
How do you clear the screen in machine language? I'm trying to make my first VIC-20 demo in CBM prg Studio.
-
- Vic 20 Hobbyist
- Posts: 108
- Joined: Sun Mar 10, 2019 7:39 pm
- Location: lodi california
- Occupation: student
Re: How do you clear the screen in machine language?
this site should help:https://techtinkering.com/2013/04/16/be ... re-vic-20/
Bedroom coder=rock star
modern coder= pop star
i'd rather be a rock star than a pop start
modern coder= pop star
i'd rather be a rock star than a pop start

Re: How do you clear the screen in machine language?
Thanks, cleared the screen as you said.
Re: How do you clear the screen in machine language?
Might be a good idea to clear the screen memory with your own code instead of using the kernal,if your going to program the VIC in assembly,starting with small routines/code is a good idea.
What type of demo are you doing?
Code: Select all
Do_ClearScreenRam
ldy #0
lda #$20
ClearScreenRamLoop
sta $1e00,y
sta $1f00,y
iny
bne ClearScreenRamLoop
rts
Re: How do you clear the screen in machine language?
Since your description says "Occupation: Programmer" then you understand pointers,so here's a small program that uses pointers.It clears the screen ram and then draws @ using a pointer.Copy code into CBM prg studio,feel free to play around with the code so you can understanding how it works.
Code: Select all
*=$1001
byte $0B,$10,$DC,$07
byte $9E,$34,$31,$30,$39
byte $00,$00,$00
jmp Main
;-----------------------------------
; VIC 20 Color Defines
;-----------------------------------
Black = 0
White = 1
Red = 2
Cyan = 3
Purple = 4
Green = 5
Blue = 6
Yellow = 7
Orange = 8
LightOrange = 9
Pink = 10
LightCyan = 11
LightPurple = 12
LightGreen = 13
LightBlue = 14
LightYellow = 15
;-----------------------------------
; Defines
;-----------------------------------
ScreenRam = $1e00
GridCharacter = $00
BlankCharacter = $20
;-----------------------------------
; Variables
;-----------------------------------
Pointer = $00
Main
jsr Do_ClearScreenRam
jsr Do_DrawGridToScreenRam
LoopForever
jmp LoopForever
;-----------------------------------
;
;-----------------------------------
Do_ClearScreenRam
ldy #0
lda #BlankCharacter
ClearScreenRamLoop
sta ScreenRam+0,y
sta ScreenRam+256,y
iny
bne ClearScreenRamLoop
rts
;-----------------------------------
; Draw And Color Grid
;-----------------------------------
Do_DrawGridToScreenRam
lda #>ScreenRam
sta Pointer+1
lda #<ScreenRam+44
sta Pointer+0
ldx #18 ;ScreenRows
DrawNextRowLoop
ldy #20 ;ScreenColumns
DrawNextColumnLoop
lda #GridCharacter
sta (Pointer),y
lda Pointer+1
pha
clc
adc #$78
sta Pointer+1
ColorNextColumn
lda #Red
sta (Pointer),y
pla
sta Pointer+1
dey
bne DrawNextColumnLoop
lda Pointer+0
clc
adc #22
sta Pointer+0
lda Pointer+1
adc #0
sta Pointer+1
dex
bne DrawNextRowLoop
rts
-
- Vic 20 Hobbyist
- Posts: 125
- Joined: Sun Feb 28, 2016 9:59 pm
- Location: CA USA
Re: How do you clear the screen in machine language?
Even some of the most picky assembly folks on denial use the kernal routines as a convenient library of commands. It is good to know what the routine does, however. That said, once you do there is no reason not to use kernal routines unless you have/need a much faster/custom routine. I've heard even expert demo scene guys like Michael Steil say they use the floating point stuff built in because its fast and already there.OmegaMax wrote:Might be a good idea to clear the screen memory with your own code instead of using the kernal,if your going to program the VIC in assembly,starting with small routines/code is a good idea.
Re: How do you clear the screen in machine language?
I write all my own code,but use whatever suits you best.
Re: How do you clear the screen in machine language?
The KERNAL routines are often useful, unfortunately the screen code has 22x23 hardcoded so if you are using a different size you have to end up writing your own.Forbidden64 wrote:Even some of the most picky assembly folks on denial use the kernal routines as a convenient library of commands. It is good to know what the routine does, however. That said, once you do there is no reason not to use kernal routines unless you have/need a much faster/custom routine. I've heard even expert demo scene guys like Michael Steil say they use the floating point stuff built in because its fast and already there.