Performing @ Command Conversion for Non-Numerics?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Performing @ Command Conversion for Non-Numerics?

AnalyticLunatic
I'm making my Assembler in C# and almost have it completed. It correctly handles the Add.asm, and all the *L.asm files, but not the regular Max/Rect/Pong.asm files. I'm trying to implement a way to handle '@' commands that don't have explicit number (ex. @address) and labels and such.

Can someone explain the following to me? When I run the Rect.asm file through the built-in assembler I see the following conversions take place:

@INFINITE_LOOP = 0000 0000 0001 0111 (23)
@count = 0000 0000 0001 0000 (16)
@SCREEN = 0100 0000 0000 0000 (?)
@LOOP = 0000 0000 0000 1010 (10)

And for the Max.asm file:

@R1 = 0000 0000 0000 0001 (1)
@OUTPUT_FIRST = 0000 0000 0000 1010 (10)
@OUTPUT_D = 0000 0000 0000 1100 (12)
@R0 = 0000 0000 0000 0000 (0)
@R2 = 0000 0000 0000 0010 (2)
@INFINITE_LOOP = 0000 0000 0000 1110 (14)

How/why does the built-in assembler choose these specific values when assembling these commands?
Reply | Threaded
Open this post in threaded view
|

Re: Performing @ Command Conversion for Non-Numerics?

cadet1620
Administrator
Study section 6.3.5 carefully. It says how this works.

Pass 1 learns the ROM addresses for all the (LABEL) commands.

Pass 2 uses those learned values to determine if an @NAME command refers to a code label or a RAM address. 6.3.5 tells you how to assign RAM addresses.

--Mark