0 Members and 2 Guests are viewing this topic.
CPU SH7700 LISTING ON SEGMENT code;Syscall macrosyscall macro op MOV.L op, R0; MOV.L scall_table, R2; JMP @R2 NOP endmmain: ;STS.L PR,@-R15; I got this idea when reading FX SDK listings. MOV.W #5, R4; Trying to give as argument id = 5 to DisplayErrorMessage syscall scall_DislayErrorMessage; Should print an error message NOP ; Stop? I don't really know how to stop that. ;LDS.L @R15+,PR MOV #1, R0 RTS NOP; By here it should have stopped LTORG; But he goes on further;Data; It doens't accept SEGMENT DATAString dc.B "Hello World!\0"; And crashes here accroding to the listing ALIGN 4;syscallsscall_Print_OS dc.L $013c ALIGN 4scall_DislayErrorMessage dc.L $0954 ALIGN 4scall_table dc.L $80010070
I chose to not use FX SDK because I don't know how to include properly ASM. Do you have any good idea/methods?
.INCLUDE "syscall.inc" .MACRO SC SysCall mov.l #\SysCall, r0 mov.l #JumpTableTop, r2 jsr @r2 nop .ENDM .EXPORT _BR_Size .EXPORT _AddIn_main .SECTION P, CODE, ALIGN=4_AddIn_main: SC Bdisp_AllClr_VRAM mov #5, r4 ; col mov #3, r5 ; row SC locate mov.l #text, r4 ; str mov #1, r5 ; mode SC Printloop: mov.l #key, r4 ; key SC GetKey bra loop nop rts nop .SECTION C, DATA, ALIGN=4text .SDATAZ "Hello, world!" .SECTION B, DATA, ALIGN=4_BR_Size .RES.L 1key .RES.L 1 .END
JumpTableTop .EQU h'80010070Print .EQU h'013CBdisp_AllClr_VRAM .EQU h'0143locate .EQU h'0807GetKey .EQU h'090F
Ok, how can I call C functions from an assembler file? .INCLUDE "header.h" won't work because syntax is way too different.
MOV.L @(2,R15), R4
.MACRO FIX Rd SHLR8 \Rd SHLR4 \Rd SHLL \Rd .ENDM... FIX R10 ; FIX(pz) -> pz // And here goes the mnemonic error