mirror of
https://github.com/Pecusx/scorch_src.git
synced 2026-05-20 22:33:43 +02:00
Continued work - version for C64
This commit is contained in:
@@ -0,0 +1,224 @@
|
|||||||
|
.IF *>0 ;this is a trick that prevents compiling this file alone
|
||||||
|
|
||||||
|
; Basic hardware-dependent graphics routines.
|
||||||
|
|
||||||
|
; -----------------------------------------
|
||||||
|
.proc unPlot
|
||||||
|
; plots a point and saves the plotted byte, reverts the previous plot.
|
||||||
|
; -----------------------------------------
|
||||||
|
ldx #0 ; only one pixel
|
||||||
|
unPlotAfterX
|
||||||
|
stx WhichUnPlot
|
||||||
|
|
||||||
|
; first remake the oldie
|
||||||
|
lda oldplotL,x
|
||||||
|
sta oldplot
|
||||||
|
lda oldplotH,x
|
||||||
|
sta oldplot+1
|
||||||
|
|
||||||
|
lda oldply,x
|
||||||
|
tay
|
||||||
|
lda oldora,x
|
||||||
|
sta (oldplot),y
|
||||||
|
|
||||||
|
|
||||||
|
; is it not out of the screen ????
|
||||||
|
cpw ydraw #screenheight
|
||||||
|
jcc CheckX
|
||||||
|
mwa #0 ydraw
|
||||||
|
CheckX
|
||||||
|
cpw xdraw #screenwidth
|
||||||
|
jcs EndOfUnPlot
|
||||||
|
MakeUnPlot
|
||||||
|
; let's count coordinates taken from xdraw and ydraw
|
||||||
|
;xbyte = xbyte/8
|
||||||
|
lda xdraw+1
|
||||||
|
lsr
|
||||||
|
lda xdraw
|
||||||
|
ror ;just one bit over 256. Max screenwidth = 512!!!
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
;---
|
||||||
|
tay
|
||||||
|
ldx WhichUnPlot
|
||||||
|
tya
|
||||||
|
sta oldply,x
|
||||||
|
|
||||||
|
ldx ydraw
|
||||||
|
lda linetableL,x
|
||||||
|
sta xbyte
|
||||||
|
sta oldplot
|
||||||
|
lda linetableH,x
|
||||||
|
sta xbyte+1
|
||||||
|
sta oldplot+1
|
||||||
|
|
||||||
|
lda xdraw
|
||||||
|
and #$7
|
||||||
|
tax
|
||||||
|
|
||||||
|
lda color
|
||||||
|
bne ClearUnPlot
|
||||||
|
|
||||||
|
;plotting here
|
||||||
|
lda (xbyte),y
|
||||||
|
sta OldOraTemp
|
||||||
|
ora bittable,x
|
||||||
|
sta (xbyte),y
|
||||||
|
bne ContinueUnPlot ; allways <>0
|
||||||
|
ClearUnPlot
|
||||||
|
lda (xbyte),y
|
||||||
|
sta OldOraTemp
|
||||||
|
and bittable2,x
|
||||||
|
sta (xbyte),y
|
||||||
|
ContinueUnPlot
|
||||||
|
ldx WhichUnPlot
|
||||||
|
lda OldOraTemp
|
||||||
|
sta oldora,x
|
||||||
|
lda oldplot
|
||||||
|
sta oldplotL,x
|
||||||
|
lda oldplot+1
|
||||||
|
sta oldplotH,x
|
||||||
|
; and now we must solve the problem of several plots
|
||||||
|
; in one byte
|
||||||
|
ldx #4
|
||||||
|
ldy WhichUnPlot
|
||||||
|
LetsCheckOverlapping
|
||||||
|
cpx WhichUnPlot
|
||||||
|
beq SkipThisPlot
|
||||||
|
lda oldplotL,x
|
||||||
|
cmp oldplotL,y
|
||||||
|
bne NotTheSamePlot
|
||||||
|
lda oldplotH,x
|
||||||
|
cmp oldplotH,y
|
||||||
|
bne NotTheSamePlot
|
||||||
|
lda oldply,x
|
||||||
|
cmp oldply,y
|
||||||
|
bne NotTheSamePlot
|
||||||
|
; the pixel is in the same byte so let's take correct contents
|
||||||
|
lda oldora,x
|
||||||
|
sta oldora,y
|
||||||
|
NotTheSamePlot
|
||||||
|
SkipThisPlot
|
||||||
|
dex
|
||||||
|
bpl LetsCheckOverlapping
|
||||||
|
EndOfUnPlot
|
||||||
|
rts
|
||||||
|
.endp
|
||||||
|
|
||||||
|
; -----------------------------------------
|
||||||
|
.proc plot ;plot (xdraw, ydraw, color)
|
||||||
|
; color == 1 --> put pixel
|
||||||
|
; color == 0 --> erase pixel
|
||||||
|
; this is one of the most important routines in the whole
|
||||||
|
; game. If you are going to speed up the game, start with
|
||||||
|
; plot - it is used by every single effect starting from explosions
|
||||||
|
; through line drawing and small text output!!!
|
||||||
|
;
|
||||||
|
; Optimized by 0xF (Fox) THXXXX!!!
|
||||||
|
|
||||||
|
; -----------------------------------------
|
||||||
|
; is it not over the screen ???
|
||||||
|
cpw ydraw #(screenheight+1); changed for one additional line. cpw ydraw #(screenheight-1)
|
||||||
|
bcs unPlot.EndOfUnPlot ;nearest RTS
|
||||||
|
CheckX02
|
||||||
|
cpw xdraw #screenwidth
|
||||||
|
bcs EndOfPlot
|
||||||
|
MakePlot
|
||||||
|
; let's calculate coordinates from xdraw and ydraw
|
||||||
|
|
||||||
|
;xbyte = xbyte/8
|
||||||
|
lda xdraw+1
|
||||||
|
lsr
|
||||||
|
lda xdraw
|
||||||
|
ror ;just one bit over 256. Max screenwidth = 512!!!
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
sta xbyte
|
||||||
|
;---
|
||||||
|
ldx ydraw
|
||||||
|
ldy linetableL,x
|
||||||
|
lda linetableH,x
|
||||||
|
sta xbyte+1
|
||||||
|
|
||||||
|
lda xdraw
|
||||||
|
and #$7
|
||||||
|
tax
|
||||||
|
lda color
|
||||||
|
bne ClearPlot
|
||||||
|
|
||||||
|
lda (xbyte),y
|
||||||
|
ora bittable,x
|
||||||
|
sta (xbyte),y
|
||||||
|
EndOfPlot
|
||||||
|
rts
|
||||||
|
ClearPlot
|
||||||
|
lda (xbyte),y
|
||||||
|
and bittable2,x
|
||||||
|
sta (xbyte),y
|
||||||
|
rts
|
||||||
|
.endp
|
||||||
|
|
||||||
|
; -----------------------------------------
|
||||||
|
.proc point_plot
|
||||||
|
; -----------------------------------------
|
||||||
|
; checks state of the pixel (coordinates in xdraw and ydraw)
|
||||||
|
; result is in A (zero or appropriate bit is set)
|
||||||
|
|
||||||
|
; let's calculate coordinates from xdraw and ydraw
|
||||||
|
|
||||||
|
;xbyte = xbyte/8
|
||||||
|
lda xdraw+1
|
||||||
|
lsr
|
||||||
|
lda xdraw
|
||||||
|
ror ;just one bit over 256. Max screenwidht = 512!!!
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
sta xbyte
|
||||||
|
;---
|
||||||
|
ldx ydraw
|
||||||
|
ldy linetableL,x
|
||||||
|
lda linetableH,x
|
||||||
|
sta xbyte+1
|
||||||
|
|
||||||
|
lda xdraw
|
||||||
|
and #$7
|
||||||
|
tax
|
||||||
|
|
||||||
|
lda (xbyte),y
|
||||||
|
eor #$ff
|
||||||
|
and bittable,x
|
||||||
|
rts
|
||||||
|
.endp
|
||||||
|
|
||||||
|
;--------------------------------------------------
|
||||||
|
.proc ClearScreen
|
||||||
|
;--------------------------------------------------
|
||||||
|
mwa #display temp
|
||||||
|
ldy #0
|
||||||
|
@ lda #$ff
|
||||||
|
sta (temp),y
|
||||||
|
inw temp
|
||||||
|
cpw temp #display+screenheight*screenBytes+1
|
||||||
|
bne @-
|
||||||
|
rts
|
||||||
|
.endp
|
||||||
|
|
||||||
|
;--------------------------------------------------
|
||||||
|
.proc GenerateLineTable
|
||||||
|
|
||||||
|
mwa #displayC64 temp
|
||||||
|
mwa #linetableL temp2
|
||||||
|
mwa #linetableH modify
|
||||||
|
ldy #0
|
||||||
|
@ lda temp
|
||||||
|
sta (temp2),y
|
||||||
|
lda temp+1
|
||||||
|
sta (modify),y
|
||||||
|
adw temp #40
|
||||||
|
iny
|
||||||
|
cpy #screenheight+1
|
||||||
|
bne @-
|
||||||
|
rts
|
||||||
|
.endp
|
||||||
|
|
||||||
|
.ENDIF
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
; @com.wudsn.ide.asm.mainsourcefile=scorch.asm
|
||||||
|
|
||||||
|
.IF *>0 ;this is a trick that prevents compiling this file alone
|
||||||
|
|
||||||
|
|
||||||
|
;--------------------------------------------------
|
||||||
|
.macro SetDLI
|
||||||
|
; SetDLI #WORD
|
||||||
|
; Initialises Display List Interrupts
|
||||||
|
LDY # <:1
|
||||||
|
LDX # >:1
|
||||||
|
jsr _SetDLIproc
|
||||||
|
.endm
|
||||||
|
.proc _SetDLIproc
|
||||||
|
; LDA #$C0
|
||||||
|
; STY VDSLST
|
||||||
|
; STX VDSLST+1
|
||||||
|
; STA NMIEN
|
||||||
|
rts
|
||||||
|
.endp
|
||||||
|
|
||||||
|
.ENDIF
|
||||||
+1
-1
@@ -85,7 +85,7 @@ upstartEnd
|
|||||||
// Set Data Direction for CIA #2, Port A to output
|
// Set Data Direction for CIA #2, Port A to output
|
||||||
//
|
//
|
||||||
lda $dd02
|
lda $dd02
|
||||||
and #%11111100 // Mask the bits we're interested in.
|
and #%11111100 // Mask the bits were interested in.
|
||||||
ora #$03 // Set bits 0 and 1.
|
ora #$03 // Set bits 0 and 1.
|
||||||
sta $dd02
|
sta $dd02
|
||||||
|
|
||||||
|
|||||||
+1793
File diff suppressed because it is too large
Load Diff
@@ -174,6 +174,12 @@ WeaponFont
|
|||||||
; Game Code
|
; Game Code
|
||||||
;--------------------------------------------------
|
;--------------------------------------------------
|
||||||
FirstSTART
|
FirstSTART
|
||||||
|
|
||||||
|
displayC64 = $2000 ; graphics screen memory start
|
||||||
|
SwitchVICBank(0)
|
||||||
|
SetScreenMemory(displayC64)
|
||||||
|
SetHiresBitmapMode ; Hires mode on
|
||||||
|
|
||||||
jsr MakeDarkScreen
|
jsr MakeDarkScreen
|
||||||
|
|
||||||
; one time zero variables in RAM (non zero page)
|
; one time zero variables in RAM (non zero page)
|
||||||
|
|||||||
Reference in New Issue
Block a user