]> cloudbase.mooo.com Git - ddt180.git/commitdiff
Save some bytes in breakpoint handling routines
authorLeo C <erbl259-lmu@yahoo.de>
Sat, 20 Aug 2016 22:06:42 +0000 (00:06 +0200)
committerLeo C <erbl259-lmu@yahoo.de>
Sat, 20 Aug 2016 22:06:42 +0000 (00:06 +0200)
ddt180.z80

index 8e3ad31da24c65750ee8441a8dba49131289f15c..3222ea6a2e653d012ce02329d4215f8f7f016300 100644 (file)
@@ -1315,7 +1315,7 @@ l05dbh:
        jr next_bindigit\r
 l05e4h:\r
        cp '"'\r
-       jp nz,ERROR\r
+       jr nz,error11\r
        call get.bindigit\r
        jr nc,l05dbh\r
        or a\r
@@ -1340,6 +1340,7 @@ next_decdigit:
 decnum_done:\r
        cp '.'\r
        ret z\r
+error11:\r
        jp ERROR\r
 \r
 sub_060ch:\r
@@ -1540,17 +1541,35 @@ l0740h:
        call bp_enter\r
        jp user_go\r
 \r
+\r
+bpl_init:\r
+       ld      b,BP_CNT\r
+       ld      ix,bp_tab\r
+       ex      (sp),hl\r
+       ld      (pbl_loop_adr),hl\r
+       ex      (sp),hl\r
+       ret\r
+\r
+bpl_next:\r
+       ld      de,BP_SIZE\r
+       add     ix,de\r
+       dec     b\r
+       ret     z\r
+\r
+       ex      (sp),hl\r
+       ld      hl,(pbl_loop_adr)\r
+       ex      (sp),hl\r
+       ret\r
+\r
 bp_clr_temporary:\r
-       ld b,BP_CNT\r
-       ld ix,bp_tab\r
-l075ah:\r
+       call    bpl_init\r
+\r
        ld a,(ix+000h)\r
        and 0f1h\r
        ld (ix+000h),a\r
        call bp_clr_condition\r
-       ld de,BP_SIZE\r
-       add ix,de\r
-       djnz l075ah\r
+\r
+       call bpl_next\r
        ret\r
 \r
 cmd_B:\r
@@ -1577,9 +1596,8 @@ bp_clr_next:
 bp_clr_all:\r
        scf\r
 bp_clr:\r
-       ld b,BP_CNT\r
-       ld ix,bp_tab\r
-l0799h:\r
+       call    bpl_init\r
+\r
        push af\r
        jr c,l07a7h\r
        ld e,(ix+002h)\r
@@ -1590,16 +1608,13 @@ l07a7h:
        ld (ix+000h),000h\r
        call bp_clr_condition\r
 l07aeh:\r
-       ld de,BP_SIZE\r
-       add ix,de\r
        pop af\r
-       djnz l0799h\r
+       call bpl_next\r
        ret\r
 \r
 bp_print:\r
-       ld b,BP_CNT\r
-       ld ix,bp_tab\r
-bp_pr_l:\r
+       call    bpl_init\r
+\r
        bit 0,(ix+000h)\r
        jr z,bp_pr_cont\r
        ld a,'R'\r
@@ -1633,9 +1648,7 @@ l07cdh:
 l0805h:\r
        call crlf\r
 bp_pr_cont:\r
-       ld de,BP_SIZE\r
-       add ix,de\r
-       djnz bp_pr_l\r
+       call bpl_next\r
        ret\r
 \r
 ; Add break points to list\r
@@ -1653,7 +1666,7 @@ bp_enter:
 bp_e_1:\r
        push bc\r
        call expr\r
-       jp c,ERROR\r
+       jr c,error12\r
        pop bc\r
        bit 0,b\r
        push bc\r
@@ -1678,17 +1691,14 @@ bp_e_1:
        jr bp_enter\r
 \r
 bp_get_freeslot:\r
-       ld b,BP_CNT\r
-       ld ix,bp_tab\r
-bp_gf_l:\r
+       call    bpl_init\r
+\r
        ld a,(ix+000h)\r
        and 00fh\r
        ret z\r
-       push bc\r
-       ld bc,BP_SIZE\r
-       add ix,bc\r
-       pop bc\r
-       djnz bp_gf_l\r
+\r
+       call    bpl_next\r
+error12\r
        jp ERROR\r
 \r
 bp_get_count:\r
@@ -1698,7 +1708,7 @@ bp_get_count:
        ret nz\r
        inc de\r
        call expr\r
-       jp c,ERROR\r
+       jr c,error12\r
        ret\r
 \r
 bp_get_condition:\r
@@ -1710,7 +1720,7 @@ bp_get_condition:
        call skipbl\r
        push de\r
        call expr\r
-       jp c,ERROR\r
+       jr c,error12\r
        ex de,hl\r
        pop de\r
        push de\r
@@ -1722,7 +1732,7 @@ bp_get_condition:
        add hl,bc\r
        ld de,expr_bufe\r
        call cp_hl_de\r
-       jp nc,ERROR\r
+       jr nc,error12\r
        pop hl\r
        ld (expr_p2),hl\r
        pop de\r
@@ -1790,9 +1800,8 @@ sub_0913h:
        ex af,af'\r
        sub a\r
        ld (l0941h),a\r
-       ld b,BP_CNT\r
-       ld ix,bp_tab\r
-l0920h:\r
+       call    bpl_init\r
+\r
        ld a,(ix+000h)\r
        and 007h\r
        jr z,l0938h\r
@@ -1804,9 +1813,8 @@ l0920h:
        call z,sub_0942h\r
        pop bc\r
 l0938h:\r
-       ld de,BP_SIZE\r
-       add ix,de\r
-       djnz l0920h\r
+\r
+       call    bpl_next\r
        ex af,af'\r
        ret\r
 \r
@@ -1844,9 +1852,8 @@ l0974h:
        ret\r
 \r
 sub_097ah:\r
-       ld b,BP_CNT\r
-       ld ix,bp_tab\r
-l0980h:\r
+       call    bpl_init\r
+\r
        bit 5,(ix+000h)\r
        res 5,(ix+000h)\r
        jr z,l099ah\r
@@ -1859,15 +1866,13 @@ l0980h:
        ld (hl),a\r
 l099ah:\r
        res 3,(ix+000h)\r
-       ld de,BP_SIZE\r
-       add ix,de\r
-       djnz l0980h\r
+\r
+       call    bpl_next\r
        ret\r
 \r
 sub_09a6h:\r
-       ld b,BP_CNT\r
-       ld ix,bp_tab\r
-l09ach:\r
+       call    bpl_init\r
+\r
        ld a,(ix+000h)\r
        and 003h\r
        jr z,l09c0h\r
@@ -1877,9 +1882,8 @@ l09ach:
        call cp_hl_de\r
        ret z\r
 l09c0h:\r
-       ld de,BP_SIZE\r
-       add ix,de\r
-       djnz l09ach\r
+\r
+       call    bpl_next\r
        sub a\r
        inc a\r
        ret\r
@@ -1902,9 +1906,8 @@ l09edh:
        ret\r
 \r
 bp_set_to_mem:\r
-       ld b,BP_CNT\r
-       ld ix,bp_tab\r
-l09f7h:\r
+       call    bpl_init\r
+\r
        ld a,(ix+000h)\r
        and c\r
        jr z,l0a1dh\r
@@ -1925,9 +1928,8 @@ l09f7h:
        inc hl\r
        ld (hl),d\r
 l0a1dh:\r
-       ld de,BP_SIZE\r
-       add ix,de\r
-       djnz l09f7h\r
+\r
+       call    bpl_next\r
        ret\r
 \r
 user_go:\r
@@ -5982,6 +5984,9 @@ disas_arg_16:
 disas_argtype:\r
        db      0\r
 \r
+pbl_loop_adr:\r
+       dw      0\r
+\r
 symlen_cur:            ;max length of symbols read so far\r
        db      0\r
 cur_fcb:\r