6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Oct 06, 2024 1:30 pm

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Thu Jul 07, 2016 10:58 am 
Offline

Joined: Sun Jun 19, 2016 10:20 am
Posts: 2
I made a new game for the easy 6502 simulator. It is the etch-a-sketch game. Keyboard key 1 = left, key 2 = right, key 3 = up, key 4 = down. Key 5 erases one pixel. After erasing a pixel, the pixel location is still in memory. This means that you need to rewrite a pixel that is already there by pressing one of the 4 move keys. I know this is confusing but you will see that it is easy to figure out. I added a flashing red pixel to show you where you are at on the screen. Use the erase key to erase all unwanted pixels on the screen. The simulator can be found by searching “easy 6502 by skilldrick” on the web. Copy paste this program.

LDA #$6F
STA $40
LDA #$03
STA $41
LDY #$00
loop1:
LDA #$00
STA $00FF
LDX #$FF
loop:
DEX
BNE loop
LDA $FF
STA $0100
LDA $0100
CMP #$31
BNE loop2
JMP pointer
loop2:
CMP #$32
BNE loop3
JMP pointer1
loop3:
CMP #$33
BNE loop4
JMP pointer2
loop4:
CMP #$34
BNE loop5
JMP pointer3
loop5:
CMP #$35
BNE loop30
JMP pointer4
loop30:
JMP loop1
pointer:
LDA $40
CMP #$00
BNE loop10
JMP loop1
loop10:
CMP #$20
BNE loop11
JMP loop1
loop11:
CMP #$40
BNE loop12
JMP loop1
loop12:
CMP #$60
BNE loop13
JMP loop1
loop13:
CMP #$80
BNE loop14
JMP loop1
loop14:
CMP #$A0
BNE loop15
JMP loop1
loop15:
CMP #$C0
BNE loop16
JMP loop1
loop16:
CMP #$E0
BNE loop17
JMP loop1
loop17:
DEC $40
LDA #$0A
STA ($40),y
LDX #$FF
loop31:
DEX
BNE loop31
LDA #$01
STA ($40),y
JMP loop1
pointer1:
LDA $40
CMP #$1F
BNE loop18
JMP loop1
loop18:
CMP #$3F
BNE loop19
JMP loop1
loop19:
CMP #$5F
BNE loop20
JMP loop1
loop20:
CMP #$7F
BNE loop21
JMP loop1
loop21:
CMP #$9F
BNE loop22
JMP loop1
loop22:
CMP #$BF
BNE loop23
JMP loop1
loop23:
CMP #$DF
BNE loop24
JMP loop1
loop24:
CMP #$FF
BNE loop25
JMP loop1
loop25:
INC $40
LDA #$0A
STA ($40),y
LDX #$FF
loop32:
DEX
BNE loop32
LDA #$01
STA ($40),y
JMP loop1
pointer2:
LDX #$00
STX $43
LDA $40
SEC
SBC #$20
STA $40
LDA $41
SBC #$00
STA $41
LDA $40
CLC
ADC #$20
STA $40
LDA $40
SEC
SBC #$20
STA $40
LDA #$0A
STA ($40),y
LDX #$FF
loop33:
DEX
BNE loop33
LDA #$01
STA ($40),y
JMP loop1
pointer3:
LDX $43
CPX #$01
BNE loop8
JMP loop1
loop8:
LDA $40
CLC
ADC #$20
STA $40
LDA $41
ADC #$00
CMP #$06
STA $41
BNE loop6
LDX #$01
STX $43
JMP loop1
loop6:
LDA #$0A
STA ($40),y
LDX #$FF
loop34:
DEX
BNE loop34
LDA #$01
STA ($40),y
JMP loop1
pointer4:
LDA #$00
STA ($40),y
JMP loop1


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 08, 2016 8:47 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10949
Location: England
Thanks for posting Jim!


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 11, 2016 12:09 pm 
Offline

Joined: Wed Jun 29, 2016 12:36 pm
Posts: 4
That is really cool! Thanks Jim!

Here's a somewhat related question: Do any of the "classic" 6502-based computers (C-64, Atari 800, Apple II, etc.) allow pixel plotting like the easy 6502 computer? If so, are they as easy to use?

I had a C-64 back in the day, and I remember turning sprites on and off, and from what I remember it was much harder than just putting a color code in an address location to do some simple graphics..

Jason

_________________
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Check out my home-brew computer projects:
https://m.youtube.com/watch?v=EgXulWcfLKc
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 11, 2016 9:40 pm 
Offline

