0 Members and 2 Guests are viewing this topic.
LD A, (Score) INC A LD (Score), A LD HL, (score) ADD HL, HL ADD HL, HL ADD HL, HL ADD HL, HL LD DE, $100 ADD HL, DE LD A, H NEG LD B, 63 ADD A, B LD (ScoreMeter), A
LD HL, (Score) INC HL LD (Score),HL
LD A, (Score) INC A LD (Score), A LD H,0 LD L,A
SRL H RR L
LD HL, (Score) ; Score holds any number from 0 to 992 (16*62); 256 ÷ 16 = 16, find (Score) × 16; Lets say (score) = 139, so I want 8 as my answer: ADD HL, HL ; HL = $0116 ADD HL, HL ; HL = $022C ADD HL, HL ; HL = $0458 ADD HL, HL ; HL = $08B0 ; Tadaa! H holds 8 right? which is 139/16! LD DE, $100 ADD HL, DE ; HL = $09B0 LD A, H ; A = 9 NEG ; A = -9 LD B, 63 ADD A, B ; A = 54 LD (ScoreMeter), A ; Scoremeter = 54! Exept that it isn't for some reason...
LD HL,(Score) INC HL LD (Score),HL ADD HL,HL ADD HL,HL ADD HL,HL ADD HL,HL LD A,63 SUB H LD (ScoreMeter),A
LD A,(ScoreMeter) LD H,0 LD L,A
ld hl,score inc (hl) ld e,(hl) rld ld (hl),e and %00001111 sub 63 neg ld (scoreMeter),a
CALL gamescreen CALL newsprr1n1 LD A, 9 LD B, Atbdn1: CALL hidemoveshowncount djnz tbdn1 CALL newsprr2n2 LD A, 9 LD B, Atbdn2: CALL hidemoveshowncount djnz tbdn2 CALL newsprr3n3 LD A, 9 LD B, Atbdn3: CALL hidemoveshowncount djnz tbdn3ect. ect. ect. ect. untill: CALL newsprr4n14 LD A, 9 LD B, Atbdn14: CALL hidemoveshowncount djnz tbdn14 CALL newsprr5n15 LD A, 9 LD B, Atbdn15: CALL hidemoveshowncount djnz tbdn15 CALL newsprr1n16 ; THIS is where it crashes. Works fine up to this point. It doesnt matter what number I use, newsprr@@n$$ (with @@ being a number between 1-5 and $$ is 1-16) wil ALWAYS result in ram-cleared.
newsprr@@n$$: CALL newrow@@call <-- here CALL newspr$$call ; THIS doesnt ever get executed, so the problem must be ^ CALL putnewcall ret
tbdn15: CALL hidemoveshowncount djnz tbdn15 JP thebluedanubescrn ; WORKS! it jumps and all is OK.tbdn15: CALL hidemoveshowncount djnz tbdn15 CALL newrow@@call ; FAILS, the jump doesnt get executed and the program crashes. JP thebluedanubescrn
newrow@@call: LD A, "insert any number here" LD (xpos), A ret
tbdn15: CALL hidemoveshowncount djnz tbdn15 LD A, "insert any number here" ; = CALL newrow@@call LD (xpos), A ; = CALL newrow@@call JP thebluedanubescrn ; Doesnt get executed, ram-reset here ^
tbdn15: CALL hidemoveshowncount djnz tbdn15 LD A, "insert any number here" ; Removed "LD (xpos), A" JP thebluedanubescrn ; Still doesnt get executed, ram-resets.
[code]tbdn15: CALL hidemoveshowncount djnz tbdn15 JP thebluedanubescrn ; Works!tbdn15: CALL hidemoveshowncount djnz tbdn15 LD A, "insert any number here" ; FAILS HERE JP thebluedanubescrn ; doesnt get executed, ram-resets.
ld A,<some number>ld B,A
ld B,<some number>
tbdn15: CALL hidemoveshowncount djnz tbdn15
tbdn15: PUSH BC CALL hidemoveshowncount POP BC djnz tbdn15
hidemoveshowncount: LD A, B LD (counter), A ---code with lots of stuff, calls ect.--- LD A, (counter) LD B, A ret
djnz "CHANGING LABEL"