Endless Runner 2600 Posted April 27, 2019 Share Posted April 27, 2019 (edited) I'm trying to use the sleep macro inside the macro.h header. Here is the code: ; SLEEP duration ; Original author: Thomas Jentzsch ; Inserts code which takes the specified number of cycles to execute. This is ; useful for code where precise timing is required. ; ILLEGAL-OPCODE VERSION DOES NOT AFFECT FLAGS OR REGISTERS. ; LEGAL OPCODE VERSION MAY AFFECT FLAGS ; Uses illegal opcode (DASM 2.20.01 onwards). MAC SLEEP ;usage: SLEEP n (n>1) .CYCLES SET {1} IF .CYCLES < 2 ECHO "MACRO ERROR: 'SLEEP': Duration must be > 1" ERR ENDIF IF .CYCLES & 1 IFNCONST NO_ILLEGAL_OPCODES nop 0 ELSE bit VSYNC ENDIF .CYCLES SET .CYCLES - 3 ENDIF REPEAT .CYCLES / 2 nop REPEND ENDM However when I try to assemble it get the error: --- Unresolved Symbol ListNO_ILLEGAL_OPCODES 0000 ???? (R )--- 1 Unresolved Symbol Here is the output log: START OF PASS: 1 ---------------------------------------------------------------------- SEGMENT NAME INIT PC INIT RPC FINAL PC FINAL RPC f000 f000 RIOT [u] 0280 0280 TIA_REGISTERS_READ [u] 0000 0000 TIA_REGISTERS_WRITE [u] 0000 0000 INITIAL CODE SEGMENT 0000 ???? 0000 ???? ---------------------------------------------------------------------- 15 references to unknown symbols. 20 events requiring another assembler pass. - Expression in mnemonic not resolved. - Label defined after it has been referenced (forward reference). --- Unresolved Symbol List NO_ILLEGAL_OPCODES 0000 ???? (R ) --- 1 Unresolved Symbol START OF PASS: 2 ---------------------------------------------------------------------- SEGMENT NAME INIT PC INIT RPC FINAL PC FINAL RPC f000 f000 RIOT [u] 0280 0280 TIA_REGISTERS_READ [u] 0000 0000 TIA_REGISTERS_WRITE [u] 0000 0000 INITIAL CODE SEGMENT 0000 ???? 0000 ???? ---------------------------------------------------------------------- 1 references to unknown symbols. 0 events requiring another assembler pass. --- Symbol List (sorted by symbol) 0.DigitPointerLoop f05f (R ) 0.divideby15 f017 (R ) 0.FREE_BYTES 0000 1.CYCLES 0028 (R ) AddScore f033 ApplyGravity f16f (R ) AUDC0 0015 AUDC1 0016 AUDF0 0017 AUDF1 0018 AUDV0 0019 AUDV1 001a BLACK 0000 (R ) BROWN 00f0 (R ) CheckActivatePlayer f136 ClearRAM f0e3 (R ) COLUBK 0009 (R ) COLUP0 0006 (R ) COLUP1 0007 COLUPF 0008 (R ) CTRLPF 000a CXBLPF 0006 CXCLR 002c CXM0FB 0004 CXM0P 0000 CXM1FB 0005 CXM1P 0001 CXP0FB 0002 CXP1FB 0003 CXPPMM 0007 Digit0 f000 (R ) Digit1 f002 (R ) Digit2 f004 (R ) Digit3 f006 (R ) Digit4 f008 (R ) Digit5 f00a (R ) DigitsFont f200 (R ) DrawDigits f085 DrawDigitsLoop f0a0 (R ) DrawDigitsLoopCounter f00c (R ) ENABL 001f ENAM0 001d ENAM1 001e fineAdjustBegin f024 (R ) fineAdjustTable ef33 FinishPlayer f153 (R ) FLOORY 0015 (R ) GetDigitPointers f05b GRP0 001b (R ) GRP1 001c (R ) HMBL 0024 HMCLR 002b HMM0 0022 HMM1 0023 HMOVE 002a (R ) HMP0 0020 (R ) HMP1 0021 INPT0 0008 INPT1 0009 INPT2 000a INPT3 000b INPT4 000c (R ) INPT5 000d INTIM 0284 (R ) MainLoop f0f9 (R ) NO_ILLEGAL_OPCODES 0000 ???? (R ) NUSIZ0 0004 NUSIZ1 0005 OverScanWait f177 (R ) PF0 000d (R ) PF0Data f300 (R ) PF1 000e (R ) PF1Data f400 (R ) PF2 000f (R ) PF2Data f500 (R ) PlayerBuffer f00e (R ) PlayerGraphic f17f (R ) PLAYERX 001e (R ) PlayerY f00f (R ) PosObject f014 (R ) REFP0 000b REFP1 000c RESBL 0014 RESM0 0012 RESM1 0013 RESMP0 0028 RESMP1 0029 RESP0 0010 (R ) RESP1 0011 RSYNC 0003 ScanLoop f12f (R ) Score f010 (R ) SkipActivatePlayer f140 (R ) SkipJetpack f116 (R ) Start f0dc (R ) SWACNT 0281 SWBCNT 0283 SWCHA 0280 SWCHB 0282 T1024T 0297 Temp f013 (R ) TIA_BASE_ADDRESS 0000 (R ) TIA_BASE_READ_ADDRESS 0000 (R ) TIA_BASE_WRITE_ADDRESS 0000 (R ) TIM1T 0294 TIM64T 0296 (R ) TIM8T 0295 TIMINT 0285 VBLANK 0001 (R ) VDELBL 0027 VDELP0 0025 VDELP1 0026 VERSION_MACRO 006a VERSION_VCS 0069 VisiblePlayerLine f00d (R ) VSYNC 0000 (R ) WaitForVblankEnd f124 (R ) WSYNC 0002 (R ) YELLOW 001c (R ) --- End of Symbol List. --- Unresolved Symbol List NO_ILLEGAL_OPCODES 0000 ???? (R ) --- 1 Unresolved Symbol Complete. I'm using DASM 2.20.11 20040304 if that helps. Any ideas on what the issue could be? Edited April 27, 2019 by Endless Runner 2600 Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted April 28, 2019 Share Posted April 28, 2019 The message is irritating for sure, but the code has be assembled completely. Check the resulting binary. Quote Link to comment Share on other sites More sharing options...
JeremiahK Posted April 28, 2019 Share Posted April 28, 2019 Yes, this is normal. In the snippet, it checks for the existence of NO_ILLEGAL_OPCODES: IFNCONST NO_ILLEGAL_OPCODES nop 0 ELSE bit VSYNC ENDIF This way, if you define the label NO_ILLEGAL_OPCODES, it will insert a "bit VSYNC" instruction, versus the undocumented "nop 0". And if you don't define the label, dasm warns you about it, but everything works fine. Quote Link to comment Share on other sites More sharing options...
Dionoid Posted May 2, 2019 Share Posted May 2, 2019 (edited) That warning is a flaw in the macro.h in my opinion. I modified my local version of macro.h to always do a 'nop 0' by commenting out the surrounding conditions. No idea why anyone would like to use 'bit VSYNC' here, because that instruction might change the flags. Edited May 2, 2019 by Dionoid Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted May 3, 2019 Share Posted May 3, 2019 Chip revisions may not support them. A couple stable opcodes were found not to work with FB2's: http://atariage.com/forums/topic/75267-fb2-compatiblity-list/page-2?do=findComment&comment=954273 BTW writing to $2D, $2E, or $2F should also have no effect to waste 3 cycles. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.