Author Topic: Needed Routines  (Read 25523 times)

0 Members and 1 Guest are viewing this topic.

SirCmpwn

  • Guest
Needed Routines
« on: August 26, 2010, 07:12:40 pm »
Hello,
The following is a list of routines that KnightOS needs in the near future, but that have already been done and optimized several times:

===Drawing===
*Line (Black and white lines)
*Rectangles (Black and white outlines, filled and unfilled)
===I/O===
*Linking routines via the I/O port

I have a line drawing routine, but it is only in black.

Please post your routines if you have them, and thanks!  Anyone who posts routines that end up in the OS will get an official thanks in the final version of KnightOS.
More routines will be added to this list as the need arises.
« Last Edit: August 26, 2010, 07:35:46 pm by SirCmpwn »

Offline matthias1992

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 408
  • Rating: +33/-5
    • View Profile
Re: Needed Routines
« Reply #1 on: November 17, 2010, 02:30:16 pm »
*bump*

I am sure Quigibo can give you his line routine for axe...as well as his rectangle routines (I assume he does not use any TIOS System routines?)

Linking is a different thing...I might actually look that up...
MASM xxxxxxxxxx aborted | SADce ====:::::: 40% -Halted until further notice| XAOS =====::::: 50% -Units done| SKYBOX2D engine ========== 100% -Pre-alpha done. Need to  document it and extend |

~Those who dream by day are cognizant of much more than those who dream by night only. -Sir Edgar Allen Poe-

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Needed Routines
« Reply #2 on: November 17, 2010, 05:32:26 pm »
This game http://www.ticalc.org/archives/files/fileinfo/423/42355.html  (It finally got featured!!!) has a wonderful linking routine in its source.  Plus it's made by Quigibo, so you could probably get permission to use it. ;D

SirCmpwn

  • Guest
Re: Needed Routines
« Reply #3 on: November 18, 2010, 08:17:40 pm »
Thanks, I have a line routine now, and I'll check out that link routine.

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Needed Routines
« Reply #4 on: January 23, 2011, 06:08:34 pm »
*bump*

Are there any other routines that we need to plan for/work on?

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 #5 on: January 23, 2011, 06:10:30 pm »
OhOhOhOhOhOhOhOh
I have 12 rectangle routines that work better than the OS versions and are safer/more reliable!!!!!!
Do you want them?!!
They are in BatLib!!
You can see the screen shots!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Needed Routines
« Reply #6 on: January 24, 2011, 02:40:31 am »
I think he will probably want them in z80 form rather than hex, though. :P

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 #7 on: January 24, 2011, 09:28:55 am »
:P That's what Assemblex is for :D Gotta hand it to Scout, Assemblex is really going to be useful for me. I'll obviously go through the code to make sure everything is alright and all the proper notes/labels are there.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Needed Routines
« Reply #8 on: January 24, 2011, 09:35:22 am »
:P That's what Assemblex is for :D Gotta hand it to Scout, Assemblex is really going to be useful for me. I'll obviously go through the code to make sure everything is alright and all the proper notes/labels are there.

It's basically a disassembler+Hex Editor. There are several disassemblers and even more hex editors.

It has some extra neat tools, but it's basically a Hex Editor+Disassembler.

