Thanks to Chipmaster of Cemetech and elsewhere, who wrote me a 600-byte grayscale masked cursor editing routine, you can now have custom cursors throughout Doors CS. No longer a hack into the kernel as it was in DCS 5, the custom cursor works not only in the DCS core but also in the GUI routines, as the cursor is now recalled from the DCS appvar, not the kernel itself. As you can see, I need to do a bit of work integrating the cursor editing into the rest of gui, and I need to edit the properties menu to set up the appvar pointer for the mouse.

As usual, I will be releasing another beta soon, which will probably advance a minor version number to Doors CS 5.7 Beta 1. I will try to get the new beta out later today or early tomorrow, depending on when I finish integration of the cursor editing routine into the start menu GUI.

KermMartian wrote:
Thanks to Chipmaster of Cemetech and elsewhere, who wrote me a 600-byte grayscale masked cursor editing routine, you can now have custom cursors throughout Doors CS. No longer a hack into the kernel as it was in DCS 5, the custom cursor works not only in the DCS core but also in the GUI routines, as the cursor is now recalled from the DCS appvar, not the kernel itself. As you can see, I need to do a bit of work integrating the cursor editing into the rest of gui, and I need to edit the properties menu to set up the appvar pointer for the mouse.

As usual, I will be releasing another beta soon, which will probably advance a minor version number to Doors CS 5.7 Beta 1. I will try to get the new beta out later today or early tomorrow, depending on when I finish integration of the cursor editing routine into the start menu GUI.



Yay! Chipmaster is a hero! Wink
great job, on to more and better things, right?
I was just lookin in the DCS Forum and apparently DCS 6 is codenamed . Rolling Eyes
Actually, only DCS 5.5 was codenamed . Doors CS 5.6 is officially codenamed . Guess what Doors CS 5.7 will be?

KermMartian wrote:
Actually, only DCS 5.5 was codenamed . Doors CS 5.6 is officially codenamed . Guess what Doors CS 5.7 will be?



oh

my

god.

What are you going to codename DCS 6? Planet X? Just Joking
Actually, I don't think I'm going to give Doors CS 6 a codename at all. It would be unnecessary, unless I call it Earth or something. Smile
KermMartian wrote:
Actually, I don't think I'm going to give Doors CS 6 a codename at all. It would be unnecessary, unless I call it Earth or something. Smile


0x5, I thought you were going to say somthing like

"No, actually the codename is Pluto."

Gaaaa! Evil or Very Mad
Probably 5.8 will be Pluto and 5.9 will be Venus. We will see.
I'm glad you were able to integrate it quickly (and I hope easily). I coded it with the mindset of putting it in a window.

If you need any other routines, I'd be happy to help. Smile

As I was falling asleep last night, I thought of an optimization that would save around 30 bytes. If you want to, I can optimize that and post the fixed code. If 30 bytes isn't worth it, I understand, but I'm under the assumption that you want to save as much space as possible.
Definitely post it. I'll post the code as I edited it so you can work on that:


Code:
CursorEdit:
   xor a
   ld (CX),a
   ld (CY),a
   ld (CGStimer),a
   ld hl,40
   bcall(_DAVLCheckOffset)
   ld de,cMouseMask
   ld bc,16
   ldir
   call displayOuterEdge
   
cmainloop:
   ld hl,CGStimer
   inc (hl)
   inc hl
   inc (hl)
   call displayGrid
   call displayCursor
   call imfastcopy
   bcall(_getcsc)
   cp skup
   jr nz,notMoveUp
   ld a,(CY)
   or a
   jr z,cmainloop
   dec a
   ld b,1
   jp CCursorMove
notMoveUp:
   cp skdown
   jr nz,notMoveDown
   ld a,(CY)
   cp 7
   jr z,cmainloop
   inc a
   ld b,1
   jp CCursorMove
notMoveDown:
   cp skright
   jr nz,notMoveRight
   ld a,(CX)
   cp 7
   jr z,cmainloop
   inc a
   ld b,0
   jp CCursorMove
notMoveRight:
   cp skleft
   jr nz,notMoveLeft
   ld a,(CX)
   or a
   jr z,cmainloop
   dec a
   ld b,0
   jp CCursorMove
notMoveLeft:
   cp sk2nd
   jp nz,notChangePixel
   
;Calls
   
   
modPixelStatus:
;White Opaque, Black Opaque, White Trans
;If White Opaque:
;-Change cMouse

;If Black Opaque
;-Change cMouse
;-Change cMouseMask

;If White Trans
;-Change cMouseMask
   ld a,(CY)
   ld hl,cMouse
   ld e,a
   ld d,0
   add hl,de
   ld a,(CX)
   ld b,a
   ld a,7
   sub b
   inc a
   ld b,a
   ld a,(hl)
