Quantcast
Channel: Cemetech
Viewing all articles
Browse latest Browse all 75370

Doors CS :: RE: Doors CS 7 and SDCC

$
0
0
Author: Compynerd255
Posted: 12 Dec 2012 07:22:01 pm (GMT -5)

* bump *

Hi, I edited my last post with my issues. Do you see anything that could be the cause of my calc crashing when I try this?

EDIT: Eureka! I found it! (But I have no idea what to do about it...)
This is the important part of the assembly source (what it should be):

Code:
init:
    ld (saved_sp), sp  ; save stack pointer
    di

        ;; Initialise global variables
        call    gsinit
    call    _main
    jp  _exit     
_exit::
    ld sp, (saved_sp)      ;restore stack pointer
    ld iy, #0x89F0
    ei
    ret
saved_sp:
    .ds 2

gsinit::     
        ret

And here's how that code ends up getting compiled - and compiled very wrongly:

Code:
9DA1:  ld ($9DB9), sp
9DA5:  di
9DA6:  call $9DF3 ; call gsinit
9DA9:  call $9DBB ; call main
9DAC:  jp $C9AF ; jp _exit, SHOULD be jp $9DAF
9DAF:  ld sp,($9DB9) ; exit code...
9DB3:  ld iy,$89F0
9DB7:  ei
9DB8:  ret
9DB9: .dw $FFC3 ; (saved_sp)
...
9DBB:  ret ; main
...
9DF3:  ret ; gsinit

For some reason, SDCC is writing the wrong address for the jump instruction, causing the >$C000 check to trigger and the calculator to reset. Is there a way I can fix this, or is this a bug in SDCC?
_________________
Visit Betafreak Games: http://www.betafreak.com
Help Me Pay for College:
- Sign up for Fastweb through my referal link!


Viewing all articles
Browse latest Browse all 75370

Trending Articles