Memory areas $0400 $07E7 are mapped to the screen memory, starting at the top left of the screen to the bottom right. To keep the demonstration out of the way of the working area, we'll work down at memory address $0708 which is in the middle towards the bottom.
Looking at memory address $0708 to $070F, we see that all of the values are $20 (BLANK)
We can manipulate the numbers in the listing as shown using 08 05 0C 0C 0F 20 36 34.
Pressing RETURN will immediately update the values in memory and show their effect
Upon pressing RETURN the HELLO 64 is displayed in the center of the lower half of the screen
While this has been stored into video memory, The actions of subsequent RETURN presses from the bottom will move it up like any other text, and ultimately it will be gone.
Lets restart and do something a bit more fun........ Well create a sprite and affix it to the screen, all within memory and no machine code. Im doing it a bit out of order so you can watch the sprite come alive as you type in the data
1: M D015 change first value to 01 This activates SPRITE0
2: M D000 change first two values to AA 8F This sets our coordinates to the middle of screen
3: M 07F8 change first value to 0B Starts our sprite data at 0B (11) x 64 = 02C0
4: M 0D17 change first value to 01 Stretch Horizontally X2
5: M 0D1D change first value to 01 Stretch Vertically X2
Now everything we add to 02C0 will populate the sprite right on the screen
Hit RETURN a bunch of times to clear the screen and type M 02C0 and get started, after each line press return and continue, the next line will automatically appear ready to edit
03 FF 00 07 FF 80 0F FF
80 1F 83 80 3E 00 80 7C
00 7F 78 00 7E F8 00 7C
F0 00 78 F0 00 70 F0 00
00 F0 00 70 F0 00 78 F8
00 7C 78 00 7E 7C 00 7F
3E 00 80 1F 83 80 0F FF
80 07 FF 80 03 FF 00 00
Half way there!!!!!!
The sprite completed! , Don't laugh, I drew it by hand
Hmmm, Lets hit return a bunch of times to clear the screen a bit, move the SPRITE to the top right corner, then shrink it
M D000 change first two values to FF 32 Thats as far to the right without adding a MSB
Now well shrink the logo
M 0D17 change first value to 00
M 0D1D change first value to 00
Now we have the logo at the original size but we can now bring it higher, but how can we further extend it to the right?
Well , you can't go ant higher than FF on D000, which is the upper limit, however you can change D000 to 00 and add a 01 to its MSB found at D010 known as the MSIGX. With the 01 in place, the value of 00 at D000 is now 255, 01 would be 256 and so on......
So if we have the value of 01 at D010 and give the value 3B at D000 essentially we will have a combined value of FF+3B 255+59 = 314
Lets Set our color register for HI-res as shown, with the ability to set colors in D027
well change D027 to whatever color we want Fx - x being the color number
I chose F2 for RED
Lets create Sprite 1 along with existing sprite 0
1: M D015 change first value to 03 This activates SPRITE0, SPRITE1
2: M D000 change first two values to AA 8F This sets our coordinates to the middle of screen
3: M 07F8 change first value to 0C Starts our sprite data at 0C (12) x 64 = 0300
We stole some memory used by basic, you can see the sprite is populated with garbage, don't change the values of this sprite in 0300 or it will crash the system. You can however move it around and change the color, or cause a collision with the first sprite SPRITE0
NEXT----->
Understanding 6502 assembly on the Commodore 64 - (4) RECAP AND DEVTOOLS INTRO
Table of contents
Looking at memory address $0708 to $070F, we see that all of the values are $20 (BLANK)
We can manipulate the numbers in the listing as shown using 08 05 0C 0C 0F 20 36 34.
Pressing RETURN will immediately update the values in memory and show their effect
Upon pressing RETURN the HELLO 64 is displayed in the center of the lower half of the screen
While this has been stored into video memory, The actions of subsequent RETURN presses from the bottom will move it up like any other text, and ultimately it will be gone.
Lets restart and do something a bit more fun........ Well create a sprite and affix it to the screen, all within memory and no machine code. Im doing it a bit out of order so you can watch the sprite come alive as you type in the data
1: M D015 change first value to 01 This activates SPRITE0
2: M D000 change first two values to AA 8F This sets our coordinates to the middle of screen
3: M 07F8 change first value to 0B Starts our sprite data at 0B (11) x 64 = 02C0
4: M 0D17 change first value to 01 Stretch Horizontally X2
5: M 0D1D change first value to 01 Stretch Vertically X2
Now everything we add to 02C0 will populate the sprite right on the screen
Hit RETURN a bunch of times to clear the screen and type M 02C0 and get started, after each line press return and continue, the next line will automatically appear ready to edit
03 FF 00 07 FF 80 0F FF
80 1F 83 80 3E 00 80 7C
00 7F 78 00 7E F8 00 7C
F0 00 78 F0 00 70 F0 00
00 F0 00 70 F0 00 78 F8
00 7C 78 00 7E 7C 00 7F
3E 00 80 1F 83 80 0F FF
80 07 FF 80 03 FF 00 00
Half way there!!!!!!
The sprite completed! , Don't laugh, I drew it by hand
Hmmm, Lets hit return a bunch of times to clear the screen a bit, move the SPRITE to the top right corner, then shrink it
M D000 change first two values to FF 32 Thats as far to the right without adding a MSB
Now well shrink the logo
M 0D17 change first value to 00
M 0D1D change first value to 00
Now we have the logo at the original size but we can now bring it higher, but how can we further extend it to the right?
Well , you can't go ant higher than FF on D000, which is the upper limit, however you can change D000 to 00 and add a 01 to its MSB found at D010 known as the MSIGX. With the 01 in place, the value of 00 at D000 is now 255, 01 would be 256 and so on......
So if we have the value of 01 at D010 and give the value 3B at D000 essentially we will have a combined value of FF+3B 255+59 = 314
Lets Set our color register for HI-res as shown, with the ability to set colors in D027
well change D027 to whatever color we want Fx - x being the color number
I chose F2 for RED
Lets create Sprite 1 along with existing sprite 0
1: M D015 change first value to 03 This activates SPRITE0, SPRITE1
2: M D000 change first two values to AA 8F This sets our coordinates to the middle of screen
3: M 07F8 change first value to 0C Starts our sprite data at 0C (12) x 64 = 0300
We stole some memory used by basic, you can see the sprite is populated with garbage, don't change the values of this sprite in 0300 or it will crash the system. You can however move it around and change the color, or cause a collision with the first sprite SPRITE0
NEXT----->
Understanding 6502 assembly on the Commodore 64 - (4) RECAP AND DEVTOOLS INTRO
Table of contents
No comments:
Post a Comment