I'm trying to re-learn 6502 assembly by using some YouTube videos with Applewin and the Merlin assembler. I'm having issues with objects and object files. For example, I type in the exact source code as seen on the YouTube video, I use the same Merlin commands as well, the program completes the assembler process wihtout errors and it matches the exacts output in the video, but I am unable to get Applewin to save the object file after I save the source file. When I tried a different video which use OBJ $300 as the second line in the source code, I get the error "Bad "OBJ" in line 2". Here is the source code for the second video I'm trying to use:
ORG $300
OBJ $300
BELL EQU $FBDD
START JSR BELL
DONE RTS
LST OFF
Seems pretty simple to me. All I can think of is that it's something in the configuration for Applewin. I've tried unchecking the CP/M card option, and changed the simulation from enhanced IIe to just IIe. I haven't actually tried any of the code on my actual Apple IIe enhanced just yet.
Any ideas?
The machine language monitor.
If you are in the Apple II monitor, you should see a * prompt. If you are in Applesoft BASIC you will see a ] prompt. If you are in Integer BASIC you will see a > prompt.
If you are not already in the Apple II monitor, then type the following statement from BASIC:
CALL-151
You should now be in the monitor with the * prompt.
From the monitor, type the following:
300:4C
This stores the byte $4C into memory at address $300. All numbers in the monitor are in hexadecimal. When writing an explanation, I am putting a dollar sign $ in front of hexadecimal numbers. When using the monitor don't type the dollar sign in front of the numbers because the monitor expects all numbers to be in hexadecimal without a dollar sign in front.
To see the byte you just stored into memory, type the following:
300
You should see "0300- 4C" displayed.
Now let's store two more bytes. Type the following:
301:DD FB
You've now got 3 bytes in total that you've stored in memory. To see the range of three bytes, type the following:
300.302
You should see "0300- 4C DD FB" displayed.
Those three bytes "4C DD FB" in memory are a machine language program!
To see a listing of the program, type the following:
300L
The first line of the listing should be "0300- 4C DD FB JMP $FBDD"
You can ignore the rest of the listing. The important part are the three bytes at the top that disassemble to "JMP $FBDD" displayed beside the three bytes. That's a one line machine language program from the three bytes you stored in memory.
The program will JuMP to address $FBDD when run. To run the program, type:
300G
You should hear a beep.
Thank you for that information. I did use my Apple IIe to do what you have provided and it does work fine. My bigger issue is that I am unable to get past the "BAD OBJ" error I previously mentioned while in Merlin 2.43, even when trying it on my Apple IIe and not Applewin. Newer versions of Merlin do not display and function correctly on my Apple IIe when in the editor. So I have to use 2.43 to get anything to work. I even tried changing the memory location to $800, and I get the same error message.
Maybe a different assembler would be better? I'll take any recommendations at this point.
The mini assembler.
If you are in the mini assembler, you should see a ! prompt. The mini assembler is a program in the older Integer BASIC ROM. You probably need to load Integer BASIC into the language card (16K RAM card.) If you boot from the DOS 3.3 System Master, Integer BASIC should load into the language card. With DOS 3.3, you can type INT to switch to INTeger BASIC:
INT
You should see the > prompt for Integer BASIC.
With Integer BASIC, you'll be going into the "old" monitor which has the mini assembler. Now go into the monitor by typing the usual statement:
CALL -151
You should see the * prompt for the monitor.
To run the mini assembler, type the following command from the (old) monitor:
F666G
You should see the ! prompt for the mini assembler.
Now, let's enter that one-line assembler program:
$300:JMP $FBDD
You should see "0300- 4C DD FB JMP $FBDD" displayed.
To run the program from the mini assembler, type:
$300G
You should hear a beep.
This certainly has nothing to do with Applewin. Seems Merlin 2.43 simply doesn't know the "OBJ" pseudo-command. You don't really need it. Just skip this line - and your example assembles fine. And you can save the object. Also tried it with Merlin 2.43 and Applewin.
The Merlin Manual (obviously a manual for a later version, which has the OBJ pseudo command) actually recommends to not use "OBJ" - unless you really know what you're doing.
Excerpt from merlin manual text ch 3 ...
sed 's/OBJ/;OBJ/' bell.s>bell_sans_obj.s;Merlin32 '' bell_sans_obj.s>/dev/null;cat bell_sans_obj|l
0000- 20 DD FB JSR $FBDD
0003- 60 RTS
I did use the space bar back when I first entered teh code, and that's when I got the error. As someone stated, Merlin does not like the OBJ, so I left it out.
All good to go now.
Thank you all!
Thank you all as well. As luck would have it, I had the exact same issue just starting with Merline and assembly. I appreciate the information the community has provided.