cgetpixelLoop:
   srl a
   djnz cgetpixelLoop
   jr c,pixelIsBlack
   ld a,(CY)
   ld hl,cMouseMask
   ld e,a
   ;d = 0
   add hl,de
   ld a,(CX)
   ld b,a
   ld a,7
   sub b
   inc a
   ld b,a
   ld a,(hl)
cgetpixelLoop2:
   srl a
   djnz cgetpixelLoop2
   jr c,pixelIsTransparent
;White Opaque
   ld a,(CY)
   ld hl,cMouse
   ld e,a
   ;d = 0
   add hl,de
   ld a,(CX)
   or a
   jr z,skippixelOpaqueLoop
   ld b,a
   ld a,%10000000
pixelOpaqueLoop:
   srl a
   djnz pixelOpaqueLoop
skippixelOpaqueLoopBack:
   xor (hl)
   ld (hl),a
   jp cmainloop
skippixelOpaqueLoop:
   ld a,%10000000
   jr skippixelOpaqueLoopBack
pixelIsBlack:
;Black Opaque
   ld a,(CX)
   or a
   jr z,skippixelBlackLoop
   ld b,a
   ld a,%10000000
pixelBlackLoop:
   srl a
   djnz pixelBlackLoop
skippixelBlackLoopBack:
   xor (hl)
   ld (hl),a
   ld a,(CY)
   ld hl,cMouseMask
   ld e,a
   ;d = 0
   add hl,de
   ld a,(CX)
   or a
   jr z,skippixelBlackLoop2
   ld b,a
   ld a,%10000000
pixelBlackLoop2:
   srl a
   djnz pixelBlackLoop2
skippixelBlackLoop2Back:
   xor (hl)
   ld (hl),a
   jp cmainloop
skippixelBlackLoop:
   ld a,%10000000
   jr skippixelBlackLoopBack
skippixelBlackLoop2:
   ld a,%10000000
   jr skippixelBlackLoop2Back
pixelIsTransparent:
   ld a,(CX)
   or a
   jr z,skippixelTransLoop
   ld b,a
   ld a,%10000000
pixelTransLoop:
   srl a
   djnz pixelTransLoop
skippixelTransLoopBack:
   xor (hl)
   ld (hl),a
   jp cmainloop   
skippixelTransLoop:
   ld a,%10000000
   jr skippixelTransLoopBack
   
   
notChangePixel:
   cp skenter
   ret z
   jp cmainloop
   
   
displayOuterEdge:
;displays 4 black lines surrounding our grid.
   ld hl,39*256+23   ;(23,39)   (23,56)
   push hl         ;-------------
   ld d,56         ;|           |
   ld e,l         ;|           |
   push de         ;|           |
   ld a,1         ;|           |
   call mos_fastline   ;-------------
   pop de         ;(40,39)   (40,56)
   ld hl,56*256+40
   push hl
   ld a,1
   call mos_fastline   ;doesn't say what's destroyed.  Assume all.
   pop hl
   ld de,39*256+40
   push de
   ld a,1
   call mos_fastline
   pop de
   pop hl
   ld a,1
   call mos_fastline
   ret
   
   
displayGrid:
;Displays the current state of pixels
   ld b,8
   ld hl,cMouse-1
   ld e,22
GridOuterLoop:
   push bc
   inc hl
   ld a,38            ;2 less than what it will display first at
   inc e
   inc e
   ld b,%10000000
GridInnerLoop:
   push bc
   push hl
   push de
   push af
   ld a,(hl)
   and b
   jr z,GridDisplayBlank
GridBlack:
   pop af
   pop de
   inc a
   inc a
   push de
   push af
   ld l,e
   ld b,2
   ld ix,Block
   call imPutSpriteMask
   jr DisplayGridJoin
GridDisplayBlank:
   ld de,8
   or a
   sbc hl,de
   ld a,(hl)
   and b
   jr nz,GridDisplayGrey
GridDisplayBlank2:
   pop af
   pop de
   inc a
   inc a
   push de
   push af
   ld l,e
   ld b,2
   ld ix,Blank
   call imPutSpriteMask
DisplayGridJoin:
   pop af
   pop de
   pop hl
   pop bc
   srl b
   jr nz,GridInnerLoop
   pop bc
   djnz GridOuterLoop
   ret
GridDisplayGrey:
   ld a,(CGStimer)
   srl a
   jr c,GridDisplayBlank2
   jr GridBlack
Block:
   .db %00111111
   .db %00111111
Blank:
   .db %00111111
   .db %00111111
Dummy:
   .db 0,0,0,0,      ;4 bytes of crap
BlockMask:
   .db %11000000
   .db %11000000
BlankMask:
   .db %00000000
   .db %00000000
   
   
