Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: AngelFish on October 15, 2010, 04:09:38 pm

Title: SPASM
Post by: AngelFish on October 15, 2010, 04:09:38 pm
I was trying to get SPASM to run on my computer yesterday and I couldn't figure out how to get .8xp files from it. All I can get are .bin files. Do you have to use the command prompt to run SPASM in Windows?
Title: Re: SPASM
Post by: qazz42 on October 15, 2010, 04:10:32 pm
You need either binpac or devpac to transform the .bins into .8xps

they work the same way as SPASM, as in you run them from the cmd

so

SPASM myprog.asm

binpac.py myprog.bin

(binpac need python btw)
Title: Re: SPASM
Post by: BuckeyeDude on October 15, 2010, 04:11:37 pm
yes you do. if you are vista or greater its pretty easy to get cmd up and running, i can walk you through it. Or you can use a bat file to do the dirty work. the syntax is:
spasm [options] program.asm program.8xp
Title: Re: SPASM
Post by: AngelFish on October 15, 2010, 04:12:48 pm
Devpac? Isn't SPASM the Assembler?
Title: Re: SPASM
Post by: BuckeyeDude on October 15, 2010, 04:13:47 pm
You dont need either of those. spasm has a built in linker that makes them uncessary
Title: Re: SPASM
Post by: AngelFish on October 15, 2010, 04:16:22 pm
yes you do. if you are vista or greater its pretty easy to get cmd up and running, i can walk you through it. Or you can use a bat file to do the dirty work. the syntax is:
spasm [options] program.asm program.8xp

This might be a stupid question, but is the bat a batch file? Also, is the "spasm" part is the location of the SPASM executable in the computer?
Title: Re: SPASM
Post by: BuckeyeDude on October 15, 2010, 04:19:33 pm
yes and yes. you can do one of three things.
1. put spasm in the same directory as your source file
2. put spasm in the PATH variable and you can use it wherever you want
3. use relative paths to tell where spasm and the source file are

I personally reccommend #2, which is a little bit harder to setup, but very convenient. A batch file is good because you dont have to keep the command line up and running all the time, and its very easy for anyone to assemble your code
Title: Re: SPASM
Post by: AngelFish on October 15, 2010, 04:24:44 pm
Okay, how would you set up and run the Batch file?

 If I have to ask this, I'm probably not a good candidate for an ASM coder... ;)
Title: Re: SPASM
Post by: DJ Omnimaga on October 15, 2010, 04:26:35 pm
Btw SPAM is against the forum rules... oh wait, you meant SPASM. Nvm. :P

As for batch files you open Notepad, put the batch code there, save as txt, then rename the extension as .bat and simply run the .bat file. You can also save as .bat from Notepad but on some computers, even if you selected all files instead of plain text, it saves the file as name.bat.txt. X.x
Title: Re: SPASM
Post by: BuckeyeDude on October 15, 2010, 04:26:54 pm
Nah its something you learn in time. Normally my batch files look something like this:
Code: [Select]
spasm -T -L Pokemon.asm Pokemon.8xk
wabbitemu Pokemon.8xk Pokemon.lab
Title: Re: SPASM
Post by: AngelFish on October 15, 2010, 04:45:34 pm
Hm, I think I'm doing this wrong.

Here's what I wrote in the batch:

Code: [Select]
C:\Users\username\Desktop\Calc programs\SPASM.exe C:\Users\username\Desktop\Calc programs\Hello World.txt C:\Users\username\Desktop\Calc programs\Hello World.8xp
Also, running it by clicking it doesn't do anything.
Title: Re: SPASM
Post by: BuckeyeDude on October 15, 2010, 04:47:08 pm
You need quotes around the paths, because they have spaces in them
Code: [Select]
"C:\Users\username\Desktop\Calc programs\SPASM.exe" "C:\Users\username\Desktop\Calc programs\Hello World.txt" "C:\Users\username\Desktop\Calc programs\Hello World.8xp"
Title: Re: SPASM
Post by: TC01 on October 15, 2010, 04:48:01 pm
This is a slightly more complicated batch file I use, that prompts you for the files to compile when it runs- and therefore can be used for all your projects.

Code: [Select]
@echo off
title SPASM - TI-83 Plus Assembler
:main
set /p source=Source file:
set /p output=Output name:
echo.
echo Assembling %source% into %output%
spasm.exe Source\%source% Output\%output%
echo.
pause
set /p again=Assemble another file [y/n]:
if %again%==y goto main

It relies on having a Spasm working directory set up like this though:

Code: [Select]
\spasm.bat
\spasm.exe
\ti83plus.inc
\Source\
\Output\

I then have a shortcut to this batch file on my desktop, which I can run without using a command line.
Title: Re: SPASM
Post by: qazz42 on October 15, 2010, 04:50:31 pm
wait, spasm is a .bin to .8xp converter too?
Title: Re: SPASM
Post by: BuckeyeDude on October 15, 2010, 04:54:14 pm
wait, spasm is a .bin to .8xp converter too?
Nope i'm just lying to get more people to use it :P
Title: Re: SPASM
Post by: AngelFish on October 15, 2010, 04:55:03 pm
Okay, the quotation marks fixed it. I'm getting a .8xp files now. Unfortunately, the Hello World program I cut and pasted from ASM 28 days for a test is returning an ERR: Invalid in WabbitEmu. Does SPASM use the same syntax as TASM?
Title: Re: SPASM
Post by: BuckeyeDude on October 15, 2010, 04:57:43 pm
yes it does. add a pause at the end of bat file to make sure you dont have any errors
also here is some code that im pretty sure will work:
Code: [Select]
#include "ti83plus.inc"
.org $9d93
.db 0BBh, 06Dh
 ld hl,0
 ld (CurRow),hl
 ld hl,String
 bcall(_PutS)
 ret
String:
.db "Hello World",0
Also i dont know where your ti83plus.inc file came from but the official spasm one is here:
http://wabbit.codeplex.com/wikipage?title=SPASM%20Include%20Files&referringTitle=Documentation (http://wabbit.codeplex.com/wikipage?title=SPASM%20Include%20Files&referringTitle=Documentation)
Title: Re: SPASM
Post by: AngelFish on October 15, 2010, 05:04:22 pm
AH, there we go. Thanks a lot :)
Title: Re: SPASM
Post by: Deep Toaster on October 15, 2010, 05:09:16 pm
By the way, does Spasm compile for TI-83s? I tried
Code: (ASM) [Select]
#include ti83.inc
.org $9D95
ret
then linked it with DevPac83, then sent it to a Wabbit 83. It didn't run, even though I used the weird Send(9prgmNAME syntax.

EDIT: Btw, how do you link it with Spasm?
Title: Re: SPASM
Post by: BuckeyeDude on October 15, 2010, 05:12:32 pm
yes. binaries are binaries, spasm compiles z80 assembly code. The code you posted is so exceptionally complex though so it could have serious issues :P and as i mentioned the other day you wont want to start at $9D95 when you actually get around to doing anything with absolute offsets. I dont have time to look into it right now though sorry
Title: Re: SPASM
Post by: Deep Toaster on October 15, 2010, 05:15:31 pm
Quote from: BuckeyeDude
and as i mentioned the other day you wont want to start at $9D95 when you actually get around to doing anything with absolute offsets.

Whoops.

Maybe I'm using an old version of DevPac, then. I'll try again later.