flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > High Level Languages > Android C4Droid, TinyCC, Notepad++. Examples

Thread Post new topic Reply to topic

Joined: 25 Dec 2014
Posts: 254

Android C4Droid, TinyCC, Notepad++. Examples

My TinyCC distribution + 3 Examples. Setup:

* Run command prompt. Drag EXAMPLE.BAT into console and press ENTER
* To re-compile+run again in the console, press UP then ENTER. In the terminal, UP/DOWN selects previous commands

TCC with Notepad++, free lightweight text editor. Open .C/PP/H with.


Android C4Droid. Download from Android Store. Get plugins GCC and SDL.

* 2 respected C/C++ compilers: TCC (TinyC+uCLibc), GCC + Bionic. Preferences > Select Compiler
* Outputs native code, SDL1/2, QT, OpenGL, NativeActivity
* Easy IDE. Classic console theme. Preferences > Theme, Colors. Multiple document support (MDI). Preferences > Tabs above

My Android phones:

SDL example:


#include <stdio.h>
#include <SDL.h>

typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned uint;

#define WIDTH 640
#define HEIGHT 480

SDL_Surface *screen, *image;
SDL_Event event;  
byte *keys_p;
int running=1;

int set_video();
void draw_screen();
int lock_screen();
void unlock_screen();

#define get_event() SDL_PollEvent(&event)
#define show_screen() SDL_Flip(screen)  

int set_video() {
  if (SDL_Init(SDL_INIT_VIDEO)<0)
    return 0;
  if (!screen) {
    return 0;
  return 1;

int lock_screen() { 
  if (SDL_MUSTLOCK(screen))
    if (SDL_LockSurface(screen)<0)
      return 0;
  return 1;
void unlock_screen() { 
  if (SDL_MUSTLOCK(screen))

void draw_pixels() { 
  int xy
  uint *p;
  if (!lock_screen())
  for (y=0; y<screen->h; y++) {
    for (x=0; x<screen->w; x++) {
      p=(uint*) screen->pixels+

void end_video() {

int load_image() {
  if (!image)
    return 0;
  return 1;

int image_ximage_y;
SDL_Rect screen_boximage_box;

void draw_image() {
  SDL_BlitSurface(image, &image_box,
    screen, &screen_box);

void destroy_image() {

void draw_screen() {
  // draw_image();
int handle_events() {
  int key;
  while (get_event()) {      
    if (event.type==SDL_KEYDOWN) {
      if (key==SDLK_LEFT)
      if (key==SDLK_RIGHT)
      if (key==SDLK_UP)
      if (key==SDLK_DOWN)
      return 1;
    else if (event.type==SDL_QUIT) {
  return 1;

int main(int nachar *as[]) { 
  if (!set_video())
    return 1
// if (!load_image())
//   return 1;
  while (running) {
// destroy_image();
  return 0;

Post 15 Mar 2015, 05:27
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  

< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2017, Tomasz Grysztar.