\ How to make a small 'hello' program. 01Oct88pJa The meta compiler, with a few changes, can be used as an assembler. This file is an example of how to accomplish that. A lot more changes to the Meta compiler are possible, and could be make into a super assembler. It already has high level control structures built in. \ Set up target image buffer and relocation buffer. 07Mar88pJaonly forth also meta also definitions \ warning off 0 dp-t ! 32 1024 * constant tsize forth variable Rbuffer tsize 16+ 16 / allot forth ' Rbuffer is 'Rbuffer 'Rbuffer tsize 16 / erase in-meta : get-target 65536 tsize [ Exec ] AllocMem ?dup 0= [ forth ] abort" not enough memory for target! " 9 4* + ['] target-origin >body ! ; : free-target target-origin 9 4* - tsize [ Exec ] FreeMem ; in-meta get-target \ Some special words for assembling hello. 01Oct88pJa: s" ascii " parse s,-t align-t ; : s0" ascii " parse s,-t 0 c,-t align-t ; -552 constant _openlib -60 constant _output -48 constant _write \ small stand alone hello program. 01Oct88pJaassembler label start-t 0 #) jmp <rel label dosname s0" dos.library" label message s" Hello in AmigaLand" 10 c,-t 0 c,-t here message - constant message-length here start-t 2+ !-t 4 #) a6 move dosname >pcd) a1 lea _openlib a6 d) jsr d0 tst 0<> if d0 a6 move _output a6 d) jsr d0 d1 move 0<> if message # d2 move <rel message-length # d3 move _write a6 d) jsr then then 0 d0 moveq rts in-meta \ How to make a small 'hello' program. 01Oct88pJa And when it's Meta compiled (assembled?) you will have to do the same as when you Meta compile the system. that is: Save-target small free-target bye And 'small' will indeed be that. A good idea would be to check for unresolved forward references,the same kind of stuff that is on screen 3 of Akernel.blk \ Set up target image buffer and relocation buffer. 08Mar88pJaThis screen is direct copy of Akernel.blk. The size could be changed. Target dictionary pointer starts at 0, no offset. Target image buffer size, 'tsize', currently 32k and enough. Rbuffer is a bit array for relocation information. The Meta word 'Rbuffer points to this buffer get-target Gets a tsize'd hunk of memory, to use as target image, if available. Sets the 'target-origin' to the address +36 bytes. These are used for a header when saving. free-target Returns the hunk of memory, must free it or the Amiga will loose the use of that hunk until next reset. \ Some special words for assembling hello. 01Oct88pJas" compiles a string, no size or trailing null. s0" compiles a string, no size with trailing null. _openlib some rom call offsets used _output _write \ small stand alone test program 01Oct88pJajump vector past all the strings each string has a label after message, I put a line feed, and a zero to end message. And then the routine, doesn't do much. final note the constant stays in the assembler voc. And that's how a stand alone is created in assembler. Many wordsto help assembly can be made in Meta to ease the pain.