|
Subject: [stella] If it's not one thing it's another. From: crackers@xxxxxxxx Date: Thu, 4 Sep 1997 00:41:35 -0400 (EDT) |
In article <340DE8DC.914E6B75@xxxxxxxx>, you wrote:
>This isn't a DASM error message... It's causing a GPF while attempting to
>assemble your source. You might be able to get it to run under DOS (which has
>no memory protection) but this is definately a bug in DASM.
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
Well... the problem cleared up as mysteriously as it started. Must be a
windows 95 problem.
But now that I've got my code assembled I'm discovering another new problem.
Horizontal movement turned out to be a breeze once Bob explained it to me in
plain english.... now I'm having trouble with the vertical.
I thought the vertical movement would be a breeze but I'm getting some very
unusual results. Could someone give me their input on my code.
I'm basically trying to incorporate my old PLAYFIELD graphics programme
with a simple programme that draws a sprite on the screen and moves it around.
Doesn't seem to be working though. I thought that maybe I was using too many
cycles, but unless I've drastically miscounted (hey, I've always sucked at
math) I've got a few cycles to spare. So I'm thinking the error is in
my screen logic somewhere.
Here's the code....
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
processor 6502
VSYNC = $00
VBLANK = $01
WSYNC = $02
COLUP0 = $06
COLUPF = $08
COLUBK = $09
CTRLPF = $0A
PF0 = $0D
PF1 = $0E
PF2 = $0F
GP0 = $1B
HMP0 = $20
HMOVE = $2A
CXCLR = $2C
SWCHA = $280
INTIM = $284
TIM64T = $296
VERTPOS = $80 ;This is the vertical position of the sprite
VERTLIN = $81 ;This is a counter so I know what scanline I'm on
GP0SIZE = $82 ;This is how many scan lines the sprite is
BLKSIZE = $83 ;this is the size of a playfield block
BLOCK = $84 ;this is the block # (blksize*(block+1)=192)
org $F000
start SEI
CLD
LDX #$FF
TXS
LDA #$00
zero STA $00,X ;zero out the machine
DEX
BNE zero
LDA #$32 ;set up some of the variables.
STA COLUP0 ;set up sprite colour
LDA #$60 ;set up the starting vertical position of sprite
STA VERTPOS
main JSR vertb
JSR scrnvar
JSR draw
JSR oscan
JMP main
scrnvar LDA #$00 ;screen variables should clean this up later...
STA COLUPF
LDA #$4F
STA COLUBK
LDA #$01
STA CTRLPF
RTS
vertb LDX #$00 ;vertical blank
LDA #$02
STA WSYNC
STA WSYNC
STA WSYNC
STA VSYNC
STA WSYNC
STA WSYNC ;Didn't know I could do an HMOVE here, but I'm
STA HMOVE ;doing HMOVE here to avoid the black line on screen
LDA #$2C ;is this causing my problems? I dunno. But I don't
STA TIM64T ;think so because when I remove the vertical
LDA #$00 ;movement routines everything works fine.
STA CXCLR
LDA #$C0 ;reset the number of vertical lines.
STA VERTLIN
LDA #$1B ;reset the number of sprite lines.
STA GP0SIZE
STA WSYNC
STA VSYNC
RTS
draw LDA INTIM
BNE draw
STA WSYNC
STA VBLANK
load LDX BLOCK
LDA playf0,X
STA PF0
LDA playf1,X
STA PF1
LDA playf2,X
STA PF2
grfx1 DEC VERTLIN ;Checking to see if it's time to draw a sprite yet.
LDA VERTLIN
CMP VERTPOS
BMI sprite1
grfx2 STA WSYNC ;If not then draw then scanline
DEC BLKSIZE ;next line of block
BEQ newblk ;or is it time for a new block?
JMP grfx1 ;get ready for next scanline
sprite1 LDX GP0SIZE
BEQ nosprt ;See if we're finished drawing the sprite.
LDA p0data,x ;If not then load the sprite data.
STA GP0
DEC GP0SIZE ;get set up for next sprite line
JMP grfx2 ;go draw current scanline
nosprt LDA #$00 ;if we're finished with the sprite then
STA GP0 ;just fill the sprite with zeros.
JMP grfx2 ;then draw the scanline.
newblk LDA BLOCK ;check to see if we've finished drawing the screen
BEQ clear
DEC BLOCK ;get ready for the next playfield block
LDA #$08
STA BLKSIZE
JMP load
clear LDA #$02 ;all done the screen.
STA WSYNC
STA VBLANK
RTS
oscan JSR joy ;overscan. Time to read the joysticks.
LDA #$08 ;reset the variables.
STA BLKSIZE ;and other stuff.
LDA #$17
STA BLOCK
LDX #$1E
waste STA WSYNC
DEX
BNE waste
RTS
joy LDA SWCHA ;Please don't laugh at the way I read the
CMP #$7F ;joysticks. I'm certain it's not the
BEQ right ;most efficient way, but it works for this
CMP #$BF ;programme and demonstrates how the joysticks
BEQ left ;work.
CMP #$EF
BEQ up
CMP #$DF
BEQ down
LDA #$00 ;nothing touched, nothing changed.
STA HMP0
RTS
right LDA #$f0 ;set horizontal motion register to one pixel right
STA HMP0
rts
left LDA #$10 ;set horizontal motion register to one pixel left
STA HMP0
rts
up LDA #$BF ;make sure we haven't gone over the top of the screen
CMP VERTPOS
BMI down ;no problem if we have, just go down instead.
LDA #$00
STA HMP0
INC VERTPOS ;if not then increase the vertical position
RTS
down LDA #$00
STA HMP0
DEC VERTPOS ;decrease the vertical position
RTS
org $FF00
playf0 .byte $00 ;playfield data... you know. That "BAT"
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $20
.byte $20
.byte $70
.byte $f0
.byte $f0
.byte $f0
.byte $e0
.byte $e0
.byte $c0
.byte $80
.byte $00
.byte $00
.byte $00
playf1 .byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $10
.byte $10
.byte $11
.byte $3b
.byte $7b
.byte $ff
.byte $ff
.byte $ff
.byte $ff
.byte $ff
.byte $ff
.byte $ff
.byte $7c
.byte $30
playf2 .byte $00
.byte $00
.byte $80
.byte $80
.byte $c0
.byte $c0
.byte $c0
.byte $e2
.byte $e2
.byte $f2
.byte $fa
.byte $ff
.byte $ff
.byte $bf
.byte $bf
.byte $7f
.byte $df
.byte $cf
.byte $a7
.byte $93
.byte $71
.byte $38
.byte $0c
.byte $04
p0data .byte $00 ;sprite data. Stored upside down. BIRA BIRA!
.byte $ff
.byte $81
.byte $ff
.byte $ff
.byte $ff
.byte $7e
.byte $7e
.byte $7e
.byte $7e
.byte $3c
.byte $ff
.byte $81
.byte $ff
.byte $ff
.byte $e7
.byte $66
.byte $3c
.byte $3c
.byte $42
.byte $7e
.byte $42
.byte $ff
.byte $99
.byte $66
.byte $99
.byte $ff
.byte $ff
org $FFFC
.word start
.word start
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
CRACKERS
(Bleary eyed from hell!!!!!!)
--
Accordionist - Wethifl Musician - Atari 2600 Collector | /\/\
*NEW CrAB URL* http://www.hwcn.org/~ad329/crab.html ***| \^^/
Bira Bira Devotee - FES Member - Samurai Pizza Cats Fan| =\/=
--
Archives updated once/day at http://www.biglist.com/lists/stella/archives/
Unsubscribing and other info at http://www.biglist.com/lists/stella/stella.html
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [stella] DASM can really piss m, Greg Miller | Thread | Re: [stella] If it's not one thing , Erik Mooney |
| Re: [stella] DASM can really piss m, Greg Miller | Date | Re: [stella] If it's not one thing , Erik Mooney |
| Month |