0 Members and 4 Guests are viewing this topic.
Writing a new compiler for C, in assembly, would be a huge project. I don't think it's realistically possible.Porting some existing compiler would be easier, but may still be hard.
Yes with 341, it works.But with the syscall void gui_gc_drawLine(Gc p1, int p2, int p3, int p4, int p5), what is Gc p1? A pointer to the screen area?And p2, p3, p4, p5? The coordinates of the line?Edit (Eeems): Merged double post
And if I want to reuse the return value of the syscall, in which register is the return value?
Gc is an OS variable. There is a bit of documentation on https://hackspire.org/index.php/Syscalls#Graphic_Context_API.
I'd guess in R0 as usual.
main stmfd sp!, {r0-r12, lr} mov r0, #0xC0000010 ldr r0, [r0] bl clrscrCX adr r0, text swi #46 ;tolower swi #341 ;disp_msg bl wait ldmfd sp!, {r0-r12, pc}wait stmfd sp!, {r0-r12, lr} mvn r0, #0 mov r0, r0, lsr #4waitloop sub r0, r0, #1 cmp r0, #0 bgt waitloop ldmfd sp!, {r0-r12, pc}clrscrCX stmfd sp!, {r0-r12, lr} mov r4, r0 mov r5, #0 mov r6, #0 mov r7, #0xloop mov r0, r4 mov r1, r5 mov r2, r6 mov r11, r7 bl setPixel add r5, r5, #1 cmp r5, #320 blt xloop add r6, r6, #1 mov r5, #0 cmp r6, #240 blt xloop ldmfd sp!, {r0-r12, pc}setPixel stmfd sp!, {r0} add r0, r0, r1, lsl #1 add r0, r0, r2, lsl #9 add r0, r0, r2, lsl #7 strh r11, [r0] ldmfd sp!, {r0} bx lrtext dcb "HELLO WORLD!", 0
void gui_gc_drawLine(Gc, int x1, int y1, int x2, int y2) - Draws a line from <x1,y1> to <x2,y2>.
Code: [Select]main stmfd sp!, {r0-r12, lr} mov r0, #0xC0000010 ldr r0, [r0] bl clrscrCX adr r0, text swi #46 ;tolower swi #341 ;disp_msg bl wait ldmfd sp!, {r0-r12, pc}wait stmfd sp!, {r0-r12, lr} mvn r0, #0 mov r0, r0, lsr #4waitloop sub r0, r0, #1 cmp r0, #0 bgt waitloop ldmfd sp!, {r0-r12, pc}clrscrCX stmfd sp!, {r0-r12, lr} mov r4, r0 mov r5, #0 mov r6, #0 mov r7, #0xloop mov r0, r4 mov r1, r5 mov r2, r6 mov r11, r7 bl setPixel add r5, r5, #1 cmp r5, #320 blt xloop add r6, r6, #1 mov r5, #0 cmp r6, #240 blt xloop ldmfd sp!, {r0-r12, pc}setPixel stmfd sp!, {r0} add r0, r0, r1, lsl #1 add r0, r0, r2, lsl #9 add r0, r0, r2, lsl #7 strh r11, [r0] ldmfd sp!, {r0} bx lrtext dcb "HELLO WORLD!", 0but he displays HELLO WORLD!