]> git.sur5r.net Git - cc65/commitdiff
Use the new LOWCODE segment
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 22 Nov 2002 22:34:46 +0000 (22:34 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 22 Nov 2002 22:34:46 +0000 (22:34 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@1589 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/c128/break.s
libsrc/c128/crt0.s

index 0ecdc85ec862dc364befca9b948b62c400f11239..4cb349444942c4f860f485a071b2242d2092076b 100644 (file)
@@ -8,7 +8,6 @@
                .export         _set_brk, _reset_brk
        .destructor     _reset_brk
        .export         _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc
-       .import         BRKStub, BRKOld, BRKInd
        .importzp       ptr1
 
        .include        "c128.inc"
@@ -33,24 +32,24 @@ uservec:            jmp     $FFFF           ; Patched at runtime
        sta     uservec+1
        stx     uservec+2       ; Set the user vector
 
-       lda     BRKOld+1
-       ora     BRKOld+2        ; Did we save the vector already?
-               bne     @L1             ; Jump if we installed the handler already
+       lda     brk_old+1
+       ora     brk_old+2       ; Did we save the vector already?
+               bne     @L1             ; Jump if we installed the handler already
 
        lda     BRKVec          ; Save the old vector
-       sta     BRKOld+1
+       sta     brk_old+1
        lda     BRKVec+1
-       sta     BRKOld+2
+       sta     brk_old+2
 
-       lda     #<BRKStub       ; Set the break vector to our stub
-       ldx     #>BRKStub
+       lda     #<brk_stub      ; Set the break vector to our stub
+       ldx     #>brk_stub
        sta     BRKVec
        stx     BRKVec+1
 
        lda     #<brk_handler   ; Set the indirect vector to our handler
        ldx     #>brk_handler
-       sta     BRKInd+1
-       stx     BRKInd+2
+       sta     brk_ind+1
+       stx     brk_ind+2
 
 @L1:           rts
 
@@ -60,14 +59,14 @@ uservec:            jmp     $FFFF           ; Patched at runtime
 ; Reset the break vector
 .proc  _reset_brk
 
-       lda     BRKOld+1
-       ldx     BRKOld+2
-       beq     @L9             ; Jump if vector not installed
+       lda     brk_old+1
+       ldx     brk_old+2
+       beq     @L9             ; Jump if vector not installed
        sta     BRKVec
        stx     BRKVec+1
        lda     #$00
-       sta     BRKOld+1        ; Clear the saved vector
-       sta     BRKOld+2
+       sta     brk_old+1       ; Clear the saved vector
+       sta     brk_old+2
 @L9:   rts
 
 .endproc
@@ -85,17 +84,17 @@ uservec:            jmp     $FFFF           ; Patched at runtime
        pla
        sta     _brk_a
        pla
-       and     #$EF            ; Clear break bit
+       and     #$EF            ; Clear break bit
        sta     _brk_sr
-       pla                     ; PC low
+       pla                     ; PC low
        sec
-       sbc     #2              ; Point to start of brk
+       sbc     #2              ; Point to start of brk
        sta     _brk_pc
-       pla                     ; PC high
+       pla                     ; PC high
        sbc     #0
        sta     _brk_pc+1
 
-               jsr     uservec         ; Call the user's routine
+               jsr     uservec         ; Call the user's routine
 
        lda     _brk_pc+1
        pha
@@ -106,8 +105,31 @@ uservec:           jmp     $FFFF           ; Patched at runtime
        ldx     _brk_x
        ldy     _brk_y
        lda     _brk_a
-       rti                     ; Jump back...
+       rti                     ; Jump back...
 
 .endproc
 
 
+; Break stub, must go into low (non banked) memory
+
+.segment        "LOWCODE"
+
+.proc   brk_stub
+       pla                             ; Get original MMU_CR value
+       sta     MMU_CR                  ; And set it
+               jmp     brk_ind                 ; Jump indirect to break
+.endproc
+
+; ------------------------------------------------------------------------
+; Data
+
+.data
+
+; Old break vector preceeded by a jump opcode
+brk_old:
+        jmp     $0000
+
+; Indirect vectors preceeded by a jump opcode
+brk_ind:
+        jmp     $0000
+
index 5a66cd75394ee647ad478cee9baa4d0110d92772..79140899462307ba6fd265b9c17729ebd8c518e4 100644 (file)
@@ -5,7 +5,6 @@
 ;
 
        .export         _exit
-       .export         BRKStub, BRKOld, BRKInd
        .import         condes, initlib, donelib
        .import         initconio, doneconio, zerobss
        .import         push0, _main
@@ -189,24 +188,12 @@ IRQStub:
                jmp     IRQInd                  ; Jump to the saved IRQ vector
 
 
-BRKStub:
-       pla                             ; Get original MMU_CR value
-       sta     MMU_CR                  ; And set it
-               jmp     BRKInd                  ; Jump indirect to break
-
-
 ; ------------------------------------------------------------------------
 ; Data
 
 .data
 zpsave:        .res    zpspace
 
-; Old break vector preceeded by a jump opcode
-BRKOld: jmp     $0000
-
-; Indirect vectors preceeded by a jump opcode
-BRKInd: jmp     $0000
-
 .bss
 spsave:        .res    1
 mmusave:.res   1