displayCursor:
;flashes cursor at X,Y
   ld a,(cblinktmr)
   cp 20
   jr nc,CursorcblinkOff
CursorOn:
   ld ix,Block
displayCursorBack:
   ld a,(CY)
   add a,a
   add a,24
   ld l,a
   ld a,(CX)
   add a,a
   add a,40
   ld b,2
   call imPutSpriteMask
   ret
CursorcblinkOff:
   cp 40
   call nc,resetcblinktmr
CursorOff:
   ld ix,Blank
   jr displayCursorBack
resetcblinktmr:
   xor a
   ld (cblinktmr),a
   ret
   
   
CCursorMove:
;Makes it blank at last spot
;Makes it solid at next spot
;b = 0 lr, b = 1 ud
   push af
   push bc
   xor a
   ld (cblinktmr),a
   call CursorOff
   pop bc
   ld a,b
   or a
   jr z,CCursorMoveLeftRight
   pop af
   ld (CY),a
   call CursorOn
   jp cmainloop
CCursorMoveLeftRight:
   pop af
   ld (CX),a
   call CursorOn
   jp cmainloop
Alright, I'll add the optimization tonight, and post the code later on tonight hopefully.
Ok, I originally made the optimization within my own MOS code, and then I converted it into what you had. I have not tested it since it was in my MOS code, so I *may* have made an error, but it *should* work.

Saves 28 bytes, and brings the total bytes down to 498 (in my version) not including the masked sprite routine or the 30 byte MOS header. I see an opportunity to save a byte or two by using that dummy space, but the effort required is just not worth it. Here's the fixed code.


Code:
CursorEdit:
   xor a
   ld (CX),a
   ld (CY),a
   ld (CGStimer),a
   ld hl,40
   bcall(_DAVLCheckOffset)
   ld de,cMouseMask
   ld bc,16
   ldir
   call displayOuterEdge
   
cmainloop:
   ld hl,CGStimer
   inc (hl)
   inc hl
   inc (hl)
   call displayGrid
   call displayCursor
   call imfastcopy
   bcall(_getcsc)
   cp skup
   jr nz,notMoveUp
   ld a,(CY)
   or a
   jr z,cmainloop
   dec a
   ld b,1
   jp CCursorMove
notMoveUp:
   cp skdown
   jr nz,notMoveDown
   ld a,(CY)
   cp 7
   jr z,cmainloop
   inc a
   ld b,1
   jp CCursorMove
notMoveDown:
   cp skright
   jr nz,notMoveRight
   ld a,(CX)
   cp 7
   jr z,cmainloop
   inc a
   ld b,0
   jp CCursorMove
notMoveRight:
   cp skleft
   jr nz,notMoveLeft
   ld a,(CX)
   or a
   jr z,cmainloop
   dec a
   ld b,0
   jp CCursorMove
notMoveLeft:
   cp sk2nd
   jp nz,notChangePixel
   
;Calls
   
   
modPixelStatus:
;White Opaque, Black Opaque, White Trans
;If White Opaque:
;-Change cMouse

;If Black Opaque
;-Change cMouse
;-Change cMouseMask

;If White Trans
;-Change cMouseMask
   ld a,(CY)
   ld hl,cMouse
   ld e,a
   ld d,0
   add hl,de
   ld a,(CX)
   ld b,a
   ld a,7
   sub b
   inc a
   ld b,a
   ld a,(hl)
cgetpixelLoop:
   srl a
   djnz cgetpixelLoop
   jr c,pixelIsBlack
   ld a,(CY)
   ld hl,cMouseMask
   ld e,a
   ;d = 0
   add hl,de
   ld a,(CX)
   ld b,a
   ld a,7
   sub b
   inc a
   ld b,a
   ld a,(hl)
cgetpixelLoop2:
   srl a
   djnz cgetpixelLoop2
   jr c,pixelIsTransparent
;White Opaque
   ld a,(CY)
   ld hl,cMouse
   ld e,a
   ;d = 0
   add hl,de
   ld a,(CX)
   or a
   jr z,firstcolumnpixel
   jr pixelChangerepeat
pixelIsBlack:
;Black Opaque
   ld a,(CX)
   or a
   jr z,skippixelBlackLoop
   ld b,a
   ld a,%10000000
pixelBlackLoop:
   srl a
   djnz pixelBlackLoop
skippixelBlackLoopBack:
   xor (hl)
   ld (hl),a
   ld a,(CY)
   ld hl,cMouseMask
   ld e,a
   ;d = 0
   add hl,de
   ld a,(CX)
   or a
   jr z,firstcolumnpixel
   jr pixelChangerepeat
skippixelBlackLoop:
   ld a,%10000000
   jr skippixelBlackLoopBack

pixelIsTransparent:
   ld a,(CX)
   or a
   jr z,firstcolumnpixel

   