Joined: Tue Jul 24, 2012 2:27 am
Posts: 674
On the C-64, in bitmap mode you can set a bit to set a 2-color pixel, or set a pair of bits to set a wide 4-color pixel. However, the layout wasn't linear, but had 8 bytes filling out an 8x8 area, then the next 8 bytes filled in the 8x8 area to the right of that, etc. Each 8x8 pixel area had its own palette, with 1 background color shared in 4-color/2-pixel mode.

I believe the Atari 8-bit's 1-bit bitmap mode had a "linear" layout. Its higher color modes had a global palette for the whole screen, but easy support for raster changes of the palette. That'd probably be about the closest you can get to setting a color code into memory to set a pixel's color directly.

But "putting a color code in an address location" means (at least) 8 bits per pixel, which no home computers of that specific era did to my knowledge. While the easy6502 can get away with dedicating 1KB for a 32x32 pixel area, filling in a 200+ line CRT display with 8bpp would take way too much storage space, as well as memory bandwidth. VGA was introduced in 1987, with its 8bpp mode, though it was a while before it became mainstream.

_________________
WFDis Interactive 6502 Disassembler
AcheronVM: A Reconfigurable 16-bit Virtual CPU for the 6502 Microprocessor


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 12, 2016 1:38 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10949
Location: England
The Beeb too has video modes of 1, 2 or 4 bits per pixel, and so 8, 4, or 2 pixels in each byte. I've never used one, but it looks like MSX2 and MSX2+ machines did have modes which had one pixel per byte. (Memory became cheaper - they do use 56k for the screen alone in the high resolution modes. Maybe even twice that. The Beeb uses up to 20k, which is a huge amount for a machine with only 32k RAM!)

But any and all of these modes are relatively straightforward to put simple patterns on screen - you don't need to set anything up as you do with sprites.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 12, 2016 8:58 pm 
Offline

Joined: Sat Dec 13, 2003 3:37 pm
Posts: 1004
That Atari lets you do this. But you set a color register number, and then the color is dereferenced from the register. Except for the single pixel black and white hi-res mode. It supports a bunch of different resolutions for graphics and characters.

The Atari had a special graphic processor which has the concept of a "display list". This lets you mix different graphics modes on the same screen. Each line of data for the display list consumed N number of scan lines on the display, and you were supposed to have enough display list instructions to cover all 192 scan lines. Also, each line in the display list could reference it's own block of memory.

The ANTIC chip was really remarkable.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 12, 2016 11:50 pm 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 578
The Atari eight bit series also let you hook horizontal and vertical blank interrupts and change color registers on the fly. With fancy programming you could display far more colors on a screen than the graphics mode supported out of the box. There were also hardware scroll and smooth scrolling registers that made game programming a snap.

Source many teenage years spent noodling in the assembler editor cartridge.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 13, 2016 12:00 am 
Offline

Joined: Tue Jul 24, 2012 2:27 am
Posts: 674
Of course, the original question was about direct ease of use for the simple "1 color value stored to 1 pixel" case, not how far you could take the graphics with more involved means. ;)

_________________
WFDis Interactive 6502 Disassembler
AcheronVM: A Reconfigurable 16-bit Virtual CPU for the 6502 Microprocessor


Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 03, 2016 9:31 am 
Offline
User avatar

Joined: Sat Dec 07, 2013 4:32 pm
Posts: 246
Location: The Kettle Moraine
whartung wrote:
The ANTIC chip was really remarkable.

Your description sounds much like the Amiga. But it should, they were designed by the same guy.

White Flame wrote:
Of course, the original question was about direct ease of use for the simple "1 color value stored to 1 pixel" case, not how far you could take the graphics with more involved means. ;)
"1 color value store to 1 pixel" or "1 pixel per byte?"


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 06, 2016 1:44 am 
Offline

Joined: Tue Jul 24, 2012 2:27 am
Posts: 674
KC9UDX wrote:
"1 color value store to 1 pixel" or "1 pixel per byte?"

The two really go hand in hand. If one store affects a single pixel, that necessarily means (at least) a byte is allocated per pixel in the memory map, regardless if the color depth is less than 8bpp.

_________________
WFDis Interactive 6502 Disassembler
AcheronVM: A Reconfigurable 16-bit Virtual CPU for the 6502 Microprocessor


Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 08, 2016 2:08 am 
Offline

Joined: Tue Nov 10, 2015 5:46 am
Posts: 228
Location: Kent, UK
Antic mode 14 (aka "Mode E") is a 160x192 bitmap mode with 2-bits per pixel. Back in the day, this was my preferred mode for bitmap work. If 4 colors aren't enough, then as others have mentioned "Display List Interrupts" can be used to change the palette as the beam scans down the screen.

The web is full of Atari 800 information, simulators and tools. It's a fun platform.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: