Jump to content
IGNORED

Problems creating my first ASM program


samishal

Recommended Posts

Dear all,

 

First off, Merry Christmas, I hope you all eat as much food as you can and sleep for the rest of the day, I know I will :)

 

Anyway, I have madea little helloworld program however it will not assemble and obviously wont run, I have been using the classic99 emualtor for this and after I can get one or two programs to work on there I'll move onto my real iron system lol.

 

Here is the program :

 

 

 

             REF VMBW
MYREG BSS >20
ADDR1  TEXT 'HELLO WORLD'
BEGIN   LWPI MYREG
             LI R0,102
             LI R1,ADDR1
             LI R2,12
             BLWP @VMBW
             JMP $

 

Also, is it possible to write a program in a text editor and save to to the right folder and then assemble it in the classic99 program or must it always be typed through the program?

 

Samishal

 

Merry Xmas!!!

Link to comment
Share on other sites

Dear all,

 

First off, Merry Christmas, I hope you all eat as much food as you can and sleep for the rest of the day, I know I will :)

 

Anyway, I have madea little helloworld program however it will not assemble and obviously wont run, I have been using the classic99 emualtor for this and after I can get one or two programs to work on there I'll move onto my real iron system lol.

 

Here is the program :

 

 

 

Add this...

 

DEF BEGIN

 

as the first instruction and

 

END BEGIN

 

as the last

 

 

 

		  REF VMBW
MYREG BSS >20
ADDR1  TEXT 'HELLO WORLD'
BEGIN   LWPI MYREG
		  LI R0,102
		  LI R1,ADDR1
		  LI R2,12
		  BLWP @VMBW
		  JMP $

 

Also, is it possible to write a program in a text editor and save to to the right folder and then assemble it in the classic99 program or must it always be typed through the program?

 

Samishal

 

Merry Xmas!!!

Link to comment
Share on other sites

I removed the 'r' from the register calls, is that just for the emualtor that I have to remove the r's or is it for the real thing as well?? Also after assembling the program how do I run it?

 

Samishal

 

For the real thing as well!

But there is an option that I forgot when running the assembler (letter L ??) to make it accept R7 instead of 7.

Tu run it then, just select "RUN" in the menu and type BEGIN as program name (if you have inserted DEF BEGIN)

 

Guillaume.

Link to comment
Share on other sites

I removed the 'r' from the register calls, is that just for the emualtor that I have to remove the r's or is it for the real thing as well?? Also after assembling the program how do I run it?

 

Samishal

 

When assembling, on the line "OPTIONS?", just answer R and you'll be able to use R0 - R15 instead of 0 - 15.

(E/A manuel, page 34)

 

Guillaume.

  • Like 1
Link to comment
Share on other sites

Looks like you are getting good help here, but I wanted to note that I did post a step-by-step assembly 'hello world' using Classic99. It's lost somewhere here on the forum but I can relink it here: http://harmlesslion.com/gtwo/v/Projects/tiea/01_G.png.html

 

Make sure to view the full size images, and there is step-by-step with screenshots. A gallery probably isn't the best interface for that, but maybe it's useful. :)

 

That covers typing it in through the E/A. You /can/ use windows text files, if you like. By default, to make Classic99 understand that it is a text file, it must have a .TXT or .OBJ extension -- in your case .TXT makes more sense. You must also use the extension on the TI side. So, for instance, if you save your file as C:\Classic99\DSK1\SOURCE.TXT, then when you load the assembler, your source filename is DSK1.SOURCE.TXT (and the rest as normal).

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

Insert the command EVEN after the text definition. Your text is 11 bytes, and instructions must start at even addresses.

 

Inserting EVEN after BYTE and TEXT directives is probably a good habit, but machine instructions (this case) or DATA directives immediately following BYTE and TEXT directives are always started on even addresses.

 

...lee

Link to comment
Share on other sites

Depends on the assembler. Win994a has certain instances where it gets it wrong. I can't remember the specifics right off my head, but it is documented in this forum (we have discussed this before and I know I posted at least one example somewhere).

 

I do wish things were easier to find. When I am starting from scratch, it often takes a discouragingly long time to get the information I am looking for even when I am reasonably sure it is there. Thanks for the information, especially since I am thinking of soon embarking upon a rather ambitious assembly project.

 

...lee

Link to comment
Share on other sites

Let me see if I can find it. The "assembly my way" thread I stared would be my first guess.

 

Here, starting about post #36:

 

http://www.atariage.com/forums/topic/159642-assembly-guidance/page__st__25#entry1970943

 

I agree with you about finding stuff. I like a forum format for allowing a topic to be discussed without noise from other topics, but it lacks an index. Hmm, the "next big thing" in form frameworks, auto indexes and auto topic summarizing. You heard it here first. :-)

 

Edited by matthew180
Link to comment
Share on other sites

 

Here is your exemple with the GNU assembler. It does not automatically add EVEN directives.

But it's open source, you could add your GPU instructions.

 

GAS LISTING test.asm 			page 1


  1               		DEF	MAIN
  2 0000 01        	VAR1	BYTE	1
  3               	
  4               	MAIN
  5               	TEST	EQU	ND-ST
  6 0001 0200 000B 		LI	r0,TEST
  7 0005 1000      		JMP	$
  8               	
  9 0007 4845 4C4C 	ST	TEXT	'HELLO WORLD'
  9      4F20 574F 
  9      524C 44
 10               	ND	END
GAS LISTING test.asm 			page 2


DEFINED SYMBOLS
           test.asm:4      .text:00000001 MAIN
           test.asm:2      .text:00000000 VAR1
           test.asm:4      *ABS*:0000000b TEST
           test.asm:10     .text:00000012 ND
           test.asm:9      .text:00000007 ST

NO UNDEFINED SYMBOLS

Link to comment
Share on other sites

Let me see if I can find it. The "assembly my way" thread I stared would be my first guess.

 

Here, starting about post #36:

 

http://www.atariage....25#entry1970943

 

I agree with you about finding stuff. I like a forum format for allowing a topic to be discussed without noise from other topics, but it lacks an index. Hmm, the "next big thing" in form frameworks, auto indexes and auto topic summarizing. You heard it here first. :-)

 

Thanks! I had not thought about the byte-counting consequences of TI E/A's forcing the even-byte boundary on machine instructions and DATA directives and I certainly was unaware of the mistaken alignment of those by other assemblers.

 

...lee

Link to comment
Share on other sites

Okay, I'll bite! :-) what's the project?

 

The project is hoisting TI Forth into cartridge ROM to be functionally equivalent to the current version. That is actually down the road from (1) annotating the assembly source for TI Forth and (2) detailing how to produce a working system from that source, which, of course, are necessary excercises to enable me to even think about the project. If I manage to complete all this, I might then attempt a version upgrade to use normal file I/O for Forth screens/blocks and use sector I/O only for reading to convert current TI Forth screens. Ambitious, I know---but, so far, I am having fun!

 

...lee

Link to comment
Share on other sites

Ah! Okay that sounds pretty interesting. Well, when you get around to putting it in a ROM let me know. I have some tools that can make it easier for you and I can give you some advice re ASM994A - I have used it for Turboforth since day 1 with no issues at all.

 

There's a bit of a Forth renaissance at the moment in our little 4A world. All good!

 

Mark

Link to comment
Share on other sites

Thanks! I had not thought about the byte-counting consequences of TI E/A's forcing the even-byte boundary on machine instructions and DATA directives and I certainly was unaware of the mistaken alignment of those by other assemblers.

 

...lee

 

Machine instructions and word-based (16-bit) instructions (i.e. anything that is *not* one of the 8 byte instructions) will always address memory at even addresses because the 9900 only has a 15-bit address bus. If the assembler messes up and writes the object file with instructions at an odd address, your program will crash in a hurry.

 

IMO, the only time an assembler should force EVEN alignment is when it encounters a machine instruction, otherwise leave it up to the programmer to use BYTE, TEXT, DATA, and EVEN to control where the data goes.

Link to comment
Share on other sites

Ah! Okay that sounds pretty interesting. Well, when you get around to putting it in a ROM let me know. I have some tools that can make it easier for you and I can give you some advice re ASM994A - I have used it for Turboforth since day 1 with no issues at all.

 

There's a bit of a Forth renaissance at the moment in our little 4A world. All good!

 

Mark

 

Thanks! I certainly knew I could count on you, as well as Matthew and Retroclouds!

 

...lee

Link to comment
Share on other sites

You're right about the EVEN directive being redundant in many cases with TI's assembler software. It's only if you do something like this

 

EVEN

BYTE 1

XYZZY

DATA 112

 

Then the label XYZZY will not have the value of the address of the DATA (112), but one byte less.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...