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...
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...
Hello, I'm happy this thread is alive again. To help you I quickly put together an example that does the following:
- framebuffer setup with double buffering
- plots 2 pixels on the center of 2nd screen
- scrolls the virtual screen from the 480th line to 0
Error checking was removed to shorten...
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/'.
Here is a short piece of code that draws two pixels on the screen. I added comments and a new macro 'open' that should be added to macro.mac
.macro open ffname,ffmode
mov r0,pc @ PC points 2 instructions ahead, to the file name
b 999f @...
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...
we can split the code into three parts
1/opening the event devices
@ the usual init stuff goes here
.title "evlist"
.arm
.include "macro.mac"
ifpandora=1 @ i was writing this code on a zaurus. that's why it's here.
.if ifpandora
.else
key_q=0x10 @ 'q' key scancode for...
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...
I hope this example will help you.
To count the digits of a decimal number you have divide the number by 10 (and print out the remainder if you wish) until you get 0.
.include "macro.mac"
.globl _start
printout =1 @ to print out the decimal number reversed
count =1 @ to print out...
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...
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...
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...
printhex:
stmdb sp!, {r0-r3,r7,lr} @ save regs
mov r2,#7 @ print out 8 numbers
sub sp,sp,#8 @ make room for the ascii string on stack
1:
and r3,r0,#0xf @ pick the lower nibble 0..f
mov r0,r0, ror #4 @ get the next nibble
cmp r3,#0xa...
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.
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.
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:
...
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...
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.