mirror of
https://github.com/irmen/prog8.git
synced 2024-11-23 07:32:10 +00:00
cube3d non float
This commit is contained in:
parent
4f213191dc
commit
cca94d41bc
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
const uword width = 40
|
const uword width = 40
|
||||||
const uword height = 25
|
const uword height = 25
|
||||||
|
const float height_f = height
|
||||||
|
|
||||||
; vertices
|
; vertices
|
||||||
byte[8] xcoor = [ -50, -50, -50, -50, 50, 50, 50, 50 ]
|
byte[8] xcoor = [ -50, -50, -50, -50, 50, 50, 50, 50 ]
|
||||||
@ -12,9 +13,9 @@
|
|||||||
byte[8] zcoor = [ -50, 50, -50, 50, -50, 50, -50, 50 ]
|
byte[8] zcoor = [ -50, 50, -50, 50, -50, 50, -50, 50 ]
|
||||||
|
|
||||||
; storage for rotated coordinates
|
; storage for rotated coordinates
|
||||||
float[len(xcoor)] rotatedx=0.0
|
word[len(xcoor)] rotatedx=0
|
||||||
float[len(ycoor)] rotatedy=0.0
|
word[len(ycoor)] rotatedy=0
|
||||||
float[len(zcoor)] rotatedz=-1.0
|
word[len(zcoor)] rotatedz=-1
|
||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
uword anglex
|
uword anglex
|
||||||
@ -34,63 +35,108 @@
|
|||||||
; rotate around origin (0,0,0)
|
; rotate around origin (0,0,0)
|
||||||
|
|
||||||
; set up the 3d rotation matrix values
|
; set up the 3d rotation matrix values
|
||||||
float cosa = cos8(ax) as float / 128.0
|
word wcosa = cos8(ax) as word
|
||||||
float sina = sin8(ax) as float / 128.0
|
word wsina = sin8(ax) as word
|
||||||
float cosb = cos8(ay) as float / 128.0
|
word wcosb = cos8(ay) as word
|
||||||
float sinb = sin8(ay) as float / 128.0
|
word wsinb = sin8(ay) as word
|
||||||
float cosc = cos8(az) as float / 128.0
|
word wcosc = cos8(az) as word
|
||||||
float sinc = sin8(az) as float / 128.0
|
word wsinc = sin8(az) as word
|
||||||
|
|
||||||
float cosa_sinb = cosa*sinb
|
word wcosa_sinb = wcosa*wsinb
|
||||||
float sina_sinb = sina*sinb
|
lsr(wcosa_sinb)
|
||||||
float Axx = cosa*cosb
|
lsr(wcosa_sinb)
|
||||||
float Axy = cosa_sinb*sinc - sina*cosc
|
lsr(wcosa_sinb)
|
||||||
float Axz = cosa_sinb*cosc + sina*sinc
|
lsr(wcosa_sinb)
|
||||||
float Ayx = sina*cosb
|
lsr(wcosa_sinb)
|
||||||
float Ayy = sina_sinb*sinc + cosa*cosc
|
lsr(wcosa_sinb)
|
||||||
float Ayz = sina_sinb*cosc - cosa*sinc
|
lsr(wcosa_sinb) ; / 128
|
||||||
float Azx = -sinb
|
word wsina_sinb = wsina*wsinb
|
||||||
float Azy = cosb*sinc
|
lsr(wsina_sinb)
|
||||||
float Azz = cosb*cosc
|
lsr(wsina_sinb)
|
||||||
|
lsr(wsina_sinb)
|
||||||
|
lsr(wsina_sinb)
|
||||||
|
lsr(wsina_sinb)
|
||||||
|
lsr(wsina_sinb)
|
||||||
|
lsr(wsina_sinb) ; / 128
|
||||||
|
|
||||||
|
float cosa_sinb = wcosa_sinb as float / 128.0
|
||||||
|
float sina_sinb = wsina_sinb as float / 128.0
|
||||||
|
float Axx = wcosa*wcosb as float / 16384.0
|
||||||
|
float Axy = cosa_sinb*(wsinc as float / 128.0) - (wsina*wcosc as float / 16384.0)
|
||||||
|
float Axz = cosa_sinb*(wcosc as float / 128.0) + (wsina*wsinc as float / 16384.0)
|
||||||
|
float Ayx = wsina*wcosb as float / 16384.0
|
||||||
|
float Ayy = sina_sinb*(wsinc as float / 128.0) + (wcosa*wcosc as float / 16384.0)
|
||||||
|
float Ayz = sina_sinb*(wcosc as float / 128.0) - (wcosa*wsinc as float / 16384.0)
|
||||||
|
float Azx = -wsinb as float / 128.0
|
||||||
|
float Azy = wcosb*wsinc as float / 16384.0
|
||||||
|
float Azz = wcosb*wcosc as float / 16384.0
|
||||||
|
|
||||||
|
word wAxx = Axx * 128.0 as word
|
||||||
|
word wAxy = Axy * 128.0 as word
|
||||||
|
word wAxz = Axz * 128.0 as word
|
||||||
|
word wAyx = Ayx * 128.0 as word
|
||||||
|
word wAyy = Ayy * 128.0 as word
|
||||||
|
word wAyz = Ayz * 128.0 as word
|
||||||
|
word wAzx = Azx * 128.0 as word
|
||||||
|
word wAzy = Azy * 128.0 as word
|
||||||
|
word wAzz = Azz * 128.0 as word
|
||||||
|
|
||||||
for ubyte i in 0 to len(xcoor)-1 {
|
for ubyte i in 0 to len(xcoor)-1 {
|
||||||
float xc = xcoor[i] as float
|
word xc = xcoor[i] as word
|
||||||
float yc = ycoor[i] as float
|
word yc = ycoor[i] as word
|
||||||
float zc = zcoor[i] as float
|
word zc = zcoor[i] as word
|
||||||
rotatedx[i] = Axx*xc + Axy*yc + Axz*zc
|
word zz = wAxx*xc + wAxy*yc + wAxz*zc
|
||||||
rotatedy[i] = Ayx*xc + Ayy*yc + Ayz*zc
|
lsr(zz)
|
||||||
rotatedz[i] = Azx*xc + Azy*yc + Azz*zc
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz) ; /128
|
||||||
|
rotatedx[i] = zz
|
||||||
|
zz=wAyx*xc + wAyy*yc + wAyz*zc
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz) ; /128
|
||||||
|
rotatedy[i] = zz
|
||||||
|
zz = wAzx*xc + wAzy*yc + wAzz*zc
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz) ; /128
|
||||||
|
rotatedz[i] = zz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub draw_edges() {
|
sub draw_edges() {
|
||||||
|
|
||||||
sub toscreenx(float x, float z) -> byte {
|
|
||||||
return x/(250.0+z) * (height as float) as byte + width // 2
|
|
||||||
}
|
|
||||||
|
|
||||||
sub toscreeny(float y, float z) -> byte {
|
|
||||||
return y/(250.0+z) * (height as float) as byte + height // 2
|
|
||||||
}
|
|
||||||
|
|
||||||
; plot the points of the 3d cube
|
; plot the points of the 3d cube
|
||||||
; first the points on the back, then the points on the front (painter algorithm)
|
; first the points on the back, then the points on the front (painter algorithm)
|
||||||
|
|
||||||
for ubyte i in 0 to len(xcoor)-1 {
|
for ubyte i in 0 to len(xcoor)-1 {
|
||||||
float rz = rotatedz[i]
|
word rz = rotatedz[i]
|
||||||
if rz >= 0.1 {
|
if rz >= 10 {
|
||||||
ubyte sx = toscreenx(rotatedx[i], rz) as ubyte
|
float persp = (rz as float + 250.0)/height_f
|
||||||
ubyte sy = toscreeny(rotatedy[i], rz) as ubyte
|
byte sx = rotatedx[i] as float / persp as byte + width//2
|
||||||
c64scr.setchrclr(sx, sy, 46, i+2)
|
byte sy = rotatedy[i] as float / persp as byte + height//2
|
||||||
|
c64scr.setchrclr(sx as ubyte, sy as ubyte, 46, i+2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ubyte i in 0 to len(xcoor)-1 {
|
for ubyte i in 0 to len(xcoor)-1 {
|
||||||
float rz = rotatedz[i]
|
word rz = rotatedz[i]
|
||||||
if rz < 0.1 {
|
if rz < 10 {
|
||||||
ubyte sx = toscreenx(rotatedx[i], rz) as ubyte
|
float persp = (rz as float + 250.0)/height_f
|
||||||
ubyte sy = toscreeny(rotatedy[i], rz) as ubyte
|
byte sx = rotatedx[i] as float / persp as byte + width//2
|
||||||
c64scr.setchrclr(sx, sy, 81, i+2)
|
byte sy = rotatedy[i] as float / persp as byte + height//2
|
||||||
|
c64scr.setchrclr(sx as ubyte, sy as ubyte, 81, i+2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,148 @@
|
|||||||
%import c64utils
|
%import c64utils
|
||||||
|
%import c64flt
|
||||||
|
|
||||||
~ main {
|
~ main {
|
||||||
|
|
||||||
word[1] rotatedx
|
const uword width = 40
|
||||||
|
const uword height = 25
|
||||||
|
|
||||||
|
; vertices
|
||||||
|
byte[8] xcoor = [ -50, -50, -50, -50, 50, 50, 50, 50 ]
|
||||||
|
byte[8] ycoor = [ -50, -50, 50, 50, -50, -50, 50, 50 ]
|
||||||
|
byte[8] zcoor = [ -50, 50, -50, 50, -50, 50, -50, 50 ]
|
||||||
|
|
||||||
|
; storage for rotated coordinates
|
||||||
|
word[len(xcoor)] rotatedx=0
|
||||||
|
word[len(ycoor)] rotatedy=0
|
||||||
|
word[len(zcoor)] rotatedz=-1
|
||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
word xc = 2
|
uword anglex
|
||||||
rpt:
|
uword angley
|
||||||
word w = 2*xc
|
uword anglez
|
||||||
rotatedx[0] = w ; @ok!
|
while(true) {
|
||||||
rotatedx[0] = 2*xc ; @todo wrong code generated? crash!
|
rotate_vertices(msb(anglex), msb(angley), msb(anglez))
|
||||||
c64.CHROUT('.')
|
c64.CLEARSCR()
|
||||||
goto rpt
|
draw_edges()
|
||||||
|
anglex+=1000
|
||||||
|
angley+=333
|
||||||
|
anglez+=807
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub rotate_vertices(ubyte ax, ubyte ay, ubyte az) {
|
||||||
|
; rotate around origin (0,0,0)
|
||||||
|
|
||||||
|
; set up the 3d rotation matrix values
|
||||||
|
word wcosa = cos8(ax) as word
|
||||||
|
word wsina = sin8(ax) as word
|
||||||
|
word wcosb = cos8(ay) as word
|
||||||
|
word wsinb = sin8(ay) as word
|
||||||
|
word wcosc = cos8(az) as word
|
||||||
|
word wsinc = sin8(az) as word
|
||||||
|
|
||||||
|
word wcosa_sinb = wcosa*wsinb
|
||||||
|
lsr(wcosa_sinb)
|
||||||
|
lsr(wcosa_sinb)
|
||||||
|
lsr(wcosa_sinb)
|
||||||
|
lsr(wcosa_sinb)
|
||||||
|
lsr(wcosa_sinb)
|
||||||
|
lsr(wcosa_sinb)
|
||||||
|
lsr(wcosa_sinb) ; / 128
|
||||||
|
word wsina_sinb = wsina*wsinb
|
||||||
|
lsr(wsina_sinb)
|
||||||
|
lsr(wsina_sinb)
|
||||||
|
lsr(wsina_sinb)
|
||||||
|
lsr(wsina_sinb)
|
||||||
|
lsr(wsina_sinb)
|
||||||
|
lsr(wsina_sinb)
|
||||||
|
lsr(wsina_sinb) ; / 128
|
||||||
|
|
||||||
|
float cosa_sinb = wcosa_sinb as float / 128.0
|
||||||
|
float sina_sinb = wsina_sinb as float / 128.0
|
||||||
|
float Axx = wcosa*wcosb as float / 16384.0
|
||||||
|
float Axy = cosa_sinb*(wsinc as float / 128.0) - (wsina*wcosc as float / 16384.0)
|
||||||
|
float Axz = cosa_sinb*(wcosc as float / 128.0) + (wsina*wsinc as float / 16384.0)
|
||||||
|
float Ayx = wsina*wcosb as float / 16384.0
|
||||||
|
float Ayy = sina_sinb*(wsinc as float / 128.0) + (wcosa*wcosc as float / 16384.0)
|
||||||
|
float Ayz = sina_sinb*(wcosc as float / 128.0) - (wcosa*wsinc as float / 16384.0)
|
||||||
|
float Azx = -wsinb as float / 128.0
|
||||||
|
float Azy = wcosb*wsinc as float / 16384.0
|
||||||
|
float Azz = wcosb*wcosc as float / 16384.0
|
||||||
|
|
||||||
|
word wAxx = Axx * 128.0 as word
|
||||||
|
word wAxy = Axy * 128.0 as word
|
||||||
|
word wAxz = Axz * 128.0 as word
|
||||||
|
word wAyx = Ayx * 128.0 as word
|
||||||
|
word wAyy = Ayy * 128.0 as word
|
||||||
|
word wAyz = Ayz * 128.0 as word
|
||||||
|
word wAzx = Azx * 128.0 as word
|
||||||
|
word wAzy = Azy * 128.0 as word
|
||||||
|
word wAzz = Azz * 128.0 as word
|
||||||
|
|
||||||
|
for ubyte i in 0 to len(xcoor)-1 {
|
||||||
|
word xc = xcoor[i] as word
|
||||||
|
word yc = ycoor[i] as word
|
||||||
|
word zc = zcoor[i] as word
|
||||||
|
word zz = wAxx*xc + wAxy*yc + wAxz*zc
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz) ; /128
|
||||||
|
rotatedx[i] = zz
|
||||||
|
zz=wAyx*xc + wAyy*yc + wAyz*zc
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz) ; /128
|
||||||
|
rotatedy[i] = zz
|
||||||
|
zz = wAzx*xc + wAzy*yc + wAzz*zc
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz)
|
||||||
|
lsr(zz) ; /128
|
||||||
|
rotatedz[i] = zz
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub draw_edges() {
|
||||||
|
|
||||||
|
sub toscreenx(float x, float z) -> byte {
|
||||||
|
return x/(250.0+z) * (height as float) as byte + width // 2
|
||||||
|
}
|
||||||
|
|
||||||
|
sub toscreeny(float y, float z) -> byte {
|
||||||
|
return y/(250.0+z) * (height as float) as byte + height // 2
|
||||||
|
}
|
||||||
|
|
||||||
|
; plot the points of the 3d cube
|
||||||
|
; first the points on the back, then the points on the front (painter algorithm)
|
||||||
|
|
||||||
|
for ubyte i in 0 to len(xcoor)-1 {
|
||||||
|
word rz = rotatedz[i]
|
||||||
|
if rz >= 10 {
|
||||||
|
ubyte sx = toscreenx(rotatedx[i] as float, rz as float) as ubyte ; @todo crash when not using 'as float' for the param!
|
||||||
|
ubyte sy = toscreeny(rotatedy[i] as float, rz as float) as ubyte ; @todo crash when not using 'as float' for the param!
|
||||||
|
c64scr.setchrclr(sx, sy, 46, i+2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ubyte i in 0 to len(xcoor)-1 {
|
||||||
|
word rz = rotatedz[i]
|
||||||
|
if rz < 10 {
|
||||||
|
ubyte sx = toscreenx(rotatedx[i] as float, rz as float) as ubyte ; @todo crash when not using 'as float' for the param!
|
||||||
|
ubyte sy = toscreeny(rotatedy[i] as float, rz as float) as ubyte ; @todo crash when not using 'as float' for the param!
|
||||||
|
c64scr.setchrclr(sx, sy, 81, i+2)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2309,7 +2309,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_B1}
|
sta ${C64Zeropage.SCRATCH_B1}
|
||||||
lda #<${segment[2].callLabel}
|
lda #<${segment[2].callLabel}
|
||||||
ldy #>${segment[2].callLabel}
|
ldy #>${segment[2].callLabel}
|
||||||
jsr prog8_lib.ub2float
|
jsr c64flt.ub2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// floatvar = uwordvar
|
// floatvar = uwordvar
|
||||||
@ -2321,7 +2321,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_W1+1}
|
sta ${C64Zeropage.SCRATCH_W1+1}
|
||||||
lda #<${segment[2].callLabel}
|
lda #<${segment[2].callLabel}
|
||||||
ldy #>${segment[2].callLabel}
|
ldy #>${segment[2].callLabel}
|
||||||
jsr prog8_lib.uw2float
|
jsr c64flt.uw2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// floatvar = bytevar
|
// floatvar = bytevar
|
||||||
@ -2337,7 +2337,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_B1}
|
sta ${C64Zeropage.SCRATCH_B1}
|
||||||
lda #<${segment[2].callLabel}
|
lda #<${segment[2].callLabel}
|
||||||
ldy #>${segment[2].callLabel}
|
ldy #>${segment[2].callLabel}
|
||||||
jsr prog8_lib.b2float
|
jsr c64flt.b2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// floatvar = wordvar
|
// floatvar = wordvar
|
||||||
@ -2349,7 +2349,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_W1+1}
|
sta ${C64Zeropage.SCRATCH_W1+1}
|
||||||
lda #<${segment[2].callLabel}
|
lda #<${segment[2].callLabel}
|
||||||
ldy #>${segment[2].callLabel}
|
ldy #>${segment[2].callLabel}
|
||||||
jsr prog8_lib.w2float
|
jsr c64flt.w2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// floatvar = float value
|
// floatvar = float value
|
||||||
@ -2396,7 +2396,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_B1}
|
sta ${C64Zeropage.SCRATCH_B1}
|
||||||
lda #<${segment[2].callLabel}
|
lda #<${segment[2].callLabel}
|
||||||
ldy #>${segment[2].callLabel}
|
ldy #>${segment[2].callLabel}
|
||||||
jsr prog8_lib.b2float
|
jsr c64flt.b2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// floatvar = mem ubyte
|
// floatvar = mem ubyte
|
||||||
@ -2406,7 +2406,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_B1}
|
sta ${C64Zeropage.SCRATCH_B1}
|
||||||
lda #<${segment[2].callLabel}
|
lda #<${segment[2].callLabel}
|
||||||
ldy #>${segment[2].callLabel}
|
ldy #>${segment[2].callLabel}
|
||||||
jsr prog8_lib.ub2float
|
jsr c64flt.ub2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// floatvar = mem word
|
// floatvar = mem word
|
||||||
@ -2418,7 +2418,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_W1+1}
|
sta ${C64Zeropage.SCRATCH_W1+1}
|
||||||
lda #<${segment[2].callLabel}
|
lda #<${segment[2].callLabel}
|
||||||
ldy #>${segment[2].callLabel}
|
ldy #>${segment[2].callLabel}
|
||||||
jsr prog8_lib.w2float
|
jsr c64flt.w2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// floatvar = mem uword
|
// floatvar = mem uword
|
||||||
@ -2430,7 +2430,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_W1+1}
|
sta ${C64Zeropage.SCRATCH_W1+1}
|
||||||
lda #<${segment[2].callLabel}
|
lda #<${segment[2].callLabel}
|
||||||
ldy #>${segment[2].callLabel}
|
ldy #>${segment[2].callLabel}
|
||||||
jsr prog8_lib.uw2float
|
jsr c64flt.uw2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -2442,7 +2442,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_B1}
|
sta ${C64Zeropage.SCRATCH_B1}
|
||||||
lda #<${segment[3].callLabel}
|
lda #<${segment[3].callLabel}
|
||||||
ldy #>${segment[3].callLabel}
|
ldy #>${segment[3].callLabel}
|
||||||
jsr prog8_lib.b2float
|
jsr c64flt.b2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// floatvar = ubytearray[index]
|
// floatvar = ubytearray[index]
|
||||||
@ -2453,7 +2453,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_B1}
|
sta ${C64Zeropage.SCRATCH_B1}
|
||||||
lda #<${segment[3].callLabel}
|
lda #<${segment[3].callLabel}
|
||||||
ldy #>${segment[3].callLabel}
|
ldy #>${segment[3].callLabel}
|
||||||
jsr prog8_lib.ub2float
|
jsr c64flt.ub2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// floatvar = wordarray[index]
|
// floatvar = wordarray[index]
|
||||||
@ -2466,7 +2466,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sty ${C64Zeropage.SCRATCH_W1+1}
|
sty ${C64Zeropage.SCRATCH_W1+1}
|
||||||
lda #<${segment[3].callLabel}
|
lda #<${segment[3].callLabel}
|
||||||
ldy #>${segment[3].callLabel}
|
ldy #>${segment[3].callLabel}
|
||||||
jsr prog8_lib.w2float
|
jsr c64flt.w2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// floatvar = uwordarray[index]
|
// floatvar = uwordarray[index]
|
||||||
@ -2479,7 +2479,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sty ${C64Zeropage.SCRATCH_W1+1}
|
sty ${C64Zeropage.SCRATCH_W1+1}
|
||||||
lda #<${segment[3].callLabel}
|
lda #<${segment[3].callLabel}
|
||||||
ldy #>${segment[3].callLabel}
|
ldy #>${segment[3].callLabel}
|
||||||
jsr prog8_lib.uw2float
|
jsr c64flt.uw2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// floatvar = floatarray[index]
|
// floatvar = floatarray[index]
|
||||||
@ -2534,7 +2534,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_B1}
|
sta ${C64Zeropage.SCRATCH_B1}
|
||||||
lda #<${hexVal(segment[2])}
|
lda #<${hexVal(segment[2])}
|
||||||
ldy #>${hexVal(segment[2])}
|
ldy #>${hexVal(segment[2])}
|
||||||
jsr prog8_lib.ub2float
|
jsr c64flt.ub2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// memfloat = uwordvar
|
// memfloat = uwordvar
|
||||||
@ -2546,7 +2546,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_W1+1}
|
sta ${C64Zeropage.SCRATCH_W1+1}
|
||||||
lda #<${hexVal(segment[2])}
|
lda #<${hexVal(segment[2])}
|
||||||
ldy #>${hexVal(segment[2])}
|
ldy #>${hexVal(segment[2])}
|
||||||
jsr prog8_lib.uw2float
|
jsr c64flt.uw2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// memfloat = bytevar
|
// memfloat = bytevar
|
||||||
@ -2562,7 +2562,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_B1}
|
sta ${C64Zeropage.SCRATCH_B1}
|
||||||
lda #<${hexVal(segment[2])}
|
lda #<${hexVal(segment[2])}
|
||||||
ldy #>${hexVal(segment[2])}
|
ldy #>${hexVal(segment[2])}
|
||||||
jsr prog8_lib.b2float
|
jsr c64flt.b2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// memfloat = wordvar
|
// memfloat = wordvar
|
||||||
@ -2574,7 +2574,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_W1+1}
|
sta ${C64Zeropage.SCRATCH_W1+1}
|
||||||
lda #<${hexVal(segment[2])}
|
lda #<${hexVal(segment[2])}
|
||||||
ldy #>${hexVal(segment[2])}
|
ldy #>${hexVal(segment[2])}
|
||||||
jsr prog8_lib.w2float
|
jsr c64flt.w2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// memfloat = mem byte
|
// memfloat = mem byte
|
||||||
@ -2584,7 +2584,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_B1}
|
sta ${C64Zeropage.SCRATCH_B1}
|
||||||
lda #<${hexVal(segment[2])}
|
lda #<${hexVal(segment[2])}
|
||||||
ldy #>${hexVal(segment[2])}
|
ldy #>${hexVal(segment[2])}
|
||||||
jsr prog8_lib.b2float
|
jsr c64flt.b2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// memfloat = mem ubyte
|
// memfloat = mem ubyte
|
||||||
@ -2594,7 +2594,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_B1}
|
sta ${C64Zeropage.SCRATCH_B1}
|
||||||
lda #<${hexVal(segment[2])}
|
lda #<${hexVal(segment[2])}
|
||||||
ldy #>${hexVal(segment[2])}
|
ldy #>${hexVal(segment[2])}
|
||||||
jsr prog8_lib.ub2float
|
jsr c64flt.ub2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// memfloat = mem word
|
// memfloat = mem word
|
||||||
@ -2606,7 +2606,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_W1+1}
|
sta ${C64Zeropage.SCRATCH_W1+1}
|
||||||
lda #<${hexVal(segment[2])}
|
lda #<${hexVal(segment[2])}
|
||||||
ldy #>${hexVal(segment[2])}
|
ldy #>${hexVal(segment[2])}
|
||||||
jsr prog8_lib.w2float
|
jsr c64flt.w2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// memfloat = mem uword
|
// memfloat = mem uword
|
||||||
@ -2618,7 +2618,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_W1+1}
|
sta ${C64Zeropage.SCRATCH_W1+1}
|
||||||
lda #<${hexVal(segment[2])}
|
lda #<${hexVal(segment[2])}
|
||||||
ldy #>${hexVal(segment[2])}
|
ldy #>${hexVal(segment[2])}
|
||||||
jsr prog8_lib.uw2float
|
jsr c64flt.uw2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// memfloat = mem float
|
// memfloat = mem float
|
||||||
@ -2641,7 +2641,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_B1}
|
sta ${C64Zeropage.SCRATCH_B1}
|
||||||
lda #<${hexVal(segment[3])}
|
lda #<${hexVal(segment[3])}
|
||||||
ldy #>${hexVal(segment[3])}
|
ldy #>${hexVal(segment[3])}
|
||||||
jsr prog8_lib.b2float
|
jsr c64flt.b2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// memfloat = ubytearray[index]
|
// memfloat = ubytearray[index]
|
||||||
@ -2652,7 +2652,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sta ${C64Zeropage.SCRATCH_B1}
|
sta ${C64Zeropage.SCRATCH_B1}
|
||||||
lda #<${hexVal(segment[3])}
|
lda #<${hexVal(segment[3])}
|
||||||
ldy #>${hexVal(segment[3])}
|
ldy #>${hexVal(segment[3])}
|
||||||
jsr prog8_lib.ub2float
|
jsr c64flt.ub2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// memfloat = wordarray[index]
|
// memfloat = wordarray[index]
|
||||||
@ -2665,7 +2665,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sty ${C64Zeropage.SCRATCH_W1+1}
|
sty ${C64Zeropage.SCRATCH_W1+1}
|
||||||
lda #<${hexVal(segment[3])}
|
lda #<${hexVal(segment[3])}
|
||||||
ldy #>${hexVal(segment[3])}
|
ldy #>${hexVal(segment[3])}
|
||||||
jsr prog8_lib.w2float
|
jsr c64flt.w2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// memfloat = uwordarray[index]
|
// memfloat = uwordarray[index]
|
||||||
@ -2678,7 +2678,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
|
|||||||
sty ${C64Zeropage.SCRATCH_W1+1}
|
sty ${C64Zeropage.SCRATCH_W1+1}
|
||||||
lda #<${hexVal(segment[3])}
|
lda #<${hexVal(segment[3])}
|
||||||
ldy #>${hexVal(segment[3])}
|
ldy #>${hexVal(segment[3])}
|
||||||
jsr prog8_lib.uw2float
|
jsr c64flt.uw2float
|
||||||
"""
|
"""
|
||||||
},
|
},
|
||||||
// memfloat = floatarray[index]
|
// memfloat = floatarray[index]
|
||||||
|
Loading…
Reference in New Issue
Block a user