Hum, what exactly is the line routine for Sir? Graphs?

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Needed Routines
« Reply #9 on: January 27, 2011, 03:01:29 pm »
You can get the source for the routines Quigibo uses in Axe in the download.
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





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 #10 on: January 27, 2011, 04:42:59 pm »
This is my own routine and a screen shot of it in action. It is about 683 bytes (not that I counted >_>):
This is the code Assemblex spit out:
Spoiler For Spoiler:
push af
push bc
ld b,0
push bc
push de
push de
ld hl,34540
ld (hl),0
ld de,34541
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,34540
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,($84B6)
or (hl)
add a,h
add hl,bc
push hl
push de
ld hl,34539
ld de,34551
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,34540
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,34540
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,34540
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,34540
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,34552
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,34540
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,34552
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,34540
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,34552
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,34540
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,34540
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,34552
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,34540
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,34540
ld a,(de)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
pop hl
ld c,12
ld de,34552
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,34540
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,34540
ld a,(de)
or (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
pop hl
ld c,12
ld de,34552
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,34540
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,34540
ld a,(de)
xor (hl)
ld (hl),a
inc de
inc hl
dec c
jr nz,$F8
pop hl
ld c,12
ld de,34552
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,34540
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,34540
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,34551
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,34551
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
000000C9         ;This is just a place holder for future commands
This is the hex:
Spoiler For Spoiler:
F5C50600C5D5D521EC86360011ED86011800EDB0D17B0F0F0FE60F26006F7BE607F5473EFF2804CB3F10FC11EC861977F12FE6073C47F190CB7F280FE607B7280647AF371F10FCA677181523FE08380636FFD60818F5B7280647AF371F10FC77E12929444D2909ED4BB68409E5D521EB8611F78613237EB728FACB3FAE12237E2BB720097ECB3F862FA612181113237DFEF828047EB720F51B2B7E87AE12D1E1C1F1B72011
0E0C11EC861A2FA67713230D20F710F0C93D2010
0E0C11EC861AB67713230D20F810F1C93D2010
0E0C11EC861AAE7713230D20F810F1C93D2024
0E0C11EC861AB67713230D20F805C805280F0E0C11F8861AB67713230D20F810F10418DC3D2026
0E0C11EC861AA6AE7713230D20F705C80528100E0C11F8861AA6AE7713230D20F710F00418DA3D2024
0E0C11EC861AAE7713230D20F805C805280F0E0C11F8861AAE7713230D20F810F10418DC3D2034
0E0C11EC861AB67713230D20F805C805281FE50E0C11EC861AA6AE7713230D20F7E10E0C11F8861AB67713230D20F810E10418CC3D2033
0E0C11EC861AB67713230D20F805C805281EE50E0C11EC861AAE7713230D20F8E10E0C11F8861AB67713230D20F810E20418CD3D2034
0E0C11EC861AA6AE7713230D20F705C805281EE50E0C11EC861AB67713230D20F8E10E0C11F8861AAE7713230D20F810E20418CC3D2035
0E0C11EC861AA6AE7713230D20F705C805281FE50E0C11EC861AAE7713230D20F8E10E0C11F8861AA6AE7713230D20F710E10418CB3D2037
05C8F3E5D9010C00E109D90E0C11EC86D5D9D1D91A2FA6D9471AA6B01323D97713230D20EF10E40E0C11EC861A2FA67713230D20F7FBC93D2040
F3C5110C001910FD2BE5D911F4FFE119D9C105C80E0C11F786D5D9D1D91A2FA6D9471AA6B01B2BD9771B2B0D20EF10E40E0C11F7861A2FA6771B2B0D20F7FBC93D2003
000000C9


Also, Sir, if you are interested in a math function...

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Needed Routines
« Reply #11 on: January 27, 2011, 04:47:38 pm »
Could you explain what the first screenshot does? Does it draws the rectangle or does it draw fast graphs?

Also on an off-topic note I wonder where did SirCmpwn go? He didn't login on the forums since last weekend and he did not e-mail me or anything else saying he got grounded more or something. O.O

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 #12 on: January 27, 2011, 04:51:26 pm »
Oh, sorry. The first screen shot is of the rectangle routines, the second one is a routine to show the 248-bit division routine.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Needed Routines
« Reply #13 on: January 27, 2011, 05:47:36 pm »
248-bit division routine.
O.O
Wow, Zeda's using big numbers...

Edit:  Okay, how do you do division with that many bites?  Can I have Pseudo-code? :D
« Last Edit: January 27, 2011, 05:49:24 pm by ztrumpet »

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 #14 on: January 27, 2011, 05:56:13 pm »
I have no clue what pseudo code is, but really it is just doing a multiprecision divide of a variable length number by an 8-bit number, so it isn't really that complex...
MP_Divide_E
Spoiler For Spoiler:
;0600E5092B7907070757AF41B7CB162B10FB1709BB380293341520EFE141577EB720040D2310F87A0600C9
ld b,0
push hl
add hl,bc
dec hl
ld a,c
rlca
rlca
rlca
ld d,a
xor a
ld b,c
or a
rl (hl)
dec hl
djnz $FB
rla
add hl,bc
cp e
jr c, $02
sub e
inc (hl)
dec d
jr nz,$EF
pop hl
ld b,c
ld d,a
ld a,(hl)
or a
jr nz,$04
dec c
inc hl
djnz $F8
ld a,d
ld b,0
ret
I hope it disassembled correctly...