Author Topic: Needed Routines  (Read 28199 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Needed Routines
« Reply #30 on: January 29, 2011, 03:39:20 pm »
Okay, no problem. The modified version was made just to draw to other buffers.

SirCmpwn

  • Guest
Re: Needed Routines
« Reply #31 on: January 29, 2011, 03:40:54 pm »
I guess that the ideal routine would accept a register as a pointer to a buffer, but that's probably too much ;)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Needed Routines
« Reply #32 on: January 29, 2011, 03:43:50 pm »
Hmm, It uses temp RAM, too, which might be a problem (fixable) in Knight OS, but yes, I could add a snippet of code to let HL be a pointer to the buffer. HL would immediately be copied to temp RAM, but it would be much easier to work with, you're right.

SirCmpwn

  • Guest
Re: Needed Routines
« Reply #33 on: January 29, 2011, 03:45:57 pm »
How much temp RAM?  The structure of KnightOS makes it difficult to use RAM.  I might be willing to set aside a small amount just for this routine, though.
« Last Edit: January 29, 2011, 03:46:19 pm by SirCmpwn »

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Needed Routines
« Reply #34 on: January 29, 2011, 03:54:10 pm »
Spoiler For Spoiler:
;HL is now the pointer to the buffer
;
;PatternRAM is 24 bytes of RAM used to draw the patterns used
;BufferPointer is 2 bytes to store the pointer for the buffer
;Both are obviously short term storage and can be reused immediately
;
ld (BufferPointer),hl
push af
push bc
ld b,0
push bc
push de
push de
ld hl,PatternRAM
ld (hl),0
ld de,PatternRAM+1
ld bc,24
ldir
pop de
ld a,e
rrca
rrca
rrca
and 15
ld h,0
ld l,a
ld a,e
and 7
push af
ld b,a
ld a,255
jr z,$04
srl a
djnz $FC
ld de,PatternRAM
add hl,de
ld (hl),a
pop af
cpl
and 7
inc a
ld b,a
pop af
sub b
bit 7,a
jr z,$0F
and 7
or a
jr z,$06
ld b,a
xor a
scf
rra
djnz $FC
and (hl)
ld (hl),a
jr $15
inc hl
cp 8
jr c, $06
ld (hl),255
sub 8
jr $F5
or a
jr z,$06
ld b,a
xor a
scf
rra
djnz $FC
ld (hl),a
pop hl
add hl,hl
add hl,hl
ld b,h
ld c,l
add hl,hl
add hl,bc
ld bc,(BufferPointer)
or (hl)
add a,h
add hl,bc
push hl
push de
ld hl,PatternRAM-1
ld de,PatternRAM+11
inc de
inc hl
ld a,(hl)
or a
jr z,$FA
srl a
xor (hl)
ld (de),a
inc hl
ld a,(hl)
dec hl
or a
jr nz,$09
ld a,(hl)
srl a
add a,(hl)
cpl
and (hl)
ld (de),a
jr $11
inc de
inc hl
ld a,l
cp 248
jr z,$04
ld a,(hl)
or a
jr nz,$F5
dec de
dec hl
ld a,(hl)
add a,a
xor (hl)
ld (de),a
pop de
pop hl
pop bc
pop af
or a
jr nz,$11
ld c,12
ld de,PatternRAM
ld a,(de)
cpl
and (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F7
djnz $F0
ret
dec a
jr nz,$10
ld c,12
ld de,PatternRAM
ld a,(de)
or (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
djnz $F1
ret
dec a
jr nz,$10
ld c,12
ld de,PatternRAM
ld a,(de)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
djnz $F1
ret
dec a
jr nz,$24
ld c,12
ld de,PatternRAM
ld a,(de)
or (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
dec b
ret z
dec b
jr z,$0F
ld c,12
ld de,PatternRAM+12
ld a,(de)
or (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
djnz $F1
inc b
jr $DC
dec a
jr nz,$26
ld c,12
ld de,PatternRAM
ld a,(de)
and (hl)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F7
dec b
ret z
dec b
jr z,$10
ld c,12
ld de,PatternRAM+12
ld a,(de)
and (hl)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F7
djnz $F0
inc b
jr $DA
dec a
jr nz,$24
ld c,12
ld de,PatternRAM
ld a,(de)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
dec b
ret z
dec b
jr z,$0F
ld c,12
ld de,PatternRAM+12
ld a,(de)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
djnz $F1
inc b
jr $DC
dec a
jr nz,$34
ld c,12
ld de,PatternRAM
ld a,(de)
or (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
dec b
ret z
dec b
jr z,$1F
push hl
ld c,12
ld de,PatternRAM
ld a,(de)
and (hl)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F7
pop hl
ld c,12
ld de,PatternRAM+12
ld a,(de)
or (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
djnz $E1
inc b
jr $CC
dec a
jr nz,$33
ld c,12
ld de,PatternRAM
ld a,(de)
or (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
dec b
ret z
dec b
jr z,$1E
push hl
ld c,12
ld de,PatternRAM
ld a,(de)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
pop hl
ld c,12
ld de,PatternRAM+12
ld a,(de)
or (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
djnz $E2
inc b
jr $CD
dec a
jr nz,$34
ld c,12
ld de,PatternRAM
ld a,(de)
and (hl)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F7
dec b
ret z
dec b
jr z,$1E
push hl
ld c,12
ld de,PatternRAM
ld a,(de)
or (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
pop hl
ld c,12
ld de,PatternRAM+12
ld a,(de)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
djnz $E2
inc b
jr $CC
dec a
jr nz,$35
ld c,12
ld de,PatternRAM
ld a,(de)
and (hl)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F7
dec b
ret z
dec b
jr z,$1F
push hl
ld c,12
ld de,PatternRAM
ld a,(de)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
pop hl
ld c,12
ld de,PatternRAM+12
ld a,(de)
and (hl)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F7
djnz $E1
inc b
jr $CB
dec a
jr nz,$37
dec b
ret z
di
push hl
exx
ld bc,12
pop hl
add hl,bc
exx
ld c,12
ld de,PatternRAM
push de
exx
pop de
exx
ld a,(de)
cpl
and (hl)
exx
ld b,a
ld a,(de)
and (hl)
or b
inc de
inc hl
exx
ld (hl),a
inc de
inc hl
dec c
jr nz,$EF
djnz $E4
ld c,12
ld de,PatternRAM
ld a,(de)
cpl
and (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F7
ei
ret
dec a
jr nz,$40
di
push bc
ld de,12
add hl,de
djnz $FD
dec hl
push hl
exx
ld de,65524
pop hl
add hl,de
exx
pop bc
dec b
ret z
ld c,12
ld de,PatternRAM+11
push de
exx
pop de
exx
ld a,(de)
cpl
and (hl)
exx
ld b,a
ld a,(de)
and (hl)
or b
dec de
dec hl
exx
ld (hl),a
dec de
dec hl
dec c
jr nz,$EF
djnz $E4
ld c,12
ld de,PatternRAM+11
ld a,(de)
cpl
and (hl)
ld (hl),a
dec de
dec hl
dec c
jr nz,$F7
ei
ret
dec a
jr nz,$03
nop
nop
nop
nop
ret

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Needed Routines
« Reply #35 on: January 29, 2011, 04:02:31 pm »
Sorry to hear about parents Sir. I'm glad you can still manage to get online though and that your projects are intact.

SirCmpwn

  • Guest
Re: Needed Routines
« Reply #36 on: January 29, 2011, 05:04:51 pm »
I think I can spare 26 bytes.
Sorry to hear about parents Sir. I'm glad you can still manage to get online though and that your projects are intact.
The projects are fine, but there will be several days between visits here.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Needed Routines
« Reply #37 on: January 31, 2011, 01:45:35 pm »
Ok I see. I hope they won't get spaced by like a month or two eventually X.x

SirCmpwn

  • Guest
Re: Needed Routines
« Reply #38 on: January 31, 2011, 09:13:41 pm »
I've actually been quite lucky, three days in a row :D

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Needed Routines
« Reply #39 on: January 31, 2011, 09:17:53 pm »
Can we put Xeda's code in a spoiler or something? It's long.

And I'm glad you can get some time to join us SirCmpwn.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Needed Routines
« Reply #40 on: January 31, 2011, 09:20:10 pm »
Sure, I guess that is okay :P