Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
BritLion's Putchars
#35
@compiuter: There's a simple way: generate the asm source code with --asm and see how the function is compiled. I always do this test:
Code:
SUB xxx(a as uByte, b as Uinteger)
a = 5
b = 6
END SUB
Now compile with --asm and see the generated code (don't use any optimization, just --asm). The .asm generated file in this case will contain an _xxx label (that is, the name of your sub, prefixed with "_" character). This is the code of your compiled sobroutine:
Code:
_xxx:
    push ix
    ld ix, 0
    add ix, sp
    ld (ix+5), 5
    ld (ix+6), 6
    ld (ix+7), 0
_xxx__leave:
    ld sp, ix
    pop ix
    exx
    pop hl
    pop bc
    ex (sp), hl
    exx
    ret
Notice a = 5 becames LD (ix + 5), 5 and b = 6 becames ld (ix+6), 6 and ld (ix+7),0 (hi byte). In the future I'm planning to use something similar to FreeBasic's inline assebler: LD [a], 5 (translated to ld (ix+5), 5) and LD [b],... whenever possible. That is, [<variable_name>] will be replaced with var address.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)