Jump to content
IGNORED

Just another Coleco Programer


Mike Harris

Recommended Posts

OK, hate to say I stayed up last night but I did.

I had to write my new map routine and I can say I am done with it.
4 bytes per row at 24 rows

 

Here is a sample code that reads the bits

BIT_DRAW:
PUSH DE
PUSH BC
LD DE, BLOCK
LD C, A
BIT 0,C
JR Z, RD_BIT_1
CALL DO_IT
RD_BIT_1:
INC HL
BIT 1,C
JR Z, RD_BIT_2
CALL DO_IT
RD_BIT_2:
INC HL
BIT 2,C
JR Z, RD_BIT_3
CALL DO_IT
RD_BIT_3:
INC HL
BIT 3,C
JR Z, RD_BIT_4
CALL DO_IT
RD_BIT_4:
INC HL
BIT 4,C
JR Z, RD_BIT_5
CALL DO_IT
RD_BIT_5:
INC HL
BIT 5,C
JR Z, RD_BIT_6
CALL DO_IT
RD_BIT_6:
INC HL
BIT 6,C
JR Z, RD_BIT_7
CALL DO_IT
RD_BIT_7:
INC HL
BIT 7,C
JR Z, END_THIS
CALL DO_IT
END_THIS:
INC HL
POP BC
POP DE
RET

 

It took me a couple of hours and I had to write it into long form then I shortened it into a loop.

You may say why but I went from of 12k down to 4 just by saving map data.
My character is already moving and I have all my sprite data.
So, I am estimating this will be either an 8 or 12k before more optimizations.

Link to comment
Share on other sites

Refined my routine to 2 bytes per map data with mirror.

 

Great routine to reverse any 8 bit number.

 

Got the idea from the original OS7 Reverse Sprite Routine listed in my ADAM Technical Reference Manual I bought back in 84.

 

MIRROR:
LD b,8 ; All 8 bits
LD l,a ; Byte to be reverse
REVERSE_ME:
RL l
RRA
DJNZ REVERSE_ME
RET ; return from call

Edited by Mike Harris
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...