Author Topic: Adapting 4 Level Grey Code  (Read 2885 times)

0 Members and 1 Guest are viewing this topic.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Adapting 4 Level Grey Code
« 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?

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Adapting 4 Level Grey Code
« Reply #1 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

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!