pixelChangerepeat:
   ld b,a
   ld a,%10000000
pixelChangerepeatLoop:
   srl a
   djnz pixelChangerepeatLoop
skippixelChangerepeatLoop:
   xor (hl)
   ld (hl),a
   jp cmainLoop
firstcolumnpixel:
   ld a,%10000000
   jr skippixelChangerepeatLoop

   
notChangePixel:
   cp skenter
   ret z
   jp cmainloop
   
   
displayOuterEdge:
;displays 4 black lines surrounding our grid.
   ld hl,39*256+23   ;(23,39)   (23,56)
   push hl         ;-------------
   ld d,56         ;|           |
   ld e,l         ;|           |
   push de         ;|           |
   ld a,1         ;|           |
   call mos_fastline   ;-------------
   pop de         ;(40,39)   (40,56)
   ld hl,56*256+40
   push hl
   ld a,1
   call mos_fastline   ;doesn't say what's destroyed.  Assume all.
   pop hl
   ld de,39*256+40
   push de
   ld a,1
   call mos_fastline
   pop de
   pop hl
   ld a,1
   call mos_fastline
   ret
   
   
displayGrid:
;Displays the current state of pixels
   ld b,8
   ld hl,cMouse-1
   ld e,22
GridOuterLoop:
   push bc
   inc hl
   ld a,38            ;2 less than what it will display first at
   inc e
   inc e
   ld b,%10000000
GridInnerLoop:
   push bc
   push hl
   push de
   push af
   ld a,(hl)
   and b
   jr z,GridDisplayBlank
GridBlack:
   pop af
   pop de
   inc a
   inc a
   push de
   push af
   ld l,e
   ld b,2
   ld ix,Block
   call imPutSpriteMask
   jr DisplayGridJoin
GridDisplayBlank:
   ld de,8
   or a
   sbc hl,de
   ld a,(hl)
   and b
   jr nz,GridDisplayGrey
GridDisplayBlank2:
   pop af
   pop de
   inc a
   inc a
   push de
   push af
   ld l,e
   ld b,2
   ld ix,Blank
   call imPutSpriteMask
DisplayGridJoin:
   pop af
   pop de
   pop hl
   pop bc
   srl b
   jr nz,GridInnerLoop
   pop bc
   djnz GridOuterLoop
   ret
GridDisplayGrey:
   ld a,(CGStimer)
   srl a
   jr c,GridDisplayBlank2
   jr GridBlack
Block:
   .db %00111111
   .db %00111111
Blank:
   .db %00111111
   .db %00111111
Dummy:
   .db 0,0,0,0,      ;4 bytes of crap
BlockMask:
   .db %11000000
   .db %11000000
BlankMask:
   .db %00000000
   .db %00000000
   
   
displayCursor:
;flashes cursor at X,Y
   ld a,(cblinktmr)
   cp 20
   jr nc,CursorcblinkOff
CursorOn:
   ld ix,Block
displayCursorBack:
   ld a,(CY)
   add a,a
   add a,24
   ld l,a
   ld a,(CX)
   add a,a
   add a,40
   ld b,2
   call imPutSpriteMask
   ret
CursorcblinkOff:
   cp 40
   call nc,resetcblinktmr
CursorOff:
   ld ix,Blank
   jr displayCursorBack
resetcblinktmr:
   xor a
   ld (cblinktmr),a
   ret
   
   
CCursorMove:
;Makes it blank at last spot
;Makes it solid at next spot
;b = 0 lr, b = 1 ud
   push af
   push bc
   xor a
   ld (cblinktmr),a
   call CursorOff
   pop bc
   ld a,b
   or a
   jr z,CCursorMoveLeftRight
   pop af
   ld (CY),a
   call CursorOn
   jp cmainloop
CCursorMoveLeftRight:
   pop af
   ld (CX),a
   call CursorOn
   jp cmainloop


Edit: I just reread my above post where I claimed it would save around 30 bytes. It saved 28. a, I'm good Cool ...at estimating...
Excellent. And I added a "Default" button next to the edit cursor button in case people decide they want to revert back to the original.
Am I to assume that the actual curosr "click" location is always at the top-left corner? Or is that defineable so that you can get other cursors? (like the little fingure that points straight up)
The click is always in the upper left, although if you're writing a program, it's easy to cheat if you've set a custom cursor for the GUI by simply adding or subtracting to the X and Y returned from the mouseclick.
Does the default button work? Can we get a screenie plz? Very Happy

You know how we love them screenies... Very Happy
As requested:

O_O

Lovin the screenie... Very Happy So the sprite itself is 8x8, correct? I will have to see what nifty cursors I can come up with when this is released... Very Happy
Heh, sweet. And the way the appvar is set up, I'll be able to write an updated version of the Custom Cursor Mod program that works just like the old one did.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement