0 Members and 1 Guest are viewing this topic.
ld hl, (screenx) ld d, 1 ld e, 0 call SubFP ld b, h \ ld c, l ld de, 94 call MulFP ld (screenx), hl ld hl, (screeny) ld d, 1 ld e, 0 call SubFP ld b, h \ ld c, l ld de, 62 call MulFP ld (screeny), hl ret
ld hl, (screenx) ;ld d, 1 ;ld e, 0 call SubFP ld b, h \ ld c, l ld de, 94 call MulFP ld (screenx), hl ld hl, (screeny) ;ld d, 1 ;ld e, 0 call SubFP ld b, h \ ld c, l ld de, 62 call MulFP ld (screeny), hl ret
SubFP: or a sbc hl, de
MulFP: ;Multiplies 2 16bit fixed-point numbers ;IN: de, bc ;OUT: de * bc in hl ;DESTROYS: af, bc, de, hl bit 7, d jr nz, _MulFP_FirstNeg bit 7, b jr nz, _MulFP_AnsNeg jr z, _MulFP_AnsPos_MulFP_FirstNeg: bit 7, b jr nz, _MulFP_AnsPos_MulFP_AnsNeg: ld a, 1 push af jr _MulFP_Cont_MulFP_AnsPos: ld a, 0 push af_MulFP_Cont: bit 7, b jr z, _MulFP_BCPos call NegBC_MulFP_BCPos: bit 7, d jr z, _MulFP_DEPos call NegDE_MulFP_DEPos: call Mul16 ld l, h ld h, e pop af cp 1 call z, NegHL ret
Mul16: ; This routine performs the operation DEHL=BC*DE ld hl,0 ld a,16Mul16Loop: add hl,hl rl e rl d jp nc,NoMul16 add hl,bc jp nc,NoMul16 inc deNoMul16: dec a jp nz,Mul16Loop ret
NegHL: xor a sub l ld l,a sbc a,a sub h ld h,a retNegBC: xor a sub c ld c,a sbc a,a sub b ld b,a retNegDE: xor a sub e ld e,a sbc a,a sub d ld d,a ret
0A18 is part of the OS, you want to try to figure out where execution leaves your code. Your code will be in the $9D95 - ~$B000 range depending on program size.I put together everything you have posted so far and it ran fine. So I'm really not sure what isn't working right. It might not even be related to the code you posted.
I remember one time when I was working on Pyoro I had the weirdest bug that seemingly occurred at random and couldn't be traced back anywhere. It took me a week to find but eventually, I found it and fixed it. I had forgotten to back up the ix register during my interrupt routine. If you're using custom interrupts, make sure the routine is working right.Another thought, is your program nearing 8kb in size? Any code larger than that will cause a crash due to execution protection on the last page. Try replacing the commented out part in your example with nops instead of the loads, I bet it has something to do with program size rather than the particular instructions.Also, where are screenx and screeny? You're not writing over any OS variables right?
Do you still have problems with that ERR:BREAK?
Server load over the past 5, 10 and 15 minutes respectively: 1.5, 0.66, 0.39
Page created in 0.798 seconds with 60 queries.