0 Members and 1 Guest are viewing this topic.
Would it be possible to have normal and full compilation modes. So if a program runs at normal by default the code for changing the clock to normal at every dispgraph wouldn't be needed. Also this could be used by 83+ owners so that when they compile a program, full commands are ignored.
p_FastCopy: .db __FastCopyEnd-1-$FastCopy: ld hl,plotSScreen ld a,$80 out ($10),a ld c,-$0C call $0000 ;Safety push af__FastCopyAgain: ld b,64 ;7 ld a,c ;4 add a,$2C ;7 out ($10),a ;11 ld a,(hl) ;7 (waste) inc de ;6 (waste)__FastCopyLoop: push af ;11 (waste) pop af ;10 (waste) ld de,12 ;10 ld a,(hl) ;7 add hl,de ;11 out ($11),a ;11 djnz __FastCopyLoop ;13/8 ld de,1-(12*64) ;10 add hl,de ;11 inc c ;4 jr nz,__FastCopyAgain ;12__FastCopyRestore: pop af out ($20),a ret c ei ret__FastCopyEnd: .db rp_Ans,__FastCopyEnd-__FastCopyAgain+3
p_FastCopy: .db __FastCopyEnd-1-$ ld hl,plotSScreen ld c,-$0C ld a,$80 out ($10),a ;??cc into call $0000 push af__FastCopyAgain: push hl ld a,c add a,$2C out ($10),a ;many cc into, 73cc loop inc de ;waste ld b,64__FastCopyLoop: ld a,(hl) ;waste inc de ;waste dec de ;waste ld de,12 ld a,(hl) add hl,de out ($11),a ;71cc into, 71cc loop djnz __FastCopyLoop pop hl inc hl inc c jr nz,__FastCopyAgain__FastCopyRestore: pop af out ($20),a ret c ei ret__FastCopyEnd: .db rp_Ans,__FastCopyEnd-p_FastCopy+11
p_DrawAndClr: .db __DrawAndClrEnd-1-$ ld hl,plotSScreen ld a,$80 out ($10),a ld c,-$0C call $0000 ;Safety push af__DrawAndClrAgain: ld b,64 ;7 ld a,c ;4 add a,$2C ;7 out ($10),a ;11 ld a,(hl) ;7 (waste) inc de ;6 (waste)__DrawAndClrLoop: ld de,12 ;10 ld a,(hl) ;7 ld (hl),d ;7 ld (hl),d ;7 (waste) ld (hl),d ;7 (waste) add hl,de ;11 out ($11),a ;11 djnz __DrawAndClrLoop ;13/8 ld de,1-(12*64) ;10 add hl,de ;11 inc c ;4 jr nz,__DrawAndClrAgain ;12__DrawAndClrRestore: pop af out ($20),a ret c ei ret__DrawAndClrEnd: .db rp_Ans,__DrawAndClrEnd-__DrawAndClrAgain+3
p_DrawAndClr: .db __FastCopyEnd-1-$ ld hl,plotSScreen ld c,-$0C ld a,$80 out ($10),a ;??cc into call $0000 push af__DrawAndClrAgain: push hl ld a,c add a,$2C out ($10),a ;many cc into, 73cc loop inc de ;waste ld b,64__DrawAndClrLoop: inc de ;waste dec de ;waste ld de,12 ld a,(hl) ld (hl),d add hl,de out ($11),a ;71cc into, 71cc loop djnz __DrawAndClrLoop pop hl inc hl inc c jr nz,__DrawAndClrAgain__DrawAndClrRestore: pop af out ($20),a ret c ei ret__DrawAndClrEnd: .db rp_Ans,__DrawAndClrEnd-__DrawAndClrAgain+11
p_DispGS: .db __DispGSEnd-1-$ call $0000 push af ld a,$80 out ($10),a ld (OP2),sp ld hl,flags+asm_Flag2 rr (hl) sbc a,a xor %01010101 ld (hl),a ld c,a ld l,appbackupscreen&$ff-1 ld sp,plotSScreen-appbackupscreen__DispGSNext: ld a,l ;4 ld b,64 ;7 add a,$21-(appbackupscreen&$ff);7 out ($10),a ;11 Into loop: 59 T-states inc l ;4 ld h,appbackupscreen>>8 ;7 ld de,appbackupscreen-plotSScreen+12;11__DispGSLoop: ld a,(hl) ;7 Loop: 61 T-states rrc c ;8 and c ;4 add hl,sp ;11 or (hl) ;7 out ($11),a ;11 add hl,de ;11 djnz __DispGSLoop ;13/8 Next Loop: 60 T-states ld a,l ;4 cp 12+(appbackupscreen&$ff);7 jr nz,__DispGSNext ;12__DispGSDone: ld sp,(OP2)__DispGSRestore: pop af out ($20),a ret c ei ret__DispGSEnd: .db rp_Ans,__DispGSEnd-p_DispGS-2
p_DispGS: .db __DispGSEnd-1-$ call $0000 push af ld a,$80 out ($10),a ;many cc into ld (OP2),sp ld hl,flags+asm_Flag2 rr (hl) sbc a,a xor %01010101 ld (hl),a ld c,a ld l,appbackupscreen&$ff-1 ld sp,plotSScreen-appbackupscreen__DispGSNext: ld a,l ld b,64 add a,$20-(appbackupscreen&$ff-1) out ($10),a ;113cc into, 71cc loop inc hl ld h,appbackupscreen>>8 ld de,appbackupscreen-plotSScreen+12__DispGSLoop: ld a,(hl) rrc c and c add hl,sp or (hl) out ($11),a ;71cc into, 72cc loop add hl,de djnz __DispGSLoop ld a,l cp 12+(appbackupscreen&$ff-1) jr nz,__DispGSNext__DispGSDone: ld sp,(OP2)__DispGSRestore: pop af out ($20),a ret c ei ret__DispGSEnd: .db rp_Ans,__DispGSEnd-p_DispGS-2
p_Disp4Lvl: .db __Disp4LvlEnd-1-$ call $0000 push af ld (OP2+2),sp ld a,$80 out ($10),a ld sp,appbackupscreen - plotSScreen ld e,(plotSScreen-appbackupscreen+12)&$ff ld c,-$0C ex af,af' ld a,%11011011 ld hl,flags+asm_flag2 inc (hl) jr z,__Disp4Lvlskip add a,a ld b,(hl) inc b jr z,__Disp4Lvlskip rlca ld (hl),-2__Disp4Lvlskip: ld l,plotSScreen&$ff-1 ex af,af'__Disp4Lvlentry: ld a,c add a,$2C ld h,plotSScreen>>8 inc l ld b,64 out ($10),a__Disp4Lvlloop: ld a,(hl) add hl,sp xor (hl) ex af,af' cp e rra ld d,a ex af,af' and d xor (hl) out ($11),a ld d,(plotSScreen-appbackupscreen+12)>>8 add hl,de djnz __Disp4Lvlloop inc c jr nz,__Disp4Lvlentry__Disp4LvlDone: ld sp,(OP2+2)__Disp4LvlRestore: pop af out ($20),a ret c ei ret__Disp4LvlEnd: .db rp_Ans,__Disp4LvlEnd-p_Disp4Lvl-2
p_Disp4Lvl: .db __Disp4LvlEnd-1-$ ld hl,appBackUpScreen ld de,plotSScreen call $0000 push af push hl ld a,$07 out ($10),a ;many cc into ld a,%11011011 or a ld hl,flags+asm_flag2 inc (hl) jr z,__Disp4Lvlskip rra ld b,(hl) inc b jr z,__Disp4Lvlskip rra ld (hl),-2__Disp4LvlSkip: ex af,af' pop hl ld a,$80__Disp4LvlEntry: out ($10),a ;76+cc into, 71cc loop push af ex (sp),hl ;waste ex (sp),hl ;waste nop ;waste ld a,$20 out ($10),a ;71cc into ld b,12__Disp4LvlLoop: ex af,af' rra ld c,a ex af,af' ld a,(de) xor (hl) and c xor (hl) inc de inc hl out ($11),a ;71cc into, 77cc loop djnz __Disp4LvlLoop inc bc ;waste ex af,af' rra ex af,af' pop af inc a bit 6,a jr z,__Disp4LvlEntry__Disp4LvlDone: ld a,$05 out ($10),a ;73cc into pop af out ($20),a ret c ei ret__Disp4LvlEnd: .db rp_Ans,__Disp4LvlEnd-p_Disp4Lvl-8
And as a side note, would it be possible to reformat DS<() so that the variable is reinitialized to its maximum value at the End? That way, 3 bytes could be saved by having both the zero and not zero conditions using the same store command. For example:Code: [Select] ld hl,(var) dec hl ld a,h or l jp nz,DS_End ;Code inside statement goes here ld hl,maxDS_End: ld (var),hl
ld hl,(var) dec hl ld a,h or l jp nz,DS_End ;Code inside statement goes here ld hl,maxDS_End: ld (var),hl
Now that you have absolute jumps implemented:Code: (Original code) [Select]p_Exchange: .db 13 pop de ex (sp),hl pop bc ld a,(de) ldi dec hl ld (hl),a inc hl ld a,b or c jr nz,$-8 Code: (Optimized code) [Select]p_Exchange: .db 12 pop de ex (sp),hl pop bc__ExchangeLoop: ld a,(de) ldi dec hl ld (hl),a inc hl jp pe,__ExchangeLoop ;or is it po?
p_Exchange: .db 13 pop de ex (sp),hl pop bc ld a,(de) ldi dec hl ld (hl),a inc hl ld a,b or c jr nz,$-8
p_Exchange: .db 12 pop de ex (sp),hl pop bc__ExchangeLoop: ld a,(de) ldi dec hl ld (hl),a inc hl jp pe,__ExchangeLoop ;or is it po?
p_DKeyVar: .db __DKeyVarEnd-1-$ dec l ld a,l rra rra rra and %00000111 inc a ld b,a ld a,%01111111 rlca djnz $-1 ld h,a ld a,l and %00000111 inc a ld b,a ld a,%10000000 rlca djnz $-1 ld l,a ret__DKeyVarEnd:
p_DKeyVar: .db __DKeyVarEnd-1-$ ld c,l dec c ld a,c rra rra rra call __DKeyVarMask cpl ld h,a ld a,c__DKeyVarMask: and %00000111 inc a ld b,a ld a,%10000000 rlca djnz $-1 ld l,a ret__DKeyVarEnd:
p_DispGS: .db __DispGSEnd-1-$ ld hl,plotSScreen ld de,appBackUpScreen call $0000 push af ld a,$07 out ($10),a ;many cc into ld a,(flags+asm_Flag2) rra sbc a,a xor %01010101 ld (flags+asm_Flag2),a ld c,a ld a,$80__DispGSNext: push af out ($10),a ;74cc into, 71cc loop ex (sp),hl ;waste ex (sp),hl ;waste rrc c ld b,12 ld a,$20 out ($10),a ;71cc into push af ;waste pop af ;waste__DispGSLoop: inc bc ;waste dec c ;waste ld a,(de) and c or (hl) inc de inc hl out ($11),a ;72cc into, 71cc loop ld a,(hl) ;waste djnz __Disp4Lvlloop pop af inc a bit 6,a jr z,__Disp4Lvlentry__DispGSDone: pop af out ($20),a ld a,$05 out ($10),a ;83cc into ret c ei ret__DispGSEnd: .db rp_Ans,__DispGSEnd-p_DispGS-8