You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.0 KiB

  1. # Using MacOSX means you have some difficulty running MASM (for obvious reasons)
  2. # here's a shell script which helped me to run masm code through wine
  3. export WINE_MASM_DIR=~/wine-masm
  4. function masm() (
  5. # Stop on errors
  6. set -e
  7. # Use the correct wine directory
  8. export WINEPREFIX=$WINE_MASM_DIR
  9. # Get the path to the file without a .asm extension
  10. FILENAME="$(basename "$1")"
  11. EXTENSION="${FILENAME##*.}"
  12. shopt -s nocasematch # String case-insensitive comparison
  13. if [[ "$EXTENSION" = "asm" ]]; then
  14. FILENAME="${FILENAME%.*}" # Remove extension
  15. fi
  16. UNIX_PATH="$(dirname "$1")/$FILENAME"
  17. # Convert forwards slashes into backslashes
  18. WINDOWS_PATH=$(echo "$UNIX_PATH" | tr '/' '\')
  19. # Assemble file
  20. wine ml -nologo -c -coff -Zi "$WINDOWS_PATH.asm"
  21. # Link files
  22. wine link /NOLOGO /SUBSYSTEM:CONSOLE /ENTRY:main \
  23. /LIBPATH:'C:\masm32\lib' \
  24. ca296.lib kernel32.lib user32.lib "$WINDOWS_PATH.obj"
  25. # Run the linked executable
  26. wine "$WINDOWS_PATH.exe"
  27. )