mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-07-04 09:29:28 +00:00
Switched over to ACME for raycaster. Also made output of packer more brief.
This commit is contained in:
parent
74ffc67278
commit
3eb021aad8
@ -354,7 +354,7 @@ class PackPartitions
|
||||
else if (id)
|
||||
println "Warning: can't match tile name '$name' to any image; treating as blank."
|
||||
}
|
||||
else
|
||||
else if (name != 'street')
|
||||
println "Note: ignoring non-obstruction '$name' until sprite support is added."
|
||||
}
|
||||
}
|
||||
@ -408,7 +408,7 @@ class PackPartitions
|
||||
{
|
||||
def num = textures.size() + 1
|
||||
def name = imgEl.@name ?: "img$num"
|
||||
println "Packing texture #$num named '${imgEl.@name}'."
|
||||
//println "Packing texture #$num named '${imgEl.@name}'."
|
||||
def pixels = parseTexture(imgEl)
|
||||
calcTransparency(pixels)
|
||||
def buf = ByteBuffer.allocate(50000)
|
||||
@ -420,7 +420,7 @@ class PackPartitions
|
||||
{
|
||||
def num = frames.size() + 1
|
||||
def name = imgEl.@name ?: "img$num"
|
||||
println "Packing frame image #$num named '${imgEl.@name}'."
|
||||
//println "Packing frame image #$num named '${imgEl.@name}'."
|
||||
def buf = parseFrameData(imgEl)
|
||||
frames[imgEl.@name] = [num:num, buf:buf]
|
||||
return buf
|
||||
@ -430,7 +430,7 @@ class PackPartitions
|
||||
{
|
||||
def num = tiles.size() + 1
|
||||
def name = imgEl.@name ?: "img$num"
|
||||
println "Packing tile image #$num named '${imgEl.@name}'."
|
||||
//println "Packing tile image #$num named '${imgEl.@name}'."
|
||||
def buf = parseTileData(imgEl)
|
||||
tiles[imgEl.@name] = [num:num, buf:buf]
|
||||
return buf
|
||||
@ -440,7 +440,7 @@ class PackPartitions
|
||||
{
|
||||
def num = maps2D.size() + 1
|
||||
def name = mapEl.@name ?: "map$num"
|
||||
println "Packing 2D map #$num named '$name'."
|
||||
//println "Packing 2D map #$num named '$name'."
|
||||
def rows = parseMap(mapEl, tileEls)
|
||||
def buf = ByteBuffer.allocate(50000)
|
||||
write2DMap(buf, rows)
|
||||
@ -451,7 +451,7 @@ class PackPartitions
|
||||
{
|
||||
def num = maps3D.size() + 1
|
||||
def name = mapEl.@name ?: "map$num"
|
||||
println "Packing 3D map #$num named '$name'."
|
||||
//println "Packing 3D map #$num named '$name'."
|
||||
def rows = parseMap(mapEl, tileEls)
|
||||
def buf = ByteBuffer.allocate(50000)
|
||||
write3DMap(buf, rows)
|
||||
@ -470,7 +470,7 @@ class PackPartitions
|
||||
def readCode(name, path)
|
||||
{
|
||||
def num = code.size() + 1
|
||||
println "Reading code #$num from '$path'."
|
||||
//println "Reading code #$num from '$path'."
|
||||
def inBuf = new byte[256]
|
||||
def outBuf = ByteBuffer.allocate(50000)
|
||||
def stream = new File(path).withInputStream { stream ->
|
||||
@ -532,8 +532,9 @@ class PackPartitions
|
||||
// Read in code chunks. For now these are hard coded, but I guess they ought to
|
||||
// be configured in a config file somewhere...?
|
||||
//
|
||||
readCode("render", "src/raycast/build/render.bin#6000")
|
||||
readCode("expand", "src/raycast/build/expand.bin#0800")
|
||||
println "Reading code resources."
|
||||
readCode("render", "src/raycast/build/render.b")
|
||||
readCode("expand", "src/raycast/build/expand.b")
|
||||
|
||||
// Open the XML data file produced by Outlaw Editor
|
||||
def dataIn = new XmlParser().parse(xmlPath)
|
||||
@ -541,11 +542,13 @@ class PackPartitions
|
||||
// Pack each tile, which has the side-effect of filling in the
|
||||
// tile name map.
|
||||
//
|
||||
println "Packing tile images."
|
||||
dataIn.tile.each { packTile(it) }
|
||||
|
||||
// Pack each image, which has the side-effect of filling in the
|
||||
// image name map. Handle frame images separately.
|
||||
//
|
||||
println "Packing frame images and textures."
|
||||
dataIn.image.each { image ->
|
||||
if (image.category.text() == "frame" )
|
||||
packFrameImage(image)
|
||||
@ -554,6 +557,7 @@ class PackPartitions
|
||||
}
|
||||
|
||||
// Pack each map This uses the image and tile maps filled earlier.
|
||||
println "Packing maps."
|
||||
dataIn.map.each { map ->
|
||||
if (map?.@name =~ /2D/)
|
||||
pack2DMap(map, dataIn.tile)
|
||||
|
@ -6,6 +6,7 @@
|
||||
<property name="src.dir" location="./src"/>
|
||||
<property name="build.dir" value="./build"/>
|
||||
<property name="a2copy.dir" value="../tools/A2Copy/dist"/>
|
||||
<property name="pack.dir" value="../tools/PackPartitions/dist"/>
|
||||
|
||||
<property name="IMG_FILE" value="${build.dir}/${projName}.bin#${ORG_ADDR}"/>
|
||||
|
||||
@ -28,11 +29,16 @@
|
||||
<!-- Build sub-projects -->
|
||||
<echo>Building core.</echo>
|
||||
<ant dir="${src.dir}/core" target="build" useNativeBasedir="true" inheritAll="false"/>
|
||||
|
||||
<!-- Build sub-projects -->
|
||||
<echo>Building raycast.</echo>
|
||||
<ant dir="${src.dir}/raycast" target="build" useNativeBasedir="true" inheritAll="false"/>
|
||||
|
||||
<!-- Pack the game data -->
|
||||
<echo>Packing game and code resources.</echo>
|
||||
<java jar="${pack.dir}/PackPartitions.jar" fork="true" failonerror="true">
|
||||
<arg value="game/world.xml"/>
|
||||
<arg value="data/partitions/game.part.0.bin"/>
|
||||
</java>
|
||||
|
||||
<!-- Construct a directory to put on the Apple -->
|
||||
<delete failonerror="false" dir="${build.dir}/root"/>
|
||||
<mkdir dir="${build.dir}/root"/>
|
||||
|
@ -1131,7 +1131,7 @@ readToAux: !zone
|
||||
;------------------------------------------------------------------------------
|
||||
; Segment tables
|
||||
|
||||
!if DEBUG { !align 256,0 }
|
||||
!if DEBUG { !align 255,0 }
|
||||
|
||||
tSegLink = * : !fill MAX_SEGS
|
||||
tSegType = * : !fill MAX_SEGS
|
||||
|
@ -8,6 +8,49 @@
|
||||
!word addr
|
||||
}
|
||||
|
||||
!macro prSpace {
|
||||
jsr _prSpace
|
||||
}
|
||||
|
||||
!macro prA {
|
||||
jsr _prA
|
||||
jsr _prSpace
|
||||
}
|
||||
|
||||
!macro prX {
|
||||
jsr _prX
|
||||
jsr _prSpace
|
||||
}
|
||||
|
||||
!macro prY {
|
||||
jsr _prY
|
||||
jsr _prSpace
|
||||
}
|
||||
|
||||
!macro prXA {
|
||||
jsr _prX
|
||||
jsr _prA
|
||||
jsr _prSpace
|
||||
}
|
||||
|
||||
!macro prAX {
|
||||
jsr _prA
|
||||
jsr _prX
|
||||
jsr _prSpace
|
||||
}
|
||||
|
||||
!macro prXY {
|
||||
jsr _prX
|
||||
jsr _prY
|
||||
jsr _prSpace
|
||||
}
|
||||
|
||||
!macro prYX {
|
||||
jsr _prY
|
||||
jsr _prX
|
||||
jsr _prSpace
|
||||
}
|
||||
|
||||
!macro prWord addr {
|
||||
jsr _prWord
|
||||
!word addr
|
||||
@ -41,7 +84,6 @@ _writeStr: !zone
|
||||
tsx
|
||||
.loop: jsr _getStackByte
|
||||
beq .done
|
||||
ora #$80
|
||||
jsr cout
|
||||
cmp #$AE ; "."
|
||||
bne .loop
|
||||
@ -64,15 +106,49 @@ _prShared: !zone
|
||||
jsr prbyte
|
||||
dey
|
||||
bpl .ld
|
||||
+prSpace
|
||||
jmp iorest
|
||||
|
||||
_prSpace:
|
||||
php
|
||||
pha
|
||||
lda #$A0
|
||||
jsr cout
|
||||
jmp iorest
|
||||
pla
|
||||
plp
|
||||
rts
|
||||
|
||||
_prWord: !zone
|
||||
jsr iosave
|
||||
ldy #1
|
||||
bne _prShared ; always taken
|
||||
|
||||
_prA: !zone
|
||||
php
|
||||
pha
|
||||
jsr prbyte
|
||||
pla
|
||||
plp
|
||||
rts
|
||||
|
||||
_prX: !zone
|
||||
php
|
||||
pha
|
||||
txa
|
||||
jsr prbyte
|
||||
pla
|
||||
plp
|
||||
rts
|
||||
|
||||
_prY: !zone
|
||||
php
|
||||
pha
|
||||
tya
|
||||
jsr prbyte
|
||||
pla
|
||||
plp
|
||||
rts
|
||||
|
||||
_crout: !zone
|
||||
php
|
||||
pha
|
||||
|
@ -5,15 +5,13 @@
|
||||
<property name="projName" value="render"/> <!-- base part of output bin name -->
|
||||
<property name="src.dir" location="."/>
|
||||
<property name="include.dir" location="../include"/>
|
||||
<property file="${include.dir}/build.props"/> <!-- needs to define CC65_BIN_DIR -->
|
||||
<property file="${include.dir}/build.props"/> <!-- needs to define ACME_BIN_DIR -->
|
||||
|
||||
<property name="build.dir" value="${src.dir}/build"/>
|
||||
|
||||
<property name="CA65_TOOL" location="${CC65_BIN_DIR}/ca65"/>
|
||||
<property name="LD65_TOOL" location="${CC65_BIN_DIR}/ld65"/>
|
||||
<property name="ACME_TOOL" location="${ACME_BIN_DIR}/acme"/>
|
||||
|
||||
<property name="ASM_SETTINGS" value="-t apple2"/>
|
||||
<property name="ASM_INCLUDES" value="-I .."/>
|
||||
<property name="ASM_SETTINGS" value="-f plain"/>
|
||||
|
||||
<target name="all">
|
||||
<antcall target="clean"/>
|
||||
@ -30,41 +28,16 @@
|
||||
<mkdir dir="${build.dir}"/>
|
||||
|
||||
<!-- Assemble all .s files -->
|
||||
<apply executable="${CA65_TOOL}" dir="${src.dir}"
|
||||
<apply executable="${ACME_TOOL}" dir="${src.dir}"
|
||||
relative="true" parallel="false" failonerror="true" verbose="true">
|
||||
<fileset dir="${src.dir}" includes="*.s"/>
|
||||
<mapper type="glob" from="*.s" to="${build.dir}/*.o"/>
|
||||
<arg line="${ASM_INCLUDES}"/>
|
||||
<mapper type="glob" from="*.s" to="${build.dir}/*.b"/>
|
||||
<arg line="${ASM_SETTINGS}"/>
|
||||
<arg line="-o"/>
|
||||
<targetfile/>
|
||||
<srcfile/>
|
||||
</apply>
|
||||
|
||||
<!-- Link the texture expansion code -->
|
||||
<apply executable="${LD65_TOOL}" dir="${build.dir}"
|
||||
failonerror="true" verbose="true">
|
||||
<arg value="-o"/>
|
||||
<arg value="${build.dir}/expand.bin#0800"/>
|
||||
<arg value="--config"/>
|
||||
<arg value="${include.dir}/link.cfg"/>
|
||||
<arg value="--start-addr"/>
|
||||
<arg value="0x$800"/>
|
||||
<fileset dir="${build.dir}" includes="expand.o"/>
|
||||
</apply>
|
||||
|
||||
<!-- Link the main rendering code -->
|
||||
<apply executable="${LD65_TOOL}" dir="${build.dir}"
|
||||
failonerror="true" verbose="true">
|
||||
<arg value="-o"/>
|
||||
<arg value="${build.dir}/render.bin#6000"/>
|
||||
<arg value="--config"/>
|
||||
<arg value="${include.dir}/link.cfg"/>
|
||||
<arg value="--start-addr"/>
|
||||
<arg value="0x$6000"/>
|
||||
<fileset dir="${build.dir}" includes="render.o"/>
|
||||
</apply>
|
||||
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,100 +1,100 @@
|
||||
|
||||
|
||||
; Select mipmap level 0 (64x64 pixels = 32x32 bytes)
|
||||
selectMip0:
|
||||
; pTex is already pointing at level 0, no need to adjust its level.
|
||||
; However, we do need to move it to the correct column. Currently txColumn
|
||||
; is 0..255 pixels, which we need to translate to 0..31 columns; that's
|
||||
; a divide by 8. But then we need to multiply by 32 bytes per column,
|
||||
; so (1/8)*32 = 4, so we need to multiply by 4 after masking.
|
||||
lda #0
|
||||
sta tmp
|
||||
lda txColumn
|
||||
and #$F8 ; retain upper 5 bits
|
||||
asl
|
||||
rol tmp ; multiplied by 2
|
||||
asl
|
||||
rol tmp ; multiplied by 4
|
||||
ldy tmp
|
||||
; pTex is already pointing at level 0, no need to adjust its level.
|
||||
; However, we do need to move it to the correct column. Currently txColumn
|
||||
; is 0..255 pixels, which we need to translate to 0..31 columns; that's
|
||||
; a divide by 8. But then we need to multiply by 32 bytes per column,
|
||||
; so (1/8)*32 = 4, so we need to multiply by 4 after masking.
|
||||
lda #0
|
||||
sta tmp
|
||||
lda txColumn
|
||||
and #$F8 ; retain upper 5 bits
|
||||
asl
|
||||
rol tmp ; multiplied by 2
|
||||
asl
|
||||
rol tmp ; multiplied by 4
|
||||
ldy tmp
|
||||
mipReady:
|
||||
clc ; adjust pTex by that much
|
||||
adc pTex
|
||||
sta pTex
|
||||
tya
|
||||
adc pTex+1
|
||||
sta pTex+1
|
||||
ldy pixNum ; get offset into the blit roll for this column
|
||||
ldx @blitOffsets,y
|
||||
ldy #$FF ; default to copying from top of column (will be 0 after initial INY in unrolled code)
|
||||
clv ; so code can use BVC to branch always without BRA
|
||||
rts
|
||||
@blitOffsets: .byte BLIT_OFF0,BLIT_OFF1,BLIT_OFF2,BLIT_OFF3,BLIT_OFF4,BLIT_OFF5,BLIT_OFF6
|
||||
clc ; adjust pTex by that much
|
||||
adc pTex
|
||||
sta pTex
|
||||
tya
|
||||
adc pTex+1
|
||||
sta pTex+1
|
||||
ldy pixNum ; get offset into the blit roll for this column
|
||||
ldx .blitOffsets,y
|
||||
ldy #$FF ; default to copying from top of column (will be 0 after initial INY in unrolled code)
|
||||
clv ; so code can use BVC to branch always without BRA
|
||||
rts
|
||||
.blitOffsets: !byte BLIT_OFF0,BLIT_OFF1,BLIT_OFF2,BLIT_OFF3,BLIT_OFF4,BLIT_OFF5,BLIT_OFF6
|
||||
|
||||
; Select mipmap level 0 (32x32 pixels = 16x16 bytes)
|
||||
selectMip1:
|
||||
; pTex is pointing at level 0, so we need to move it to level 1.
|
||||
; Then we need to move it to the correct column. Currently txColumn
|
||||
; is 0..255 pixels, which we need to translate to 0..15 columns; that's
|
||||
; a divide by 16. But then we need to multiply by 16 bytes per column,
|
||||
; so (1/16)*16 = 1 ==> no multiply needed.
|
||||
lda txColumn
|
||||
and #$F0 ; retain upper 4 bits
|
||||
ldy #>MIP_OFFSET_1 ; adjust to mip level 1
|
||||
bne mipReady ; always taken
|
||||
; pTex is pointing at level 0, so we need to move it to level 1.
|
||||
; Then we need to move it to the correct column. Currently txColumn
|
||||
; is 0..255 pixels, which we need to translate to 0..15 columns; that's
|
||||
; a divide by 16. But then we need to multiply by 16 bytes per column,
|
||||
; so (1/16)*16 = 1 ==> no multiply needed.
|
||||
lda txColumn
|
||||
and #$F0 ; retain upper 4 bits
|
||||
ldy #>MIP_OFFSET_1 ; adjust to mip level 1
|
||||
bne mipReady ; always taken
|
||||
|
||||
; Select mipmap level 2 (16x16 pixels = 8x8 bytes)
|
||||
selectMip2:
|
||||
; pTex is pointing at level 0, so we need to move it to level 2.
|
||||
; Then we need to move it to the correct column. Currently txColumn
|
||||
; is 0..255 pixels, which we need to translate to 0..8 columns; that's
|
||||
; a divide by 32. But then we need to multiply by 8 bytes per column,
|
||||
; so (1/32)*8 = 1/4 ==> overall we need to divide by 4.
|
||||
lda txColumn
|
||||
and #$E0 ; retain upper 3 bits
|
||||
lsr ; div by 2
|
||||
lsr ; div by 4
|
||||
; no need to add #<MIP_OFFSET_2, since it is zero.
|
||||
ldy #>MIP_OFFSET_2 ; adjust to mip level 2
|
||||
bne mipReady ; always taken
|
||||
; pTex is pointing at level 0, so we need to move it to level 2.
|
||||
; Then we need to move it to the correct column. Currently txColumn
|
||||
; is 0..255 pixels, which we need to translate to 0..8 columns; that's
|
||||
; a divide by 32. But then we need to multiply by 8 bytes per column,
|
||||
; so (1/32)*8 = 1/4 ==> overall we need to divide by 4.
|
||||
lda txColumn
|
||||
and #$E0 ; retain upper 3 bits
|
||||
lsr ; div by 2
|
||||
lsr ; div by 4
|
||||
; no need to add #<MIP_OFFSET_2, since it is zero.
|
||||
ldy #>MIP_OFFSET_2 ; adjust to mip level 2
|
||||
bne mipReady ; always taken
|
||||
|
||||
; Select mipmap level 3 (8x8 pixels = 4x4 bytes)
|
||||
selectMip3:
|
||||
; pTex is pointing at level 0, so we need to move it to level 3.
|
||||
; Then we need to move it to the correct column. Currently txColumn
|
||||
; is 0..255 pixels, which we need to translate to 0..3 columns; that's
|
||||
; a divide by 64. But then we need to multiply by 4 bytes per column,
|
||||
; so (1/64)*4 = 1/16 ==> overall we need to divide by 16.
|
||||
lda txColumn
|
||||
and #$C0 ; retain upper 2 bits
|
||||
lsr ; div by 2
|
||||
lsr ; div by 4
|
||||
lsr ; div by 8
|
||||
lsr ; div by 16
|
||||
clc
|
||||
adc #<MIP_OFFSET_3
|
||||
ldy #>MIP_OFFSET_3 ; adjust to mip level 3
|
||||
bne mipReady ; always taken
|
||||
; pTex is pointing at level 0, so we need to move it to level 3.
|
||||
; Then we need to move it to the correct column. Currently txColumn
|
||||
; is 0..255 pixels, which we need to translate to 0..3 columns; that's
|
||||
; a divide by 64. But then we need to multiply by 4 bytes per column,
|
||||
; so (1/64)*4 = 1/16 ==> overall we need to divide by 16.
|
||||
lda txColumn
|
||||
and #$C0 ; retain upper 2 bits
|
||||
lsr ; div by 2
|
||||
lsr ; div by 4
|
||||
lsr ; div by 8
|
||||
lsr ; div by 16
|
||||
clc
|
||||
adc #<MIP_OFFSET_3
|
||||
ldy #>MIP_OFFSET_3 ; adjust to mip level 3
|
||||
bne mipReady ; always taken
|
||||
|
||||
; Select mipmap level 4 (4x4 pixels = 2x2 bytes)
|
||||
selectMip4:
|
||||
; pTex is pointing at level 0, so we need to move it to level 4.
|
||||
; Then we need to move it to the correct column. Currently txColumn
|
||||
; is 0..255 pixels, which we need to translate to 0..1 columns; that's
|
||||
; a divide by 128. But then we need to multiply by 2 bytes per column,
|
||||
; so (1/128)*2 = 1/64 ==> overall we need to divide by 64
|
||||
lda txColumn
|
||||
and #$80 ; retain the high bit
|
||||
beq :+ ; if not set, result should be zero
|
||||
lda #64 ; else result should be 64
|
||||
: clc
|
||||
adc #<MIP_OFFSET_4
|
||||
ldy #>MIP_OFFSET_4 ; adjust to mip level 4
|
||||
bne mipReady ; always taken
|
||||
; pTex is pointing at level 0, so we need to move it to level 4.
|
||||
; Then we need to move it to the correct column. Currently txColumn
|
||||
; is 0..255 pixels, which we need to translate to 0..1 columns; that's
|
||||
; a divide by 128. But then we need to multiply by 2 bytes per column,
|
||||
; so (1/128)*2 = 1/64 ==> overall we need to divide by 64
|
||||
lda txColumn
|
||||
and #$80 ; retain the high bit
|
||||
beq + ; if not set, result should be zero
|
||||
lda #64 ; else result should be 64
|
||||
+ clc
|
||||
adc #<MIP_OFFSET_4
|
||||
ldy #>MIP_OFFSET_4 ; adjust to mip level 4
|
||||
bne mipReady ; always taken
|
||||
|
||||
; Select mipmap level 5 (2x2 pixels = 1x1 bytes)
|
||||
selectMip5:
|
||||
; Mip level 5 is super-easy: it's one byte. Not much choice there.
|
||||
lda #<MIP_OFFSET_5
|
||||
ldy #>MIP_OFFSET_5
|
||||
bne mipReady ; always taken
|
||||
; Mip level 5 is super-easy: it's one byte. Not much choice there.
|
||||
lda #<MIP_OFFSET_5
|
||||
ldy #>MIP_OFFSET_5
|
||||
bne mipReady ; always taken
|
||||
|
||||
|
||||
|
@ -20,8 +20,8 @@ finalSuffixMap = {}
|
||||
dstHeights = set()
|
||||
|
||||
outFile = open("expand.s", "w")
|
||||
outFile.write(" .org $800\n")
|
||||
outFile.write(" .include \"render.i\"\n")
|
||||
outFile.write("* = $800\n")
|
||||
outFile.write("!source \"render.i\"\n")
|
||||
outFile.write("\n")
|
||||
|
||||
def calcKey(cmds):
|
||||
@ -100,14 +100,14 @@ class Segment:
|
||||
return
|
||||
if s.refs == 1:
|
||||
# singletons aren't generated near their target
|
||||
outFile.write("%s jmp %s\n" % (prefix, s.truncLabel))
|
||||
outFile.write("%s\tjmp %s\n" % (prefix, s.truncLabel))
|
||||
prefix = " "
|
||||
else:
|
||||
# non-singletons are generated near their target
|
||||
outFile.write("%s bvc %s\n" % (prefix, s.truncLabel))
|
||||
outFile.write("%s\tbvc %s\n" % (prefix, s.truncLabel))
|
||||
prefix = " "
|
||||
else:
|
||||
outFile.write("%s jsr %s\n" % (prefix, s.truncLabel))
|
||||
outFile.write("%s\tjsr %s\n" % (prefix, s.truncLabel))
|
||||
prefix = " "
|
||||
break
|
||||
label = calcLabel(s.cmds[i:])
|
||||
@ -121,24 +121,24 @@ class Segment:
|
||||
first = False
|
||||
c = s.cmds[i]
|
||||
if c == 'L':
|
||||
outFile.write("%s iny\n" % prefix)
|
||||
outFile.write("%s\tiny\n" % prefix)
|
||||
prefix = " "
|
||||
outFile.write(" lda (pTex),y\n")
|
||||
outFile.write("\tlda (pTex),y\n")
|
||||
needTransparencyCheck = True
|
||||
elif c == '<':
|
||||
outFile.write("%s asl\n" % prefix)
|
||||
outFile.write("%s\tasl\n" % prefix)
|
||||
prefix = " "
|
||||
needTransparencyCheck = True
|
||||
else:
|
||||
assert c < screenHeight
|
||||
if needTransparencyCheck:
|
||||
outFile.write(" bmi :+\n")
|
||||
prefix = ":"
|
||||
outFile.write(" sta %s*BLIT_STRIDE + blitRoll,x\n" % c)
|
||||
outFile.write("\tbmi +\n")
|
||||
prefix = "+"
|
||||
outFile.write("\tsta %s*BLIT_STRIDE + blitRoll,x\n" % c)
|
||||
needTransparencyCheck = False
|
||||
else:
|
||||
if grouped:
|
||||
outFile.write("%s rts\n" % prefix)
|
||||
outFile.write("%s\trts\n" % prefix)
|
||||
prefix = " "
|
||||
if grouped:
|
||||
outFile.write("\n")
|
||||
@ -241,11 +241,11 @@ for h in range(0, 256, 2):
|
||||
outFile.write("expand_vec:\n")
|
||||
if h in dstHeights:
|
||||
dstHeight = h
|
||||
outFile.write(" .addr expand_%d\n" % dstHeight)
|
||||
outFile.write("\t!word expand_%d\n" % dstHeight)
|
||||
outFile.write("\n")
|
||||
|
||||
# Include the expand header code
|
||||
outFile.write(" .include \"expand_hdr.i\"\n")
|
||||
outFile.write("!source \"expand_hdr.i\"\n")
|
||||
|
||||
# Let's optimize.
|
||||
segsToOpt = copy.copy(allSegs)
|
||||
@ -307,9 +307,9 @@ while len(segsToOpt) > 0:
|
||||
for (srcHeight, dstHeight, mipLevel, texOff, segs) in allHeights:
|
||||
outFile.write("; Produce %d rows from %d rows\n" % (dstHeight, srcHeight))
|
||||
outFile.write("expand_%d:\n" % dstHeight)
|
||||
outFile.write(" jsr selectMip%d\n" % mipLevel)
|
||||
outFile.write("\tjsr selectMip%d\n" % mipLevel)
|
||||
if (texOff != 0):
|
||||
outFile.write(" ldy #%d\n" % (texOff-1)) # -1 because we always do initial INY before LDA (ptr,Y)
|
||||
outFile.write("\tldy #%d\n" % (texOff-1)) # -1 because we always do initial INY before LDA (ptr,Y)
|
||||
for i in range(len(segs)):
|
||||
seg = allSegs[segs[i]]
|
||||
if seg.refs == 1 and not(seg.generated):
|
||||
@ -319,9 +319,9 @@ for (srcHeight, dstHeight, mipLevel, texOff, segs) in allHeights:
|
||||
if "expand_0" not in generatedLabels:
|
||||
outFile.write("expand_0:\n")
|
||||
generatedLabels.add("expand_0")
|
||||
outFile.write(" rts\n")
|
||||
outFile.write("\trts\n")
|
||||
else:
|
||||
outFile.write(" %s %s\n" % ("jsr" if i < len(segs)-1 else "jmp", calcLabel(seg.cmds)))
|
||||
outFile.write("\t%s %s\n" % ("jsr" if i < len(segs)-1 else "jmp", calcLabel(seg.cmds)))
|
||||
outFile.write("\n")
|
||||
|
||||
# Generate the misc segments missed earlier
|
||||
|
@ -1,91 +1,91 @@
|
||||
; Shared definitions for the rendering code
|
||||
|
||||
.include "../include/global.i"
|
||||
!source "../include/global.i"
|
||||
|
||||
; Constants
|
||||
TOP_LINE = $2180 ; 24 lines down from top
|
||||
NLINES = 128
|
||||
TEX_SIZE = $555 ; 32x32 + 16x16 + 8x8 + 4x4 + 2x2 + 1x1
|
||||
TOP_LINE = $2180 ; 24 lines down from top
|
||||
NLINES = 128
|
||||
TEX_SIZE = $555 ; 32x32 + 16x16 + 8x8 + 4x4 + 2x2 + 1x1
|
||||
|
||||
; Byte offset for each pixel in the blit unroll
|
||||
BLIT_OFF0 = 5
|
||||
BLIT_OFF1 = 8
|
||||
BLIT_OFF2 = 11
|
||||
BLIT_OFF3 = 1
|
||||
BLIT_OFF4 = 17
|
||||
BLIT_OFF5 = 20
|
||||
BLIT_OFF6 = 24
|
||||
BLIT_OFF0 = 5
|
||||
BLIT_OFF1 = 8
|
||||
BLIT_OFF2 = 11
|
||||
BLIT_OFF3 = 1
|
||||
BLIT_OFF4 = 17
|
||||
BLIT_OFF5 = 20
|
||||
BLIT_OFF6 = 24
|
||||
|
||||
BLIT_STRIDE = 29
|
||||
BLIT_STRIDE = 29
|
||||
|
||||
MAX_TEXTURES = 62 ; sized to fit memory space below
|
||||
MAX_TEXTURES = 62 ; sized to fit memory space below
|
||||
|
||||
; Renderer zero page
|
||||
tmp = $4 ; len 2
|
||||
pTmp = $6 ; len 2
|
||||
pDst = $8 ; len 2
|
||||
pTex = $A ; len 2
|
||||
pixNum = $C ; len 1
|
||||
byteNum = $D ; len 1
|
||||
mapWidth = $12 ; len 1
|
||||
mapHeight = $13 ; len 1
|
||||
pRayData = $14 ; len 2
|
||||
txNum = $16 ; len 1
|
||||
txColumn = $17 ; len 1
|
||||
pLine = $18 ; len 2
|
||||
rayDirX = $1A ; len 1
|
||||
rayDirY = $1B ; len 1
|
||||
stepX = $1C ; len 1
|
||||
stepY = $1D ; len 1
|
||||
mapX = $1E ; len 1
|
||||
mapY = $1F ; len 1
|
||||
sideDistX = $50 ; len 1
|
||||
sideDistY = $51 ; len 1
|
||||
deltaDistX = $52 ; len 1
|
||||
deltaDistY = $53 ; len 1
|
||||
dist = $54 ; len 2
|
||||
diff = $56 ; len 2
|
||||
pMap = $58 ; len 2
|
||||
lineCt = $5A ; len 1
|
||||
depth = $5B ; len 1
|
||||
minX = $5C ; len 1
|
||||
maxX = $5D ; len 1
|
||||
minY = $5E ; len 1
|
||||
maxY = $5F ; len 1
|
||||
screenCol = $60 ; len 1
|
||||
playerDir = $61 ; len 1
|
||||
playerX = $62 ; len 2 (hi=integer, lo=fraction)
|
||||
playerY = $64 ; len 2 (hi=integer, lo=fraction)
|
||||
tmp = $4 ; len 2
|
||||
pTmp = $6 ; len 2
|
||||
pDst = $8 ; len 2
|
||||
pTex = $A ; len 2
|
||||
pixNum = $C ; len 1
|
||||
byteNum = $D ; len 1
|
||||
mapWidth = $12 ; len 1
|
||||
mapHeight = $13 ; len 1
|
||||
pRayData = $14 ; len 2
|
||||
txNum = $16 ; len 1
|
||||
txColumn = $17 ; len 1
|
||||
pLine = $18 ; len 2
|
||||
rayDirX = $1A ; len 1
|
||||
rayDirY = $1B ; len 1
|
||||
stepX = $1C ; len 1
|
||||
stepY = $1D ; len 1
|
||||
mapX = $1E ; len 1
|
||||
mapY = $1F ; len 1
|
||||
sideDistX = $50 ; len 1
|
||||
sideDistY = $51 ; len 1
|
||||
deltaDistX = $52 ; len 1
|
||||
deltaDistY = $53 ; len 1
|
||||
dist = $54 ; len 2
|
||||
diff = $56 ; len 2
|
||||
pMap = $58 ; len 2
|
||||
lineCt = $5A ; len 1
|
||||
depth = $5B ; len 1
|
||||
minX = $5C ; len 1
|
||||
maxX = $5D ; len 1
|
||||
minY = $5E ; len 1
|
||||
maxY = $5F ; len 1
|
||||
screenCol = $60 ; len 1
|
||||
playerDir = $61 ; len 1
|
||||
playerX = $62 ; len 2 (hi=integer, lo=fraction)
|
||||
playerY = $64 ; len 2 (hi=integer, lo=fraction)
|
||||
|
||||
;---------------------------------
|
||||
; The following are in aux mem...
|
||||
expandVec = $800
|
||||
expandVec = $800
|
||||
; back to main mem
|
||||
;---------------------------------
|
||||
|
||||
; Main-mem tables and buffers
|
||||
tableStart = $A700
|
||||
decodeTo01 = $A700
|
||||
decodeTo01b = $A800
|
||||
decodeTo23 = $A900
|
||||
decodeTo23b = $AA00
|
||||
decodeTo45 = $AB00
|
||||
decodeTo56 = $AC00
|
||||
decodeTo57 = $AD00
|
||||
clrBlitRollE = $AE00 ; size 3*(128/2) = $C0, plus 2 for tya and rts
|
||||
clrBlitRollO = $AEC2 ; size 3*(128/2) = $C0, plus 2 for tya and rts
|
||||
texAddrLo = $AF84
|
||||
texAddrHi = texAddrLo + MAX_TEXTURES
|
||||
blitRoll = $B000 ; Unrolled blitting code. Size 29*128 = $E80, plus 1 for rts
|
||||
tableEnd = $BE81
|
||||
memMap = $BF58 ; ProDOS memory map
|
||||
tableStart = $A700
|
||||
decodeTo01 = $A700
|
||||
decodeTo01b = $A800
|
||||
decodeTo23 = $A900
|
||||
decodeTo23b = $AA00
|
||||
decodeTo45 = $AB00
|
||||
decodeTo56 = $AC00
|
||||
decodeTo57 = $AD00
|
||||
clrBlitRollE = $AE00 ; size 3*(128/2) = $C0, plus 2 for tya and rts
|
||||
clrBlitRollO = $AEC2 ; size 3*(128/2) = $C0, plus 2 for tya and rts
|
||||
texAddrLo = $AF84
|
||||
texAddrHi = texAddrLo + MAX_TEXTURES
|
||||
blitRoll = $B000 ; Unrolled blitting code. Size 29*128 = $E80, plus 1 for rts
|
||||
tableEnd = $BE81
|
||||
memMap = $BF58 ; ProDOS memory map
|
||||
|
||||
; mipmap level offsets
|
||||
MIP_OFFSET_0 = 0
|
||||
MIP_OFFSET_1 = $400 ; 32*32
|
||||
MIP_OFFSET_2 = $500 ; 32*32 + 16*16
|
||||
MIP_OFFSET_3 = $540 ; 32*32 + 16*16 + 8*8
|
||||
MIP_OFFSET_4 = $550 ; 32*32 + 16*16 + 8*8 + 4*4
|
||||
MIP_OFFSET_5 = $554 ; 32*32 + 16*16 + 8*8 + 4*4 + 2*2
|
||||
MIP_OFFSET_0 = 0
|
||||
MIP_OFFSET_1 = $400 ; 32*32
|
||||
MIP_OFFSET_2 = $500 ; 32*32 + 16*16
|
||||
MIP_OFFSET_3 = $540 ; 32*32 + 16*16 + 8*8
|
||||
MIP_OFFSET_4 = $550 ; 32*32 + 16*16 + 8*8 + 4*4
|
||||
MIP_OFFSET_5 = $554 ; 32*32 + 16*16 + 8*8 + 4*4 + 2*2
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user