yossibnv Posted November 15, 2014 Share Posted November 15, 2014 I am trying to run assemly code on altirra 2.5 emulator and it crushes i use assembler edtitor rom for the assembler programs following the stack dump : CPU: Illegal instruction hit: 0056 (8158: 14, 30) A=10 X=00 Y=00 S=FF P=30 ( ) 0055: 02 COLCRS bad i've tried differnt cpu & memory setting like enabling illegal operations i use 32 bit won 7 os . My source code 10 *=$1000 20 lda #1000 30 end Bug G 1000 I Quote Link to comment Share on other sites More sharing options...
tschak909 Posted November 15, 2014 Share Posted November 15, 2014 You are trying to stuff a value larger than 255 into the accumulator. This can't be done because the registers on the 6502 are all 8-bits wide. Are you trying to _Read_ from address $1000 into the accumulator? If that's the case, then replace the # with $, to both ensure that you're reading from an address, and that you're reading from address $1000 hexadecimal, rather than 1000 decimal, which are two very different things. -Thom In short:# = an immediate (literal) value, think constant. $ = what follows is hexadecimal -Thom Quote Link to comment Share on other sites More sharing options...
yossibnv Posted November 15, 2014 Author Share Posted November 15, 2014 hi, thanks for reply Thom so I've tried to fix my code and load the accumulator with decimal value smaller then 255 10 *=$100020 LDA #030 ENDBug G 1000 and i get: CPU: Illegal instruction hit: 1001 (16308: 35,107) A=00 X=00 Y=00 S=00 P=30 ( ) 1000: 00 00 BRK #$00 to make this post more efficient ,i would appreciate any suggested working assembly simple code , so i can start my own first steps 10X Quote Link to comment Share on other sites More sharing options...
ricortes Posted November 15, 2014 Share Posted November 15, 2014 Spaces are significant with every Atari assembler I know of. Not saying there aren't any that don't do it that way, just that I don't know of them. By your post I am guessing your are using the Atari cart and not Altirra's built in debugger. 10 *=$100020 lda #100030 end you need 10 *=$4000 20 lda #1025 brk 30 .end Then type ASM Note that the ASM/ED cart defaults to putting the .obj into memory. MAC/65 doesn't so you have to use the option .OPT OBJ at the head of the program. It's considered safer to not assemble into memory until you have got rid of any bugs. You always want to start your programs in higher memory because DOS will get stepped on by something assembling to $1000. Has to be a minimum of ~$2000 and that moves depending on how much code you put in the editor. Think of the assembler as being in fields sort of like a spread sheet. You can't see the demarcations because they are white space, but they are there. After the above assembles, do your BUG G4000 and you should get the register read out with $0A<10 decimal> in the A-reg Quote Link to comment Share on other sites More sharing options...
phaeron Posted November 15, 2014 Share Posted November 15, 2014 Keep in mind that if you want to use BRK to break into the ASM/ED debugger, you'll need to turn off the option System > CPU Options > Stop on BRK instruction to prevent the emulator from intercepting the BRK instruction. Quote Link to comment Share on other sites More sharing options...
yossibnv Posted November 16, 2014 Author Share Posted November 16, 2014 thanks for all replies!! i am new to this forum and very satisfy as i mentioned above i use altirra 2.5 emulator and assembler edtitor rom . following your suggestion and running the given code(get 0 errors after running ASM command) , i get the following registers dump at the altirra console: CPU: Illegal instruction hit: 9B01 (13715: 82, 2) A=0A X=00 Y=00 S=00 P=30 ( ) 9B00: 02 bad (what this bad mean?) so the accumulator was loaded with the correct value (10 descimal=0A), but still i get the altirra crush window if i am not enabling the debugger on menu option: debug==>enable debugger. i also turn off the option System > CPU Options > Stop on BRK : following the code: 10 *=$4000 20 lda #1025 brk 30 .end Quote Link to comment Share on other sites More sharing options...
Rybags Posted November 16, 2014 Share Posted November 16, 2014 Are you sure it's even assembling anything? You need 2 spaces after line numbers for instructions. Only 1 space gets interpreted as a label. Go into DEBUG, enter: L 1000 That gives disassembly of what you just put there. END is optional, you don't really need it. Also, it's a good idea to assemble a bit higher up in memory. If a DOS is loaded, then it'll probably occupy memory up to around $2000 or more. Plus your source code starts at the lowest point in free memory. I usually just do small stuff at $4000. Quote Link to comment Share on other sites More sharing options...
ricortes Posted November 16, 2014 Share Posted November 16, 2014 CPU: Illegal instruction hit: 9B01 (13715: 82, 2) A=0A X=00 Y=00 S=00 P=30 ( ) 9B00: 02 bad (what this bad mean?) Wild guess, there is something in your code that is causing a JSR or JMP or VBXE is set in *OR* something along those lines that is causing your program to try and execute at ~$9B00. For some reason it is running into an $02 which could be<very likely> part of a display list code for ANTIC and seeing it as a bad instruction. Hard to say why w/o seeing more info. Quote Link to comment Share on other sites More sharing options...
yossibnv Posted November 17, 2014 Author Share Posted November 17, 2014 Hi my code as appears above: 10 *=$4000 20 lda #10 25 brk 30 .end I don't see any jumping or branching ,just a simple assembly code Quote Link to comment Share on other sites More sharing options...
Rybags Posted November 17, 2014 Share Posted November 17, 2014 Instead of running with the G command, try a trace (T). You should then get a display of each instruction as it's run. Quote Link to comment Share on other sites More sharing options...
ricortes Posted November 17, 2014 Share Posted November 17, 2014 I guess I am not making this clear. The asm/ed cart uses position to distinguish if something is a label, code, or directive. You are only using one space between the line number and the mnemonic, you need to use two spaces. 10 LDA => one space so the cart thinks you are trying to use 'LDA' as a label10 LDA => two spaces so the cart thinks you are trying to use the 'LDA' as an instruction.*BUT* it is field location, not necessarily white space. For instance you could do 10 LDA LDA $10 In this case the first LDA would be a label and the second would be an instruction. This is so you can do something like20 JMP LDA and program control will pass to the LDA $10 part. Of course you wouldn't want to use an instruction as a label because it becomes confusing. I have been programming for years and I just confused myself! This is one of the reasons why people like to use a real program editor. Most are smart enough to highlight your code so errors are easier to catch. Just entering code, it is automatically highlighted something like. 10 LDA LDA $10 or with colors so at a glance you can see the first LDA is being interpreted as a label. Maybe it would be easier for you to see it with tabs instead of spaces. 10 *=4000 20 START 30 LDA #10 40 BRK 50 .END Use windows highlight/copy function for the above code. Open Alirra with the ASM/ED cart and right click/paste it into the cart editor. It should assemble and work. If it doesn't work, you may have a bad cart image. Quote Link to comment Share on other sites More sharing options...
yossibnv Posted November 17, 2014 Author Share Posted November 17, 2014 I re-typed the code with the correct spaces and compiled it successfully ,i even get the correct results for the accumulator =0A (10 decimal) the issue is only with altirra window crushes, if i am running the code without enabling debugger from the "Debug" menu. so either this is the way to work with the asm/ED cart image or the image is damaged . in case that it damaged i will be very appreciated to get a good link for working image. the results i get now are fine : CPU: Illegal instruction hit: 4003 (8614: 35,109) A=0A X=00 Y=00 S=00 P=30 ( ) 4002: 00 00 BRK #$00 the code: 10 *=4000 20 START 30 LDA #10 40 BRK 50 .END thanks for help 1 Quote Link to comment Share on other sites More sharing options...
ricortes Posted November 18, 2014 Share Posted November 18, 2014 This is a file version I picked up here. Maybe someone can delete it after you get it. Boot with BASIC disabled. From the DOS menu L => the load option ASMED.COM => the executable and you should be in the Editor. Works for me with Altirra 2.60 test 20. DOS25.ATR Quote Link to comment Share on other sites More sharing options...
yossibnv Posted November 18, 2014 Author Share Posted November 18, 2014 I download the Altirra 2.60 test 20.(64 bit version for my 64 bit pc) loaded the asmed.com from the dos25.atr (I didn't really understood why i need to disable basic ,since i get the dos menu immediately without basic) and run again the same code , i have noticed that when assembling the code using ASM command the compiler drops an error on line 50 .BRK so i've removed the"." and it compiled fine. but still the altirra crushe when i am typing : ASM no error bug > Debug G 4000 the i get the alrirra crush win which says :"altirra error", wich enforce me to open debug window with following results: CPU: Illegal instruction hit: 4003 (32700: 20, 70) A=0A X=00 Y=00 S=00 P=30 ( ) 4002: 00 00 BRK #$00 Quote Link to comment Share on other sites More sharing options...
Rybags Posted November 18, 2014 Share Posted November 18, 2014 You need to disable the Stop on BRK option in Altirra, as was pointed out 2 days ago. Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted November 18, 2014 Share Posted November 18, 2014 I am just wondering... what do you want to achieve or what does you confuse? the "illegal instruction" is normal and if enabled in Altirra as Phaeron pointed out works as designed???? why not start with a simple hello world? POKE 712,$FF --> ORG $4000 LDA #$ff STA 712 RTS ? 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.