spookyln
Member
hi, coz i able to write on stdout with no problem in asm.
today i make next step. writing to FB.
but with no luck, Segmentation Fault is my second name
please check my code and help me with this.
CODE
format ELF executable
use32
entry start
segment readable executable
start:
; open /dev/fb0
mov r0, sMem-$-8
mov r1, 2; = O_RDWR
swi 0x900005; open
mov r6, r0
; mmap
mov r0, 0
mov r1, 0x10000
mov r2, 3
mov r3, 1
mov r4, r6
mov r5, 0xC0000000
stmdb sp!, {r0, r1, r2, r3, r4, r5}
swi 0x90005A;mmap
;add sp, sp, 24
mov r7, r0
mov r1, 0xFFFFFFFF
mov r2, 0
loop:
str r1, [r0, 4]
add r2, r2, 1
cmp r2, 0x12C00 ; 320x240
ble loop
; unmmap
mov r0, r7
mov r1, 0x10000
swi 0x90005B
; close /dev/fb0
mov r0, r6
swi 0x900006; close
;cd /usr/gp2x
add r0,pc,MenuDir-$-8
swi 0x90000c;chdir
;execute gp2xmenu
add r0,pc,MenuCmd-$-8
mov r1,0;arg2 = NULL
mov r2,0;arg3 = NULL
swi 0x90000b;execve
;exit
mov r0,1
swi 0x900001;exit
sMem: db "/dev/fb0"
MenuDir: db '/usr/gp2x'
MenuCmd: db '/usr/gp2x/gp2xmenu'
i have downloaded .pdf manuals but im not good in english.
examples helps me a lot.
thanks
today i make next step. writing to FB.
but with no luck, Segmentation Fault is my second name
please check my code and help me with this.
CODE
format ELF executable
use32
entry start
segment readable executable
start:
; open /dev/fb0
mov r0, sMem-$-8
mov r1, 2; = O_RDWR
swi 0x900005; open
mov r6, r0
; mmap
mov r0, 0
mov r1, 0x10000
mov r2, 3
mov r3, 1
mov r4, r6
mov r5, 0xC0000000
stmdb sp!, {r0, r1, r2, r3, r4, r5}
swi 0x90005A;mmap
;add sp, sp, 24
mov r7, r0
mov r1, 0xFFFFFFFF
mov r2, 0
loop:
str r1, [r0, 4]
add r2, r2, 1
cmp r2, 0x12C00 ; 320x240
ble loop
; unmmap
mov r0, r7
mov r1, 0x10000
swi 0x90005B
; close /dev/fb0
mov r0, r6
swi 0x900006; close
;cd /usr/gp2x
add r0,pc,MenuDir-$-8
swi 0x90000c;chdir
;execute gp2xmenu
add r0,pc,MenuCmd-$-8
mov r1,0;arg2 = NULL
mov r2,0;arg3 = NULL
swi 0x90000b;execve
;exit
mov r0,1
swi 0x900001;exit
sMem: db "/dev/fb0"
MenuDir: db '/usr/gp2x'
MenuCmd: db '/usr/gp2x/gp2xmenu'
i have downloaded .pdf manuals but im not good in english.
examples helps me a lot.
thanks