Omnimaga

Calculator Community => Major Community Projects => The Axe Parser Project => Topic started by: ACagliano on January 13, 2015, 02:49:51 pm

Title: Adapting 4 Level Grey Code
Post by: ACagliano on January 13, 2015, 02:49:51 pm
I'm trying to borrow the Axe code for 4-lvl greyscale. So as I've done before, its the code from p_Disp4Lvl to __Disp4LvlEnd. However, the line I can't wrap my head around is:

Code: [Select]
call $3F00+sub_Safety
What is this? How do I adapt that line for use in my own code?
Title: Re: Adapting 4 Level Grey Code
Post by: Sorunome on January 13, 2015, 02:52:54 pm
IDK but this is the adapted one i ripped from axe for reuben2:
Code: [Select]
Interrupt:
exx
xor a
out (3),a ; ack interrupts
call Disp4Lvl
ld a,INTRPT_MASK
out (3),a ; reenable interrupts
exx
ei
ret
Disp4Lvl:
ld    hl,appbackupscreen
ld    de,plotsscreen
push  hl
ld    a,$07
out   ($10),a      ;?? cc into
ld    a,%11011011
or    a
ld    hl,flags+asm_flag2
inc   (hl)
jr    z,__Disp4Lvlskip
rra
ld    b,(hl)
inc   b
jr    z,__Disp4Lvlskip
rra
ld    (hl),-2
__Disp4LvlSkip:
ex    af,af'
pop   hl
ld    a,$80
__Disp4LvlEntry:
out   ($10),a      ;76+cc into, 71cc loop
push  af
ex    (sp),hl      ;waste
ex    (sp),hl      ;waste
nop    ;waste
ld    a,$20
out   ($10),a      ;71cc into
ld    b,12
__Disp4LvlLoop:
ex    af,af'
rra
ld    c,a
ex    af,af'
ld    a,(de)
xor   (hl)
and   c
xor   (hl)
inc   de
inc   hl
out   ($11),a      ;71cc into, 77cc loop
djnz  __Disp4LvlLoop
inc   bc     ;waste
ex    af,af'
rra
ex    af,af'
pop   af
inc   a
bit   6,a
jr    z,__Disp4LvlEntry
__Disp4LvlDone:
ld    a,$05
out   ($10),a      ;73cc into
ret