Index ¦ Archives

Programming C64 Basic on Android

Write C64 Basic programs on your android device. Convert text files to basic in prg format.

Hack basic for C64

The c64 keyboard has some special keys:

  • key ↑ = ^

Cross-compile bastext

git clone https://github.com/dcrasch/bastext
  • 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 bastext
make
cd ~
cat /sdcard/Download/bastext > bastext
chmod 755 dasm

Configure DroidEdit

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

Install Commodore 64 emulator

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

Alternatives

Small graphics program example c64 programmers reference page 126

2 print chr$(147)
5 base=2*4096:poke53272,peek (53272)or8
10 poke53265,peek(53265)or32
20 fori=basetobase+7999:poke i,0:next
50 forx=0to319step.5
60 y=int(90+80*sin(x/10))
70 ch=int(x/8)
80 ro=int(y/8)
85 ln=yand7
90 by=base+ro*320+8*ch+ln
100 bi=7-(xand7)
110 pokeby,peek(by)or(2^bi)
120 nextx
110 poke1024,16
130 goto130

Don't forget to add a empty last line. lines in basic are always closed with a newline.

More code in my c64 github repository.

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