Index ¦ Archives

C64 programming on a Android device

Write C64 assembler on your android device

Hack the planet for C64

Cross-compile dasm

  • Download the Android Native Development Kit for your os (windows 32-bit or 64-bit, macosx 32-bit or 64-bit, linux 32-bit or 64-bit)
  • Install the kit for native android development
  • Check if there are no spaces in de path, otherwise the toolchain scripts won't work.
  • Run the make-standalone-toolchain for android-16 for:
    • arch=arm for most phones
    • arch=i686 for some tablets
chmod a+x android-ndk-r10d-darwin-x86_64.bin
./android-ndk-r10d-darwin-x86_64.bin
cd android-ndk-r10d
./build/tools/make-standalone-toolchain.sh --arch=arm --install-dir=/tmp/android --platform=android-16
# or for x86 intel ./build/tools/make-standalone-toolchain.sh --arch=x86 --install-dir=/tmp/android --platform=android-16
wget http://sourceforge.net/projects/dasm-dillon/files/dasm-dillon/2.20.11/dasm-2.20.11-2014.03.04-source.tar.gz
tar xvzf dasm-2.20.11-2014.03.04-source.tar.gz
cd dasm-2.20.11-20140304/src
  • Edit the Makefile to enable Position Independ Executable compiling for latest devices
CC=/tmp/android/bin/arm-linux-androideabi-gcc  
# or for i686 CC=/tmp/android/bin/i686-linux-android-gcc
CFLAGS=-fPIE
LDFLAGS=-fPIE -pie
  • Make dasm
make
cd ~
cat /sdcard/Download/dasm > dasm
chmod 755 dasm
  • Goto Settings... -> HOME folder, select and copy the text the path /data/data/jackpal.androidterm/app_HOME (for easy copy past in the next step)

Configure DroidEdit

  • Download DroidEdit
  • Run DroidEdit
  • settings... -> External command
  • Add external command
  • Name: assemble
  • Command: /data/data/jackpal.androidterm/app_HOME/dasm ${path}/${file} -o${path}/${name}.prg
  • Result action: Show results

Install Commodore 64 emulator

  • install Frodo C64 or other c64 emulator
  • select disk .prg
  • view result

Alternatives

Small hello world program

    .processor 6502 
    .org $801
    .hex 0c08 0000 9e32 3036 3100 0000 ; basic start header

    jsr $e544   ;clear the screen
    ldx #$00;
loop    lda message,x
    jsr $ffd2 ;print the character
    inx
    cpx #$10 ;break loop after 16 characters decimal or 10 hex
    bne loop
    rts ;return from subroutine


message .byte "HACK THE PLANET!"

More code in my c64 github repository.

© David Rasch. ipv6 ready http2 ready Built using Pelican. Theme by Giulio Fidente on github.