📄 3dtesting.lis
字号:
00D6 00930000 sts _rotx,R16
00DA 30930300 sts _rotx+2+1,R19
00DE 20930200 sts _rotx+2,R18
00E2 .dbline 49
00E2 ; roty=roty+0.03; // and on its y axis
00E2 40900600 lds R4,_roty+2
00E6 50900700 lds R5,_roty+2+1
00EA 20900400 lds R2,_roty
00EE 30900500 lds R3,_roty+1
00F2 00E0 ldi R16,<L4
00F4 10E0 ldi R17,>L4
00F6 0E940000 xcall elpm32
00FA 3A93 st -y,R19
00FC 2A93 st -y,R18
00FE 1A93 st -y,R17
0100 0A93 st -y,R16
0102 8101 movw R16,R2
0104 9201 movw R18,R4
0106 0E940000 xcall fpadd2
010A 10930500 sts _roty+1,R17
010E 00930400 sts _roty,R16
0112 30930700 sts _roty+2+1,R19
0116 20930600 sts _roty+2,R18
011A .dbline 50
011A ; rotz=rotz+0.01; // dont bother with z or it gets confusing
011A 40900A00 lds R4,_rotz+2
011E 50900B00 lds R5,_rotz+2+1
0122 20900800 lds R2,_rotz
0126 30900900 lds R3,_rotz+1
012A 00E0 ldi R16,<L5
012C 10E0 ldi R17,>L5
012E 0E940000 xcall elpm32
0132 3A93 st -y,R19
0134 2A93 st -y,R18
0136 1A93 st -y,R17
0138 0A93 st -y,R16
013A 8101 movw R16,R2
013C 9201 movw R18,R4
013E 0E940000 xcall fpadd2
0142 10930900 sts _rotz+1,R17
0146 00930800 sts _rotz,R16
014A 30930B00 sts _rotz+2+1,R19
014E 20930A00 sts _rotz+2,R18
0152 .dbline 52
0152 ;
0152 ; sinax=sin(rotx); // precalculate the sin and cos values
0152 20910200 lds R18,_rotx+2
0156 30910300 lds R19,_rotx+2+1
015A 00910000 lds R16,_rotx
015E 10910100 lds R17,_rotx+1
0162 0E940000 xcall _sinf
0166 FE01 movw R30,R28
0168 E658 subi R30,134 ; addi 122
016A FF4F sbci R31,255
016C 0083 std z+0,R16
016E 1183 std z+1,R17
0170 2283 std z+2,R18
0172 3383 std z+3,R19
0174 .dbline 53
0174 ; cosax=cos(rotx); // for the rotation as this saves a
0174 20910200 lds R18,_rotx+2
0178 30910300 lds R19,_rotx+2+1
017C 00910000 lds R16,_rotx
0180 10910100 lds R17,_rotx+1
0184 0E940000 xcall _cosf
0188 FE01 movw R30,R28
018A E258 subi R30,130 ; addi 126
018C FF4F sbci R31,255
018E 0083 std z+0,R16
0190 1183 std z+1,R17
0192 2283 std z+2,R18
0194 3383 std z+3,R19
0196 .dbline 55
0196 ;
0196 ; sinay=sin(roty); // little time when running as we
0196 20910600 lds R18,_roty+2
019A 30910700 lds R19,_roty+2+1
019E 00910400 lds R16,_roty
01A2 10910500 lds R17,_roty+1
01A6 0E940000 xcall _sinf
01AA FE01 movw R30,R28
01AC EE57 subi R30,126 ; addi 130
01AE FF4F sbci R31,255
01B0 0083 std z+0,R16
01B2 1183 std z+1,R17
01B4 2283 std z+2,R18
01B6 3383 std z+3,R19
01B8 .dbline 56
01B8 ; cosay=cos(roty); // call sin and cos less often
01B8 20910600 lds R18,_roty+2
01BC 30910700 lds R19,_roty+2+1
01C0 00910400 lds R16,_roty
01C4 10910500 lds R17,_roty+1
01C8 0E940000 xcall _cosf
01CC FE01 movw R30,R28
01CE EA57 subi R30,122 ; addi 134
01D0 FF4F sbci R31,255
01D2 0083 std z+0,R16
01D4 1183 std z+1,R17
01D6 2283 std z+2,R18
01D8 3383 std z+3,R19
01DA .dbline 58
01DA ;
01DA ; sinaz=sin(rotz); // they are slow routines
01DA 20910A00 lds R18,_rotz+2
01DE 30910B00 lds R19,_rotz+2+1
01E2 00910800 lds R16,_rotz
01E6 10910900 lds R17,_rotz+1
01EA 0E940000 xcall _sinf
01EE FE01 movw R30,R28
01F0 E657 subi R30,118 ; addi 138
01F2 FF4F sbci R31,255
01F4 0083 std z+0,R16
01F6 1183 std z+1,R17
01F8 2283 std z+2,R18
01FA 3383 std z+3,R19
01FC .dbline 59
01FC ; cosaz=cos(rotz); // and we dont want slow!
01FC 20910A00 lds R18,_rotz+2
0200 30910B00 lds R19,_rotz+2+1
0204 00910800 lds R16,_rotz
0208 10910900 lds R17,_rotz+1
020C 0E940000 xcall _cosf
0210 FE01 movw R30,R28
0212 E257 subi R30,114 ; addi 142
0214 FF4F sbci R31,255
0216 0083 std z+0,R16
0218 1183 std z+1,R17
021A 2283 std z+2,R18
021C 3383 std z+3,R19
021E .dbline 61
021E ;
021E ; for (i=0; i<23; i++) // translate 3d vertex position to 2d screen position
021E 0024 clr R0
0220 1124 clr R1
0222 FE01 movw R30,R28
0224 EE56 subi R30,110 ; addi 146
0226 FF4F sbci R31,255
0228 1182 std z+1,R1
022A 0082 std z+0,R0
022C L6:
022C .dbline 62
022C ; {
022C .dbline 63
022C ; x=aa[i]; // get x for vertex i
022C 80E0 ldi R24,<_aa
022E 90E0 ldi R25,>_aa
0230 DE01 movw R26,R28
0232 AE56 subi R26,110 ; addi 146
0234 BF4F sbci R27,255
0236 ED91 ld R30,x+
0238 FC91 ld R31,x
023A EE0F lsl R30
023C FF1F rol R31
023E E80F add R30,R24
0240 F91F adc R31,R25
0242 0791 elpm R16,Z+
0244 1691 elpm R17,Z
0246 0E940000 xcall int2fp
024A 0A87 std y+10,R16
024C 1B87 std y+11,R17
024E 2C87 std y+12,R18
0250 3D87 std y+13,R19
0252 .dbline 64
0252 ; y=bb[i]; // get y for vertex i
0252 80E0 ldi R24,<_bb
0254 90E0 ldi R25,>_bb
0256 DE01 movw R26,R28
0258 AE56 subi R26,110 ; addi 146
025A BF4F sbci R27,255
025C ED91 ld R30,x+
025E FC91 ld R31,x
0260 EE0F lsl R30
0262 FF1F rol R31
0264 E80F add R30,R24
0266 F91F adc R31,R25
0268 0791 elpm R16,Z+
026A 1691 elpm R17,Z
026C 0E940000 xcall int2fp
0270 0E87 std y+14,R16
0272 1F87 std y+15,R17
0274 288B std y+16,R18
0276 398B std y+17,R19
0278 .dbline 65
0278 ; z=cc[i]; // get z for vertex i
0278 80E0 ldi R24,<_cc
027A 90E0 ldi R25,>_cc
027C DE01 movw R26,R28
027E AE56 subi R26,110 ; addi 146
0280 BF4F sbci R27,255
0282 ED91 ld R30,x+
0284 FC91 ld R31,x
0286 EE0F lsl R30
0288 FF1F rol R31
028A E80F add R30,R24
028C F91F adc R31,R25
028E 0791 elpm R16,Z+
0290 1691 elpm R17,Z
0292 0E940000 xcall int2fp
0296 0E83 std y+6,R16
0298 1F83 std y+7,R17
029A 2887 std y+8,R18
029C 3987 std y+9,R19
029E .dbline 67
029E ;
029E ; yt = y * cosax - z * sinax; // rotate around the x axis
029E 0E85 ldd R16,y+14
02A0 1F85 ldd R17,y+15
02A2 2889 ldd R18,y+16
02A4 3989 ldd R19,y+17
02A6 CE01 movw R24,R28
02A8 8258 subi R24,130 ; offset = 126
02AA 9F4F sbci R25,255
02AC 9A93 st -y,R25
02AE 8A93 st -y,R24
02B0 0E940000 xcall fpmule1
02B4 1801 movw R2,R16
02B6 2901 movw R4,R18
02B8 0E81 ldd R16,y+6
02BA 1F81 ldd R17,y+7
02BC 2885 ldd R18,y+8
02BE 3985 ldd R19,y+9
02C0 CE01 movw R24,R28
02C2 8658 subi R24,134 ; offset = 122
02C4 9F4F sbci R25,255
02C6 9A93 st -y,R25
02C8 8A93 st -y,R24
02CA 0E940000 xcall fpmule1x
02CE 8101 movw R16,R2
02D0 9201 movw R18,R4
02D2 0E940000 xcall fpsub2
02D6 DE01 movw R26,R28
02D8 AE58 subi R26,142 ; addi 114
02DA BF4F sbci R27,255
02DC 0D93 st x+,R16
02DE 1D93 st x+,R17
02E0 2D93 st x+,R18
02E2 3C93 st x,R19
02E4 .dbline 68
02E4 ; zt = y * sinax + z * cosax; // using the Y and Z for the rotation
02E4 0E85 ldd R16,y+14
02E6 1F85 ldd R17,y+15
02E8 2889 ldd R18,y+16
02EA 3989 ldd R19,y+17
02EC CE01 movw R24,R28
02EE 8658 subi R24,134 ; offset = 122
02F0 9F4F sbci R25,255
02F2 9A93 st -y,R25
02F4 8A93 st -y,R24
02F6 0E940000 xcall fpmule1
02FA 1801 movw R2,R16
02FC 2901 movw R4,R18
02FE 0E81 ldd R16,y+6
0300 1F81 ldd R17,y+7
0302 2885 ldd R18,y+8
0304 3985 ldd R19,y+9
0306 CE01 movw R24,R28
0308 8258 subi R24,130 ; offset = 126
030A 9F4F sbci R25,255
030C 9A93 st -y,R25
030E 8A93 st -y,R24
0310 0E940000 xcall fpmule1x
0314 8101 movw R16,R2
0316 9201 movw R18,R4
0318 0E940000 xcall fpadd2
031C DE01 movw R26,R28
031E AA58 subi R26,138 ; addi 118
0320 BF4F sbci R27,255
0322 0D93 st x+,R16
0324 1D93 st x+,R17
0326 2D93 st x+,R18
0328 3C93 st x,R19
032A .dbline 69
032A ; y = yt;
032A DE01 movw R26,R28
032C AE58 subi R26,142 ; addi 114
032E BF4F sbci R27,255
0330 2D90 ld R2,x+
0332 3D90 ld R3,x+
0334 4D90 ld R4,x+
0336 5C90 ld R5,x
0338 2E86 std y+14,R2
033A 3F86 std y+15,R3
033C 488A std y+16,R4
033E 598A std y+17,R5
0340 .dbline 70
0340 ; z = zt;
0340 DE01 movw R26,R28
0342 AA58 subi R26,138 ; addi 118
0344 BF4F sbci R27,255
0346 2D90 ld R2,x+
0348 3D90 ld R3,x+
034A 4D90 ld R4,x+
034C 5C90 ld R5,x
034E 2E82 std y+6,R2
0350 3F82 std y+7,R3
0352 4886 std y+8,R4
0354 5986 std y+9,R5
0356 .dbline 72
0356 ;
0356 ; xt = x * cosay - z * sinay; // rotate around the Y axis
0356 0A85 ldd R16,y+10
0358 1B85 ldd R17,y+11
035A 2C85 ldd R18,y+12
035C 3D85 ldd R19,y+13
035E CE01 movw R24,R28
0360 8A57 subi R24,122 ; offset = 134
0362 9F4F sbci R25,255
0364 9A93 st -y,R25
0366 8A93 st -y,R24
0368 0E940000 xcall fpmule1
036C 1801 movw R2,R16
036E 2901 movw R4,R18
0370 0E81 ldd R16,y+6
0372 1F81 ldd R17,y+7
0374 2885 ldd R18,y+8
0376 3985 ldd R19,y+9
0378 CE01 movw R24,R28
037A 8E57 subi R24,126 ; offset = 130
037C 9F4F sbci R25,255
037E 9A93 st -y,R25
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -