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
cd android-ndk-r10d
./build/tools/ --arch=arm --install-dir=/tmp/android --platform=android-16
# or for x86 intel ./build/tools/ --arch=x86 --install-dir=/tmp/android --platform=android-16
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
# or for i686 CC=/tmp/android/bin/i686-linux-android-gcc
  • Make dasm
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


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
    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.