Search results for query: *

  1. D

    Jumping into ARM assembly

    You can find better docs at linux-fbdev.org, like the HOWTO. On the mentioned ioctls. In short: they're like INT 10, AH=4F / VESA BIOS calls on an x86 system. There are two structures that hold information about the graphics hardware and its capabilities. -- fix screeninfo. (fb_fix_screeninfo...
  2. D

    Jumping into ARM assembly

    levi, #311 - correct. fbio_getvscreeninfo = 0x4600 fbio_putvscreeninfo = 0x4601 fbio_pandisplay = 0x4606 They're ioctl calls defined in fb.h and run by the kernel or the fb kernel module. The screensize can be calculated by multiplying BPP and YRES_VIRTUAL parameters from the virtual...
  3. D

    Jumping into ARM assembly

    ..."macro.mac" .text with_vsync = 1 @ the option to use vsync or not vsync_ioctl_cmd = ioc_write | (4<<16) | ('F'<<8) | 0X20 screensize=480*800*2*2 @ double buffer fbio_getvscreeninfo = 0x4600 fbio_putvscreeninfo = 0x4601 fbio_pandisplay = 0x4606 _start: bl fbinit cmp...
  4. D

    Jumping into ARM assembly

    fbp is the frame buffer pointer. it's the location where the display memory is mapped at. fbfd is framebuffer file descriptor. it's a file handle that points to '/dev/fb0/'.
  5. D

    Jumping into ARM assembly

    ...attributes invoke sys_open @ and open it .endm .include "macro.mac" .globl _start @ define screen size. @ 800 x 480, 16BPP. screensize=480*800*2 .text _start: bl fbinit @ fbinit will return 0 in R0 if some error occured or @ the frame buffer memory address if all went fine cmp...
  6. D

    Jumping into ARM assembly

    Do not use AND to work with a flag container. AND will clear other bits as well and sets ZERO flag to EQ or NZ if the whole register is 0 or 1. To manipulate/test bit(s) in a word use the following: set: ORR R9,#0b100 @ OR flip: EOR R9,#0b100 @ Exclusive OR, same a XOR on x86 clear...
  7. D

    Jumping into ARM assembly

    ...16 bytes in uninitialized data section .bss .text @ defined in linux/inluput.h @ #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ eviocgname: .word ioc_read | ((evdatalen-1) << 16) | 0x4506 evdevofs: .word evdev @ store evdev's offset for easier access...
  8. D

    Jumping into ARM assembly

    Sorry Linux-SWAT, you're going the wrong way. It's not event handling what you're doing in your code. I hope the next code will help you: .title "evlist" .arm .include "macro.mac" evdatalen=0x20 .data evdev: .ascii "/dev/input/event" evnum: .byte 0xff,0 evnamelen=.-evdev-1 .align .text...
  9. D

    Jumping into ARM assembly

    ...=1 @ to print out a counter .text _start: ldr r5,=163843 .if count mov r3,#'1' .endif ldr r4,=0x1999999a loop1: umull r0,r1, r5,r4 @ r5 * r4 = r1:r0 @ r1 = r5/10 add r0,r1,r1, lsl #2 sub r0,r5,r0, lsl #1 @ r0= r5 MOD 10 .if count push {r0,r1,r3} mov r2,#1 add r1,sp,#8 mov...
  10. D

    Jumping into ARM assembly

    yes, it does work. i've done it before with some gles code and it worked fine.
  11. D

    Jumping into ARM assembly

    you can _start your code in the .data section. here is an example: .include "macro.mac" .globl _start .data _start: print "hello\n" mov r4,#5 1: adr r1,toprintout mov r0,#console mov r2,#2 invoke sys_write ldrb r0,toprintout inc r0 strb r0,toprintout regloop r4,1b exit 0...
  12. D

    Jumping into ARM assembly

    I think the ARM procedure call standard assumes you're mixing C (or any other high level code) and ASM code. If you're writing pure ASM code then you don't have to follow this rule. Just preserve what you need. GCC can optimize your register usage when the ASM code is inlined so you don't have...
  13. D

    Jumping into ARM assembly

    Levi: >> I'm not familiar with the ! used in dmarshall's 'STMDB sp!,...' though.  That's new syntax to me The "!" means the new SP (after store) is written back to SP. If you leave it out, like STMDB SP,{R4,R5} then SP will point to the same address as before and another call may destroy your...
  14. D

    Jumping into ARM assembly

    Here is how LDM/STM works: LDMIA - LDM Increment After LDMDA - LDM Decrement After LDMIB - LDM Increment Before LDMDB - LDM Decrement Before x86 PUSH = ARM STMDB x86 POP = ARM LDMIA To see how segments are allocated under Linux I created a short example.   .include "macro.mac" .globl _start...
  15. D

    Jumping into ARM assembly

    ...  @ there is no DIV instruction for the ARM family @ so here is the method: clr r4 @ x/10 = x * (2^n/10) then ASR n (or use the upper 32 bits when n=32) mov r5,sp ldr r3,div10 cmp r0,r4 sub sp,sp,#12 rsblt r0,r0,r4 movlt r4,#'-' 11: umull...
  16. D

    Jumping into ARM assembly

    notaz was right. This should be enough for learning the basics. For me, keeping the sources readable is very important. I think following a 'coding style' from the beginning helps to understand and develop the sources for a long time. I still maintain and debug 15 years old x86 assembly codes.
  17. D

    Jumping into ARM assembly

    No, you have to alter terminfo settings if you read input events directly. Also, you have to use O_NONBLOCK | O_RD flags when the event device is opened. I have an example somewhere.  I will post it soon.
  18. D

    Jumping into ARM assembly

    On Note 1, The code works but try the following: open a file or device, like '/dev/input/event0' and try to read 3 bytes in your example. The first file descriptor on a 'clean' system is 3 so the second loop will read from the event device if more than 3 characters were typed. like this:  ...
  19. D

    Jumping into ARM assembly

    Linux-SWAT, As others suggested, why don't you allocate, say 80 bytes and read a full line to the buffer then search for letter 'q'. If it was not typed then print out a message saying something motivating and start it over.   .arm .title "input" .globl _start cmp_char='q' sys_exit=1...
  20. D

    Jumping into ARM assembly

    Linux-SWAT: Using syscall 3, sys_read: It returns the character count in R0 so the next loop will read from 1,stdout, not from 0,stdin. Always at least four-align your data. Use an align after a .char declaration OR pack four characters into one .word to save space.  
Back
Top