Changeset 3
- Timestamp:
- Nov 6, 2009, 2:10:40 PM (15 years ago)
- Location:
- branches
- Files:
-
- 9 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Z80/Compiler.lpi
r2 r3 13 13 <Icon Value="0"/> 14 14 <UseXPManifest Value="True"/> 15 <ActiveEditorIndexAtStart Value=" 3"/>15 <ActiveEditorIndexAtStart Value="4"/> 16 16 </General> 17 17 <VersionInfo> … … 33 33 </local> 34 34 </RunParams> 35 <Units Count=" 8">35 <Units Count="10"> 36 36 <Unit0> 37 37 <Filename Value="Compiler.lpr"/> 38 38 <IsPartOfProject Value="True"/> 39 39 <UnitName Value="Compiler"/> 40 <CursorPos X="1 " Y="27"/>41 <TopLine Value="1 5"/>40 <CursorPos X="15" Y="14"/> 41 <TopLine Value="1"/> 42 42 <EditorIndex Value="0"/> 43 <UsageCount Value="2 0"/>43 <UsageCount Value="26"/> 44 44 <Loaded Value="True"/> 45 45 </Unit0> … … 48 48 <IsPartOfProject Value="True"/> 49 49 <UnitName Value="UZ80Compiler"/> 50 <CursorPos X=" 4" Y="108"/>51 <TopLine Value=" 92"/>52 <EditorIndex Value=" 3"/>53 <UsageCount Value="2 0"/>50 <CursorPos X="6" Y="125"/> 51 <TopLine Value="123"/> 52 <EditorIndex Value="2"/> 53 <UsageCount Value="26"/> 54 54 <Loaded Value="True"/> 55 55 </Unit1> … … 60 60 <TopLine Value="48"/> 61 61 <EditorIndex Value="1"/> 62 <UsageCount Value="1 0"/>62 <UsageCount Value="14"/> 63 63 <Loaded Value="True"/> 64 64 </Unit2> … … 67 67 <CursorPos X="14" Y="173"/> 68 68 <TopLine Value="155"/> 69 <EditorIndex Value="2"/> 70 <UsageCount Value="10"/> 71 <Loaded Value="True"/> 69 <UsageCount Value="9"/> 72 70 </Unit3> 73 71 <Unit4> … … 75 73 <CursorPos X="3" Y="484"/> 76 74 <TopLine Value="476"/> 77 <UsageCount Value=" 10"/>75 <UsageCount Value="9"/> 78 76 </Unit4> 79 77 <Unit5> 80 78 <Filename Value="..\..\..\..\..\Programy\Lazarus_0.9.29\fpc\2.3.1\source\rtl\objpas\classes\classesh.inc"/> 81 <CursorPos X="15" Y="561"/> 82 <TopLine Value="546"/> 83 <UsageCount Value="10"/> 79 <CursorPos X="3" Y="497"/> 80 <TopLine Value="497"/> 81 <EditorIndex Value="5"/> 82 <UsageCount Value="14"/> 83 <Loaded Value="True"/> 84 84 </Unit5> 85 85 <Unit6> … … 87 87 <CursorPos X="3" Y="731"/> 88 88 <TopLine Value="787"/> 89 <UsageCount Value=" 10"/>89 <UsageCount Value="9"/> 90 90 </Unit6> 91 91 <Unit7> … … 93 93 <IsPartOfProject Value="True"/> 94 94 <UnitName Value="UDynamicNumber"/> 95 <CursorPos X="30" Y="135"/> 96 <TopLine Value="105"/> 95 <CursorPos X="1" Y="66"/> 96 <TopLine Value="51"/> 97 <EditorIndex Value="6"/> 98 <UsageCount Value="26"/> 99 <Loaded Value="True"/> 100 </Unit7> 101 <Unit8> 102 <Filename Value="..\..\..\..\..\Programy\Lazarus_0.9.29\fpc\2.3.1\source\rtl\objpas\sysutils\sysstrh.inc"/> 103 <CursorPos X="28" Y="33"/> 104 <TopLine Value="18"/> 105 <EditorIndex Value="3"/> 106 <UsageCount Value="13"/> 107 <Loaded Value="True"/> 108 </Unit8> 109 <Unit9> 110 <Filename Value="Example.asm"/> 111 <IsPartOfProject Value="True"/> 112 <CursorPos X="6" Y="1"/> 113 <TopLine Value="1"/> 97 114 <EditorIndex Value="4"/> 98 <UsageCount Value="20"/> 99 <Loaded Value="True"/> 100 </Unit7> 115 <UsageCount Value="25"/> 116 <Loaded Value="True"/> 117 <SyntaxHighlighter Value="None"/> 118 </Unit9> 101 119 </Units> 102 120 <JumpHistory Count="30" HistoryIndex="29"> 103 121 <Position1> 104 <Filename Value="U DynamicNumber.pas"/>105 <Caret Line=" 22" Column="50" TopLine="6"/>122 <Filename Value="UZ80Compiler.pas"/> 123 <Caret Line="133" Column="38" TopLine="115"/> 106 124 </Position1> 107 125 <Position2> 108 <Filename Value="U DynamicNumber.pas"/>109 <Caret Line=" 59" Column="11" TopLine="32"/>126 <Filename Value="UZ80Compiler.pas"/> 127 <Caret Line="127" Column="21" TopLine="115"/> 110 128 </Position2> 111 129 <Position3> 112 <Filename Value="U DynamicNumber.pas"/>113 <Caret Line=" 65" Column="1" TopLine="35"/>130 <Filename Value="UZ80Compiler.pas"/> 131 <Caret Line="130" Column="1" TopLine="115"/> 114 132 </Position3> 115 133 <Position4> 116 <Filename Value="U DynamicNumber.pas"/>117 <Caret Line="1 8" Column="15" TopLine="7"/>134 <Filename Value="UZ80Compiler.pas"/> 135 <Caret Line="131" Column="1" TopLine="116"/> 118 136 </Position4> 119 137 <Position5> 120 <Filename Value="U DynamicNumber.pas"/>121 <Caret Line=" 44" Column="42" TopLine="41"/>138 <Filename Value="UZ80Compiler.pas"/> 139 <Caret Line="132" Column="1" TopLine="117"/> 122 140 </Position5> 123 141 <Position6> 124 <Filename Value="U DynamicNumber.pas"/>125 <Caret Line=" 62" Column="33" TopLine="49"/>142 <Filename Value="UZ80Compiler.pas"/> 143 <Caret Line="133" Column="1" TopLine="118"/> 126 144 </Position6> 127 145 <Position7> 128 <Filename Value="U DynamicNumber.pas"/>129 <Caret Line=" 25" Column="25" TopLine="11"/>146 <Filename Value="UZ80Compiler.pas"/> 147 <Caret Line="135" Column="1" TopLine="120"/> 130 148 </Position7> 131 149 <Position8> 132 <Filename Value="U DynamicNumber.pas"/>133 <Caret Line=" 26" Column="41" TopLine="10"/>150 <Filename Value="UZ80Compiler.pas"/> 151 <Caret Line="136" Column="1" TopLine="121"/> 134 152 </Position8> 135 153 <Position9> 136 <Filename Value="U DynamicNumber.pas"/>137 <Caret Line=" 23" Column="64" TopLine="11"/>154 <Filename Value="UZ80Compiler.pas"/> 155 <Caret Line="126" Column="1" TopLine="111"/> 138 156 </Position9> 139 157 <Position10> 140 <Filename Value="U DynamicNumber.pas"/>141 <Caret Line=" 25" Column="24" TopLine="1"/>158 <Filename Value="UZ80Compiler.pas"/> 159 <Caret Line="127" Column="1" TopLine="112"/> 142 160 </Position10> 143 161 <Position11> 144 <Filename Value="U DynamicNumber.pas"/>145 <Caret Line=" 27" Column="18" TopLine="14"/>162 <Filename Value="UZ80Compiler.pas"/> 163 <Caret Line="128" Column="1" TopLine="113"/> 146 164 </Position11> 147 165 <Position12> 148 <Filename Value="U DynamicNumber.pas"/>149 <Caret Line=" 29" Column="32" TopLine="12"/>166 <Filename Value="UZ80Compiler.pas"/> 167 <Caret Line="139" Column="1" TopLine="124"/> 150 168 </Position12> 151 169 <Position13> 152 <Filename Value="U DynamicNumber.pas"/>153 <Caret Line=" 34" Column="55" TopLine="18"/>170 <Filename Value="UZ80Compiler.pas"/> 171 <Caret Line="57" Column="3" TopLine="37"/> 154 172 </Position13> 155 173 <Position14> 156 <Filename Value="U DynamicNumber.pas"/>157 <Caret Line=" 36" Column="19" TopLine="19"/>174 <Filename Value="UZ80Compiler.pas"/> 175 <Caret Line="139" Column="11" TopLine="119"/> 158 176 </Position14> 159 177 <Position15> 160 178 <Filename Value="UZ80Compiler.pas"/> 161 <Caret Line=" 31" Column="3" TopLine="19"/>179 <Caret Line="138" Column="13" TopLine="121"/> 162 180 </Position15> 163 181 <Position16> 164 182 <Filename Value="UZ80Compiler.pas"/> 165 <Caret Line=" 26" Column="3" TopLine="5"/>183 <Caret Line="140" Column="1" TopLine="125"/> 166 184 </Position16> 167 185 <Position17> 168 186 <Filename Value="UZ80Compiler.pas"/> 169 <Caret Line=" 54" Column="16" TopLine="42"/>187 <Caret Line="141" Column="1" TopLine="126"/> 170 188 </Position17> 171 189 <Position18> 172 190 <Filename Value="UZ80Compiler.pas"/> 173 <Caret Line=" 21" Column="44" TopLine="7"/>191 <Caret Line="142" Column="1" TopLine="127"/> 174 192 </Position18> 175 193 <Position19> 176 194 <Filename Value="UZ80Compiler.pas"/> 177 <Caret Line=" 59" Column="7" TopLine="45"/>195 <Caret Line="143" Column="1" TopLine="128"/> 178 196 </Position19> 179 197 <Position20> 180 198 <Filename Value="UZ80Compiler.pas"/> 181 <Caret Line=" 58" Column="10" TopLine="43"/>199 <Caret Line="144" Column="1" TopLine="129"/> 182 200 </Position20> 183 201 <Position21> 184 202 <Filename Value="UZ80Compiler.pas"/> 185 <Caret Line=" 59" Column="5" TopLine="44"/>203 <Caret Line="145" Column="35" TopLine="130"/> 186 204 </Position21> 187 205 <Position22> 188 206 <Filename Value="UZ80Compiler.pas"/> 189 <Caret Line=" 25" Column="5" TopLine="2"/>207 <Caret Line="146" Column="1" TopLine="120"/> 190 208 </Position22> 191 209 <Position23> 192 210 <Filename Value="UZ80Compiler.pas"/> 193 <Caret Line=" 76" Column="15" TopLine="61"/>211 <Caret Line="145" Column="25" TopLine="129"/> 194 212 </Position23> 195 213 <Position24> 196 214 <Filename Value="UZ80Compiler.pas"/> 197 <Caret Line=" 47" Column="39" TopLine="32"/>215 <Caret Line="140" Column="1" TopLine="125"/> 198 216 </Position24> 199 217 <Position25> 200 218 <Filename Value="UZ80Compiler.pas"/> 201 <Caret Line=" 21" Column="3" TopLine="6"/>219 <Caret Line="141" Column="1" TopLine="126"/> 202 220 </Position25> 203 221 <Position26> 204 222 <Filename Value="UZ80Compiler.pas"/> 205 <Caret Line=" 76" Column="13" TopLine="61"/>223 <Caret Line="142" Column="1" TopLine="127"/> 206 224 </Position26> 207 225 <Position27> 208 226 <Filename Value="UZ80Compiler.pas"/> 209 <Caret Line=" 88" Column="18" TopLine="49"/>227 <Caret Line="143" Column="1" TopLine="128"/> 210 228 </Position27> 211 229 <Position28> 212 230 <Filename Value="UZ80Compiler.pas"/> 213 <Caret Line=" 62" Column="1" TopLine="47"/>231 <Caret Line="144" Column="1" TopLine="129"/> 214 232 </Position28> 215 233 <Position29> 216 234 <Filename Value="UZ80Compiler.pas"/> 217 <Caret Line=" 90" Column="16" TopLine="69"/>235 <Caret Line="145" Column="1" TopLine="130"/> 218 236 </Position29> 219 237 <Position30> 220 238 <Filename Value="UZ80Compiler.pas"/> 221 <Caret Line="1 07" Column="17" TopLine="103"/>239 <Caret Line="146" Column="1" TopLine="131"/> 222 240 </Position30> 223 241 </JumpHistory> … … 238 256 </CompilerOptions> 239 257 <Debugging> 258 <BreakPoints Count="1"> 259 <Item1> 260 <Source Value="UZ80Compiler.pas"/> 261 <Line Value="140"/> 262 </Item1> 263 </BreakPoints> 240 264 <Exceptions Count="3"> 241 265 <Item1> -
branches/Z80/Compiler.lpr
r2 r3 34 34 end; 35 35 Compiler.Destroy; 36 ReadLn; 37 Terminate; 36 38 end; 37 39 -
branches/Z80/Example.asm
r2 r3 1 ; 2 ; Z-80 Opcodes in Alphabetical Order 3 ; 4 ; This file is used to test the Z-80 cross-assembler. The opcodes are in 5 ; alphabetical order rather than the usual numerical order so that I can 6 ; compare the output to my Z-80 assembly-language reference card. 7 ; 8 DD EQU 05H 9 EE EQU 30H 10 NN EQU 0584H 11 N EQU 20H 1 INC A 12 2 13 ;------------------------------------------------------------------------------14 ADC A, (HL)15 ADC A, (IX + DD)16 ADC A, (IY + DD)17 ADC A, A18 ADC A, B19 ADC A, C20 ADC A, D21 ADC A, E22 ADC A, H23 ADC A, L24 ADC A, N25 ;------------------------------------------------------------------------------26 ADC HL, BC27 ADC HL, DE28 ADC HL, HL29 ADC HL, SP30 ;------------------------------------------------------------------------------31 ADD A, (HL)32 ADD A, (IX + DD)33 ADD A, (IY + DD)34 ADD A, A35 ADD A, B36 ADD A, C37 ADD A, D38 ADD A, E39 ADD A, H40 ADD A, L41 ADD A, N42 ;------------------------------------------------------------------------------43 ADD HL, BC44 ADD HL, DE45 ADD HL, HL46 ADD HL, SP47 ;------------------------------------------------------------------------------48 ADD IX, BC49 ADD IX, DE50 ADD IX, IX51 ADD IX, SP52 ;------------------------------------------------------------------------------53 ADD IY, BC54 ADD IY, DE55 ADD IY, IY56 ADD IY, SP57 ;------------------------------------------------------------------------------58 AND (HL)59 AND (IX + DD)60 AND (IY + DD)61 AND A62 AND B63 AND C64 AND D65 AND E66 AND H67 AND L68 AND N69 ;------------------------------------------------------------------------------70 BIT 0, (HL)71 BIT 0, (IX + DD)72 BIT 0, (IY + DD)73 BIT 0, A74 BIT 0, B75 BIT 0, C76 BIT 0, D77 BIT 0, E78 BIT 0, H79 BIT 0, L80 BIT 1, (HL)81 BIT 1, (IX + DD)82 BIT 1, (IY + DD)83 BIT 1, A84 BIT 1, B85 BIT 1, C86 BIT 1, D87 BIT 1, E88 BIT 1, H89 BIT 1, L90 BIT 2, (HL)91 BIT 2, (IX + DD)92 BIT 2, (IY + DD)93 BIT 2, A94 BIT 2, B95 BIT 2, C96 BIT 2, D97 BIT 2, E98 BIT 2, H99 BIT 2, L100 BIT 3, (HL)101 BIT 3, (IX + DD)102 BIT 3, (IY + DD)103 BIT 3, A104 BIT 3, B105 BIT 3, C106 BIT 3, D107 BIT 3, E108 BIT 3, H109 BIT 3, L110 BIT 4, (HL)111 BIT 4, (IX + DD)112 BIT 4, (IY + DD)113 BIT 4, A114 BIT 4, B115 BIT 4, C116 BIT 4, D117 BIT 4, E118 BIT 4, H119 BIT 4, L120 BIT 5, (HL)121 BIT 5, (IX + DD)122 BIT 5, (IY + DD)123 BIT 5, A124 BIT 5, B125 BIT 5, C126 BIT 5, D127 BIT 5, E128 BIT 5, H129 BIT 5, L130 BIT 6, (HL)131 BIT 6, (IX + DD)132 BIT 6, (IY + DD)133 BIT 6, A134 BIT 6, B135 BIT 6, C136 BIT 6, D137 BIT 6, E138 BIT 6, H139 BIT 6, L140 BIT 7, (HL)141 BIT 7, (IX + DD)142 BIT 7, (IY + DD)143 BIT 7, A144 BIT 7, B145 BIT 7, C146 BIT 7, D147 BIT 7, E148 BIT 7, H149 BIT 7, L150 ;------------------------------------------------------------------------------151 CALL C, NN152 CALL M, NN153 CALL NC, NN154 CALL NZ, NN155 CALL P, NN156 CALL PE, NN157 CALL PO, NN158 CALL Z, NN159 ;------------------------------------------------------------------------------160 CALL NN161 ;------------------------------------------------------------------------------162 CCF163 ;------------------------------------------------------------------------------164 CP (HL)165 CP (IX + DD)166 CP (IY + DD)167 CP A168 CP B169 CP C170 CP D171 CP E172 CP H173 CP L174 CP N175 ;------------------------------------------------------------------------------176 CPD177 ;------------------------------------------------------------------------------178 CPDR179 ;------------------------------------------------------------------------------180 CPI181 ;------------------------------------------------------------------------------182 CPIR183 ;------------------------------------------------------------------------------184 CPL185 ;------------------------------------------------------------------------------186 DAA187 ;------------------------------------------------------------------------------188 DEC (HL)189 DEC (IX + DD)190 DEC (IY + DD)191 DEC A192 DEC B193 DEC BC194 DEC C195 DEC D196 DEC DE197 DEC E198 DEC H199 DEC HL200 DEC IX201 DEC IY202 DEC L203 DEC SP204 ;------------------------------------------------------------------------------205 DI206 ;------------------------------------------------------------------------------207 DJNZ $ + EE208 ;------------------------------------------------------------------------------209 EI210 ;------------------------------------------------------------------------------211 EX (SP), HL212 EX (SP), IX213 EX (SP), IY214 ;------------------------------------------------------------------------------215 EX AF, AF'216 ;------------------------------------------------------------------------------217 EX DE, HL218 ;------------------------------------------------------------------------------219 EXX220 ;------------------------------------------------------------------------------221 HALT222 ;------------------------------------------------------------------------------223 IM 0224 IM 1225 IM 2226 ;------------------------------------------------------------------------------227 IN A, (C)228 IN B, (C)229 IN C, (C)230 IN D, (C)231 IN E, (C)232 IN H, (C)233 IN L, (C)234 ;------------------------------------------------------------------------------235 INC (HL)236 INC (IX + DD)237 INC (IY + DD)238 INC A239 INC B240 INC BC241 INC C242 INC D243 INC DE244 INC E245 INC H246 INC HL247 INC IX248 INC IY249 INC L250 INC SP251 ;------------------------------------------------------------------------------252 IN A, (N)253 ;------------------------------------------------------------------------------254 IND255 ;------------------------------------------------------------------------------256 INDR257 ;------------------------------------------------------------------------------258 INI259 ;------------------------------------------------------------------------------260 INIR261 ;------------------------------------------------------------------------------262 JP NN263 JP (HL)264 JP (IX)265 JP (IY)266 ;------------------------------------------------------------------------------267 JP C, NN268 JP M, NN269 JP NC, NN270 JP NZ, NN271 JP P, NN272 JP PE, NN273 JP PO, NN274 JP Z, NN275 ;------------------------------------------------------------------------------276 JR C, $ + EE277 JR NC, $ + EE278 JR NZ, $ + EE279 JR Z, $ + EE280 ;------------------------------------------------------------------------------281 JR $ + EE282 ;------------------------------------------------------------------------------283 LD (BC), A284 LD (DE), A285 LD (HL), A286 LD (HL), B287 LD (HL), C288 LD (HL), D289 LD (HL), E290 LD (HL), H291 LD (HL), L292 LD (HL), N293 LD (IX + DD), A294 LD (IX + DD), B295 LD (IX + DD), C296 LD (IX + DD), D297 LD (IX + DD), E298 LD (IX + DD), H299 LD (IX + DD), L300 LD (IX + DD), N301 LD (IY + DD), A302 LD (IY + DD), B303 LD (IY + DD), C304 LD (IY + DD), D305 LD (IY + DD), E306 LD (IY + DD), H307 LD (IY + DD), L308 LD (IY + DD), N309 LD (NN), A310 LD (NN), BC311 LD (NN), DE312 LD (NN), HL313 LD (NN), IX314 LD (NN), IY315 LD (NN), SP316 LD A, (BC)317 LD A, (DE)318 LD A, (HL)319 LD A, (IX + DD)320 LD A, (IY + DD)321 LD A, (NN)322 LD A, A323 LD A, B324 LD A, C325 LD A, D326 LD A, E327 LD A, H328 LD A, I329 LD A, L330 LD A, N331 LD A, R332 LD B, (HL)333 LD B, (IX + DD)334 LD B, (IY + DD)335 LD B, A336 LD B, B337 LD B, C338 LD B, D339 LD B, E340 LD B, H341 LD B, L342 LD B, N343 LD BC, (NN)344 LD BC, NN345 LD C, (HL)346 LD C, (IX + DD)347 LD C, (IY + DD)348 LD C, A349 LD C, B350 LD C, C351 LD C, D352 LD C, E353 LD C, H354 LD C, L355 LD C, N356 LD D, (HL)357 LD D, (IX + DD)358 LD D, (IY + DD)359 LD D, A360 LD D, B361 LD D, C362 LD D, D363 LD D, E364 LD D, H365 LD D, L366 LD D, N367 LD DE, (NN)368 LD DE, NN369 LD E, (HL)370 LD E, (IX + DD)371 LD E, (IY + DD)372 LD E, A373 LD E, B374 LD E, C375 LD E, D376 LD E, E377 LD E, H378 LD E, L379 LD E, N380 LD H, (HL)381 LD H, (IX + DD)382 LD H, (IY + DD)383 LD H, A384 LD H, B385 LD H, C386 LD H, D387 LD H, E388 LD H, H389 LD H, L390 LD H, N391 LD HL, (NN)392 LD HL, NN393 LD I, A394 LD IX, (NN)395 LD IX, NN396 LD IY, (NN)397 LD IY, NN398 LD L, (HL)399 LD L, (IX + DD)400 LD L, (IY + DD)401 LD L, A402 LD L, B403 LD L, C404 LD L, D405 LD L, E406 LD L, H407 LD L, L408 LD L, N409 LD R, A410 LD SP, (NN)411 LD SP, HL412 LD SP, IX413 LD SP, IY414 LD SP, NN415 ;------------------------------------------------------------------------------416 LDD417 ;------------------------------------------------------------------------------418 LDDR419 ;------------------------------------------------------------------------------420 LDI421 ;------------------------------------------------------------------------------422 LDIR423 ;------------------------------------------------------------------------------424 NEG425 ;------------------------------------------------------------------------------426 NOP427 ;------------------------------------------------------------------------------428 OR (HL)429 OR (IX + DD)430 OR (IY + DD)431 OR A432 OR B433 OR C434 OR D435 OR E436 OR H437 OR L438 OR N439 ;------------------------------------------------------------------------------440 OTDR441 ;------------------------------------------------------------------------------442 OTIR443 ;------------------------------------------------------------------------------444 OUT (C), A445 OUT (C), B446 OUT (C), C447 OUT (C), D448 OUT (C), E449 OUT (C), H450 OUT (C), L451 ;------------------------------------------------------------------------------452 OUT (N), A453 ;------------------------------------------------------------------------------454 OUTD455 ;------------------------------------------------------------------------------456 OUTI457 ;------------------------------------------------------------------------------458 POP AF459 POP BC460 POP DE461 POP HL462 POP IX463 POP IY464 ;------------------------------------------------------------------------------465 PUSH AF466 PUSH BC467 PUSH DE468 PUSH HL469 PUSH IX470 PUSH IY471 ;------------------------------------------------------------------------------472 RES 0, (HL)473 RES 0, (IX + DD)474 RES 0, (IY + DD)475 RES 0, A476 RES 0, B477 RES 0, C478 RES 0, D479 RES 0, E480 RES 0, H481 RES 0, L482 RES 1, (HL)483 RES 1, (IX + DD)484 RES 1, (IY + DD)485 RES 1, A486 RES 1, B487 RES 1, C488 RES 1, D489 RES 1, E490 RES 1, H491 RES 1, L492 RES 2, (HL)493 RES 2, (IX + DD)494 RES 2, (IY + DD)495 RES 2, A496 RES 2, B497 RES 2, C498 RES 2, D499 RES 2, E500 RES 2, H501 RES 2, L502 RES 3, (HL)503 RES 3, (IX + DD)504 RES 3, (IY + DD)505 RES 3, A506 RES 3, B507 RES 3, C508 RES 3, D509 RES 3, E510 RES 3, H511 RES 3, L512 RES 4, (HL)513 RES 4, (IX + DD)514 RES 4, (IY + DD)515 RES 4, A516 RES 4, B517 RES 4, C518 RES 4, D519 RES 4, E520 RES 4, H521 RES 4, L522 RES 5, (HL)523 RES 5, (IX + DD)524 RES 5, (IY + DD)525 RES 5, A526 RES 5, B527 RES 5, C528 RES 5, D529 RES 5, E530 RES 5, H531 RES 5, L532 RES 6, (HL)533 RES 6, (IX + DD)534 RES 6, (IY + DD)535 RES 6, A536 RES 6, B537 RES 6, C538 RES 6, D539 RES 6, E540 RES 6, H541 RES 6, L542 RES 7, (HL)543 RES 7, (IX + DD)544 RES 7, (IY + DD)545 RES 7, A546 RES 7, B547 RES 7, C548 RES 7, D549 RES 7, E550 RES 7, H551 RES 7, L552 ;------------------------------------------------------------------------------553 RET554 ;------------------------------------------------------------------------------555 RET C556 RET M557 RET NC558 RET NZ559 RET P560 RET PE561 RET PO562 RET Z563 ;------------------------------------------------------------------------------564 RETI565 ;------------------------------------------------------------------------------566 RETN567 ;------------------------------------------------------------------------------568 RL (HL)569 RL (IX + DD)570 RL (IY + DD)571 RL A572 RL B573 RL C574 RL D575 RL E576 RL H577 RL L578 ;------------------------------------------------------------------------------579 RLA580 ;------------------------------------------------------------------------------581 RLC (HL)582 RLC (IX + DD)583 RLC (IY + DD)584 RLC A585 RLC B586 RLC C587 RLC D588 RLC E589 RLC H590 RLC L591 ;------------------------------------------------------------------------------592 RLCA593 ;------------------------------------------------------------------------------594 RLD595 ;------------------------------------------------------------------------------596 RR (HL)597 RR (IX + DD)598 RR (IY + DD)599 RR A600 RR B601 RR C602 RR D603 RR E604 RR H605 RR L606 ;------------------------------------------------------------------------------607 RRA608 ;------------------------------------------------------------------------------609 RRC (HL)610 RRC (IX + DD)611 RRC (IY + DD)612 RRC A613 RRC B614 RRC C615 RRC D616 RRC E617 RRC H618 RRC L619 ;------------------------------------------------------------------------------620 RRCA621 ;------------------------------------------------------------------------------622 RRD623 ;------------------------------------------------------------------------------624 RST 00H625 RST 08H626 RST 10H627 RST 18H628 RST 20H629 RST 28H630 RST 30H631 RST 38H632 ;------------------------------------------------------------------------------633 SBC A, (HL)634 SBC A, (IX + DD)635 SBC A, (IY + DD)636 SBC A, A637 SBC A, B638 SBC A, C639 SBC A, D640 SBC A, E641 SBC A, H642 SBC A, L643 SBC A, N644 SBC HL, BC645 SBC HL, DE646 SBC HL, HL647 SBC HL, SP648 ;------------------------------------------------------------------------------649 SCF650 ;------------------------------------------------------------------------------651 SET 0, (HL)652 SET 0, (IX + DD)653 SET 0, (IY + DD)654 SET 0, A655 SET 0, B656 SET 0, C657 SET 0, D658 SET 0, E659 SET 0, H660 SET 0, L661 SET 1, (HL)662 SET 1, (IX + DD)663 SET 1, (IY + DD)664 SET 1, A665 SET 1, B666 SET 1, C667 SET 1, D668 SET 1, E669 SET 1, H670 SET 1, L671 SET 2, (HL)672 SET 2, (IX + DD)673 SET 2, (IY + DD)674 SET 2, A675 SET 2, B676 SET 2, C677 SET 2, D678 SET 2, E679 SET 2, H680 SET 2, L681 SET 3, (HL)682 SET 3, (IX + DD)683 SET 3, (IY + DD)684 SET 3, A685 SET 3, B686 SET 3, C687 SET 3, D688 SET 3, E689 SET 3, H690 SET 3, L691 SET 4, (HL)692 SET 4, (IX + DD)693 SET 4, (IY + DD)694 SET 4, A695 SET 4, B696 SET 4, C697 SET 4, D698 SET 4, E699 SET 4, H700 SET 4, L701 SET 5, (HL)702 SET 5, (IX + DD)703 SET 5, (IY + DD)704 SET 5, A705 SET 5, B706 SET 5, C707 SET 5, D708 SET 5, E709 SET 5, H710 SET 5, L711 SET 6, (HL)712 SET 6, (IX + DD)713 SET 6, (IY + DD)714 SET 6, A715 SET 6, B716 SET 6, C717 SET 6, D718 SET 6, E719 SET 6, H720 SET 6, L721 SET 7, (HL)722 SET 7, (IX + DD)723 SET 7, (IY + DD)724 SET 7, A725 SET 7, B726 SET 7, C727 SET 7, D728 SET 7, E729 SET 7, H730 SET 7, L731 ;------------------------------------------------------------------------------732 SLA (HL)733 SLA (IX + DD)734 SLA (IY + DD)735 SLA A736 SLA B737 SLA C738 SLA D739 SLA E740 SLA H741 SLA L742 ;------------------------------------------------------------------------------743 SRA (HL)744 SRA (IX + DD)745 SRA (IY + DD)746 SRA A747 SRA B748 SRA C749 SRA D750 SRA E751 SRA H752 SRA L753 ;------------------------------------------------------------------------------754 SRL (HL)755 SRL (IX + DD)756 SRL (IY + DD)757 SRL A758 SRL B759 SRL C760 SRL D761 SRL E762 SRL H763 SRL L764 ;------------------------------------------------------------------------------765 SUB (HL)766 SUB (IX + DD)767 SUB (IY + DD)768 SUB A769 SUB B770 SUB C771 SUB D772 SUB E773 SUB H774 SUB L775 SUB N776 ;------------------------------------------------------------------------------777 XOR (HL)778 XOR (IX + DD)779 XOR (IY + DD)780 XOR A781 XOR B782 XOR C783 XOR D784 XOR E785 XOR H786 XOR L787 XOR N788 ;------------------------------------------------------------------------------789 790 END -
branches/Z80/UDynamicNumber.pas
r2 r3 9 9 10 10 type 11 12 { TDynamicNumber }13 14 11 TDynamicNumber = class 15 12 private -
branches/Z80/UZ80Compiler.pas
r2 r3 17 17 Mask: TDynamicNumber; 18 18 property Size: Integer read GetSize write SetSize; 19 constructor Create; 20 destructor Destroy; override; 19 21 end; 20 22 … … 43 45 destructor Destroy; override; 44 46 end; 47 48 { TZ80Compiler } 45 49 46 50 TZ80Compiler = class … … 50 54 MachineCode: TMemoryStream; 51 55 procedure InitOpcodes; 56 function FindOpcodeByName(Name: string): TOpcode; 57 function ParseLine(var Text: string; Separator: string = ' '): string; 52 58 public 53 59 procedure Load(StringList: TStringList); … … 101 107 end; 102 108 109 function TZ80Compiler.FindOpcodeByName(Name: string): TOpcode; 110 var 111 I: Integer; 112 begin 113 I := 0; 114 while (I < Opcodes.Count) and (TOpcode(Opcodes[I]).Name <> Name) do Inc(I); 115 if I < Opcodes.Count then Result := Opcodes[I] 116 else Result := nil; 117 end; 118 119 function TZ80Compiler.ParseLine(var Text: string; Separator: string = ' '): string; 120 begin 121 Text := Trim(Text); 122 Result := Copy(Text, 1, Pos(Separator, Text) - 1); 123 if Result <> '' then 124 Delete(Text, 1, Length(Result) + Length(Separator)); 125 end; 126 103 127 procedure TZ80Compiler.Load(StringList: TStringList); 104 128 var 105 129 I: Integer; 106 begin 130 Line: string; 131 InstructionName: string; 132 Instruction: TOpcode; 133 Parameter: string; 134 begin 107 135 for I := 0 to StringList.Count - 1 do begin 108 136 Line := Trim(StringList[I]); 137 Line := StringReplace(Line, #9, ' ', [rfReplaceAll]); 138 if Length(Line) > 0 then begin 139 if Line[1] = ';' then Continue; // Skip commented lines 140 InstructionName := ParseLine(Line); 141 Instruction := FindOpcodeByName(InstructionName); 142 if Assigned(Instruction) then begin 143 WriteLn(InstructionName); 144 if Pos(',', Line) > 0 then Parameter := ParseLine(Line, ',') 145 else Parameter := Line; 146 WriteLn(Parameter); 147 end else WriteLn('Unknown instruction name "' + InstructionName + '"'); 148 end; 109 149 end; 110 150 end; … … 145 185 end; 146 186 187 constructor TMaskedValue.Create; 188 begin 189 Mask := TDynamicNumber.Create; 190 Value := TDynamicNumber.Create; 191 end; 192 193 destructor TMaskedValue.Destroy; 194 begin 195 Mask.Destroy; 196 Value.Destroy; 197 inherited Destroy; 198 end; 199 147 200 { TOpcode } 148 201 … … 150 203 begin 151 204 MaskedValue := TMaskedValue.Create; 205 Operands := TList.Create; 152 206 end; 153 207
Note:
See TracChangeset
for help on using the changeset viewer.