xbox-scene.com - your xbox news information source
Quick Links: Main Forums | Xbox360 Forums | Xbox1 Forums | PS3 Forums
Xbox-Scene Forum Help  Search Xbox-Scene Forums   Xbox-Scene Forum Members   Xbox-Scene Calendar

Giganews Usenet Offers: +1150 days binary retention, 99%+ Completion, and Unlimited Speed/Access!

360 ODD Emulators: X360 Key $99 | Wasabi360 FAT $99 | Wasabi360 Slim $99
C4E's iXtreme Burner MAX Drive: LiteOn iHAS124 DROPPED TO JUST $17


Welcome Guest ( Log In | Register )

> Canonic Assembler
openxdkman
post Apr 10 2007, 01:35 PM
Post #1


X-S Genius
****

Group: Moderator
Posts: 822
Joined: 2-August 06
Member No.: 292548
Xbox Version: unk
360 version: unknown



Minidash (and probably other independant software) will be able to relocate, pre-process and execute programs written in canonic assembler.

What's that?

In mathematics, 'canonic' means 'simplest' (can't reduce it more).
Main interest of canonic assembler is to allow to write interpreted code.
The Canonic Engines (interpreters) are easy to implement quickly.
You lose speed (10 up to 100 times slower than compiled native code), but you save research & development time, especially when you are trying to design a driver on a recently hacked environment, because you just need... notepad. Micro-codes uploaded in co-processors are NOT slowed down...
Relocation and symbol pre-processing is performed directly from text file.

Rules:
1 instruction per line
1 character per instruction name
1 operand per instruction

Here is the syntax details (kept voluntarily short) :
http://minilgos.perso.sfr.fr/minidash/casyntax.txt

It may still evolve (but I doubt). I'm currently studying xbox360 homebrew to see if it needs adjustments (probably some 32 bits aliases for the 128 bits port addresses).
(and when the current 'curse' gets lifted from the PS3 scene, I will examine PS3 homebrew too...)

A very clean "hello world" program would look like this :

CODE

02,1+1
//reserve space for 2 labels, 1 local and 1 global

//global register (stores line number in debug mode)
$$g_line

//unified api functions IDs
$$print=6

//code entry point
@@main=0

@msg
    S'Hello world'
    S'0d
    S'0a
    S'0

//activate debug mode 1 from here
~~1

@main
    $
    $ret
    "msg
    #print
    L!0
    Sret
    Rret

//turns off debug mode
~~0



A smaller but dirtier version would look like this :

CODE

02,0+0
@main
    "msg
    #6
    R!0
@msg
    S'Hello world'
    S'0


More samples (ogg vorbis decoder, already tested successfully on pc0) and more explanations will come when Minidash v0.1 will be released...

This post has been edited by openxdkman: Mar 28 2009, 10:49 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topic
Replies
openxdkman
post Apr 13 2007, 05:06 PM
Post #2


X-S Genius
****

Group: Moderator
Posts: 822
Joined: 2-August 06
Member No.: 292548
Xbox Version: unk
360 version: unknown



Here is a program that calls printf and draws a sinus function (fpu used).
There are plenty of useless global variables and constants just to show you syntax.

CODE

010,10+10
//0N,L+G :10 labels, 10 local registers + 10 global registers
//First char of first line must be '0' in canonic code

//Global macros (max 32500 chars in global macros string at any time)

// Global macros used as registers names:
// Each new pre-processing starts with global macro string "...=<L-1>"
// Next vars will start automatically at value L (see "0N,L+G")
// First global register can receive source line at run time for debug
// Second and third global register can be used as references as well
$$g_line,g_compare1,g_compare2
$$g_table[16]
$$g_last_global

// Global macros used as constants:
$$PI=!3.14159f
$$TABLE_SIZE=32

// Global macros used as unified api function IDs
$$plot=0,hline,vline,dline,rline
$$printf,print
$$malloc,free,calloc,realloc,ext_ram_left
$$comp,copy,clear,scanb,scanw,scanl
$$read_input,write_output,seek_input,seek_output,tell_input,tell_output
$$dbgprintline,dbgcheckram,dbgcompequ,dbgcomplt
$$getch
$$mdct,iwin,awin,convsamp

$$finit=61440
$$f2xm1,fabs,fchs,fpatan,fprem,fptan,frndint
$$fscale,fxtract,fsqrt,fxch,fyl2x,fyl2xp1
$$fld1,fldl2t,fldl2e,fldpi,fldlg2,fldln2,fldz
$$fsin,fcos,fsincos

// Global macros used as structures members offsets:
$$my_struct_first_member=!0
$$my_struct_dwords_table[TABLE_SIZE]
$$my_struct_size
$$my_2nd_struct_first_member=%0
$$my_2nd_struct_shorts_table[TABLE_SIZE]
$$my_2nd_struct_size

//Labels (max 32500 chars in labels macros string at any time)
@@main=0
//Compels incoming label 'main' to have value zero (code entry point)
//(allows you to put 'main' function code at bottom of file)

//Constant strings
@msg
S'Hello world %ld %04lx %s'
S'0a
S'0d
S'0
@name
S'<name>'
S'0

//let's ask for debug information (0=none, 1=report g_line)
~~1

////////
//main//
////////

@main
    $
    $ret,i,p1,p2,p3,x,y,c,fi

    Pp1
    L!7d7
    Sp1
    L!babe
    Sp2
    "name
    Sp3
    "msg
    #printf

    #finit

    L!0
    Si
@loop
        Li
        +!200
        Sx
    
        .
        Li
        sfi
        
        #fldpi
        *fi
        /!64.0
        #fsin
        *!-10.0
        +!384.0
        Sy
                
        L!0
        Sc

        Px
        #plot
    
        Li
        +!1
        Si
        <!100
        Tloop

    L!0
    Sret
    Rret

//turns off debugging mode (faster execution for code after this line)
~~0

//keyboard scancodes for getch
//0x01 escape
//0x1c enter
//0x39 space
//0xc8 up
//0xd0 down
//0xcb left
//0xcd right


This post has been edited by openxdkman: Jun 10 2007, 10:04 AM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic
openxdkman   Canonic Assembler   Apr 10 2007, 01:35 PM






Reply to this topicStart new topic

 

Lo-Fi Version Time is now: 23rd May 2013 - 06:54 AM