
Kevin> bof, de tte façon j'ai jamais mis de ":" après mes labels, ça oblige a déplacer la main pour appuyer sur la touche, c trop fatiguant



Kevin Kofler a écrit :
Raaah! C'est quand même mieux d'utiliser un compilateur libre...
sBibi a écrit :
et ça a koi de mieux pt de vue perfs?
sBibi
a écrit : a moins que je doive payer le pas libre
PpHd a écrit :
>- déclaration de variables au plein milieu d'une fonction
>- déclaration de variables dans l'entête d'une boucle for
ben il supporte le c++ alors
; GP32 Startup Boot Code
CODE32
AREA Init, CODE, READONLY
IMPORT |Image$$RO$$Base|
IMPORT |Image$$RO$$Limit|
IMPORT |Image$$RW$$Base|
IMPORT |Image$$RW$$Limit|
IMPORT |Image$$ZI$$Base|
IMPORT |Image$$ZI$$Limit|
; HEADER of the file
ENTRY
B _GpInit
DCD |Image$$RO$$Base| ; Start of Read Only section
DCD |Image$$RO$$Limit| ; End "
DCD |Image$$RW$$Base| ; Start of Read/Write section
DCD |Image$$RW$$Limit| ; End "
DCD |Image$$ZI$$Base| ; Base of Zero Initialized section
DCD |Image$$ZI$$Limit| ; End "
DCD 0x44450011 ; Magic numbers ?
DCD 0x44450011
DCD 0x01234567
DCD 0x12345678
DCD 0x23456789
DCD 0x34567890
DCD 0x45678901
DCD 0x56789012
DCD 0x23456789
DCD 0x34567890
DCD 0x45678901
DCD 0x56789012
DCD 0x23456789
DCD 0x34567890
DCD 0x45678901
DCD 0x56789012
; IMPORT main
; IMPORT GenInit
_GpInit
stmfd sp!,{r0-r12,lr}
bl GenInit
bl main
ldmfd sp!,{r0-r12,pc}
; END
; On se place en Read Write pour pouvoir acceder plus rapidement aux variables globales
; Sans indirection supplementaire
; CODE32
; AREA Generic, CODE, READWRITE
; EXPORT GenInit
; EXPORT SwapBuffer
; EXPORT Synchro
; EXPORT GetScreen
GenInit
; Save Lr
mov r11,lr
; Get pointer to GpSurfaceSet routine
mov r0,#0
swi 0xb
str r0,SurfaceSet
; Get time passed
mov r0,#6
swi 0xb
str r0,Timer
ldr r0,[r0]
str r0,OldTime
; 16-bits mode
mov r0,#16
mov r1,#0
mov r2,#0
swi 8
; Allocate 2 DrawSurface
ldr r0,AdrSurface1
mov r1,#0
mov r2,#1
swi 8
ldr r0,AdrSurface2
mov r1,#1
mov r2,#1
swi 8
; Set Current Displayed Surface
ldr r0,AdrSurface1
ldr r1,SurfaceSet
mov lr,pc ; Y'a pas a dire l'arm
mov pc,r1 ; C'est special !
; Set Current Working Screen
ldr r0,AdrSurface2
ldr r0,[r0] ; Ptr is the first one
str r0,Screen
mov pc,r11 ; Return
SwapBuffer
ldr r1,=AdrSurface1
ldr r0,Flip ; Current Flip
ldr r2,[r1,r0] ; Read current working DrawSurface
eor r0,r0,#4 ; Swap Surface
ldr r2,[r2] ; Read Screen
str r0,Flip ; Save Flip value
str r2,Screen ; Save current working screen
ldr r2,SurfaceSet ; Read Surface Set function
ldr r0,[r1,r0] ; Read current displayed adress
mov pc,r2 ; Jump to surface set
Synchro
ldr r2,Timer ; Read Timer
ldr r1,OldTime ; Read old Time
add r1,r0,r1 ; Get new time
Loop
ldr r0,[r2]
cmp r0,r1
bls Loop
mov pc,lr
GetScreen
ldr r0,Screen
mov pc,lr
DrawSurface1 DCD 0,0,0,0,0,0,0
DrawSurface2 DCD 0,0,0,0,0,0,0
AdrSurface1 DCD DrawSurface1
AdrSurface2 DCD DrawSurface2
Flip DCD 0
Screen DCD 0
SurfaceSet DCD 0
Timer DCD 0
OldTime DCD 0
; END
; CODE32
; AREA Program, CODE, READONLY
; EXPORT main
; IMPORT GetScreen
; IMPORT SwapBuffer
main
bl GetScreen
mov r3,#0
mainloop ldr r2,=320*240/64
loop strh r3,[r0],#2
subs r2,r2,#2
bne loop
add r3,r3,#1
cmp r3,#32*2
bne mainloop
bl SwapBuffer
Stop b Stop
END
; GP32 Startup Boot Code
CODE32
AREA Init, CODE, READONLY
IMPORT |Image$$RO$$Base|
IMPORT |Image$$RO$$Limit|
IMPORT |Image$$RW$$Base|
IMPORT |Image$$RW$$Limit|
IMPORT |Image$$ZI$$Base|
IMPORT |Image$$ZI$$Limit|
; HEADER of the file
ENTRY
B _GpInit
DCD |Image$$RO$$Base| ; Start of Read Only section
DCD |Image$$RO$$Limit| ; End "
DCD |Image$$RW$$Base| ; Start of Read/Write section
DCD |Image$$RW$$Limit| ; End "
DCD |Image$$ZI$$Base| ; Base of Zero Initialized section
DCD |Image$$ZI$$Limit| ; End "
DCD 0x44450011 ; Magic numbers ?
DCD 0x44450011
DCD 0x01234567
DCD 0x12345678
DCD 0x23456789
DCD 0x34567890
DCD 0x45678901
DCD 0x56789012
DCD 0x23456789
DCD 0x34567890
DCD 0x45678901
DCD 0x56789012
DCD 0x23456789
DCD 0x34567890
DCD 0x45678901
DCD 0x56789012
IMPORT main
IMPORT GenInit
_GpInit
stmfd sp!,{r0-r12,lr}
bl GenInit
bl main
ldmfd sp!,{r0-r12,pc}
END
; On se place en Read Write pour pouvoir acceder plus rapidement aux variables globales
; Sans indirection supplementaire
CODE32
AREA Generic, CODE, READWRITE
EXPORT GenInit
EXPORT SwapBuffer
EXPORT Synchro
EXPORT GetScreen
GenInit
; Save Lr
mov r11,lr
; Get pointer to GpSurfaceSet routine
mov r0,#0
swi 0xb
str r0,SurfaceSet
; Get time passed
mov r0,#6
swi 0xb
str r0,Timer
ldr r0,[r0]
str r0,OldTime
; 16-bits mode
mov r0,#16
mov r1,#0
mov r2,#0
swi 8
; Allocate 2 DrawSurface
ldr r0,AdrSurface1
mov r1,#0
mov r2,#1
swi 8
ldr r0,AdrSurface2
mov r1,#1
mov r2,#1
swi 8
; Set Current Displayed Surface
ldr r0,AdrSurface1
ldr r1,SurfaceSet
mov lr,pc ; Y'a pas a dire l'arm
mov pc,r1 ; C'est special !
; Set Current Working Screen
ldr r0,AdrSurface2
ldr r0,[r0] ; Ptr is the first one
str r0,Screen
mov pc,r11 ; Return
SwapBuffer
ldr r1,=AdrSurface1
ldr r0,Flip ; Current Flip
ldr r2,[r1,r0] ; Read current working DrawSurface
eor r0,r0,#4 ; Swap Surface
ldr r2,[r2] ; Read Screen
str r0,Flip ; Save Flip value
str r2,Screen ; Save current working screen
ldr r2,SurfaceSet ; Read Surface Set function
ldr r0,[r1,r0] ; Read current displayed adress
mov pc,r2 ; Jump to surface set
Synchro
ldr r2,Timer ; Read Timer
ldr r1,OldTime ; Read old Time
add r1,r0,r1 ; Get new time
Loop
ldr r0,[r2]
cmp r0,r1
bls Loop
mov pc,lr
GetScreen
ldr r0,Screen
mov pc,lr
DrawSurface1 DCD 0,0,0,0,0,0,0
DrawSurface2 DCD 0,0,0,0,0,0,0
AdrSurface1 DCD DrawSurface1
AdrSurface2 DCD DrawSurface2
Flip DCD 0
Screen DCD 0
SurfaceSet DCD 0
Timer DCD 0
OldTime DCD 0
END
CODE32
AREA Program, CODE, READONLY
EXPORT main
IMPORT GetScreen
IMPORT SwapBuffer
main
bl GetScreen
mov r3,#0
mainloop ldr r2,=320*240/64
loop strh r3,[r0],#2
subs r2,r2,#2
bne loop
add r3,r3,#1
cmp r3,#32*2
bne mainloop
bl SwapBuffer
Stop b Stop
END