mirror of
https://github.com/cc65/cc65.git
synced 2025-01-03 01:31:55 +00:00
dos -> unix lf conversion
git-svn-id: svn://svn.cc65.org/cc65/trunk@1248 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
cc80937c3b
commit
302005befe
@ -1,44 +1,44 @@
|
|||||||
;
|
;
|
||||||
; Piotr Fusik, 15.04.2002
|
; Piotr Fusik, 15.04.2002
|
||||||
; originally by Ullrich von Bassewitz
|
; originally by Ullrich von Bassewitz
|
||||||
;
|
;
|
||||||
; Integer compare function - used by the compare operators
|
; Integer compare function - used by the compare operators
|
||||||
;
|
;
|
||||||
|
|
||||||
.export tosicmp
|
.export tosicmp
|
||||||
.importzp sp, sreg
|
.importzp sp, sreg
|
||||||
|
|
||||||
|
|
||||||
tosicmp:
|
tosicmp:
|
||||||
sta sreg
|
sta sreg
|
||||||
stx sreg+1 ; Save ax
|
stx sreg+1 ; Save ax
|
||||||
|
|
||||||
ldy #$00
|
ldy #$00
|
||||||
lda (sp),y ; Get low byte
|
lda (sp),y ; Get low byte
|
||||||
tax
|
tax
|
||||||
inc sp ; 5
|
inc sp ; 5
|
||||||
bne @L1 ; 3
|
bne @L1 ; 3
|
||||||
inc sp+1 ; (5)
|
inc sp+1 ; (5)
|
||||||
@L1:
|
@L1:
|
||||||
lda (sp),y ; Get high byte
|
lda (sp),y ; Get high byte
|
||||||
inc sp ; 5
|
inc sp ; 5
|
||||||
bne @L2 ; 3
|
bne @L2 ; 3
|
||||||
inc sp+1 ; (5)
|
inc sp+1 ; (5)
|
||||||
|
|
||||||
; Do the compare.
|
; Do the compare.
|
||||||
|
|
||||||
@L2: sec
|
@L2: sec
|
||||||
sbc sreg+1 ; Compare high byte
|
sbc sreg+1 ; Compare high byte
|
||||||
bne @L4
|
bne @L4
|
||||||
cpx sreg ; Compare low byte
|
cpx sreg ; Compare low byte
|
||||||
beq @L3
|
beq @L3
|
||||||
adc #$FF ; If the C flag is set then clear the N flag
|
adc #$FF ; If the C flag is set then clear the N flag
|
||||||
ora #$01 ; else set the N flag
|
ora #$01 ; else set the N flag
|
||||||
@L3: rts
|
@L3: rts
|
||||||
|
|
||||||
@L4: bvc @L3
|
@L4: bvc @L3
|
||||||
eor #$FF ; Fix the N flag if overflow
|
eor #$FF ; Fix the N flag if overflow
|
||||||
ora #$01 ; Clear the Z flag
|
ora #$01 ; Clear the Z flag
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,56 +1,56 @@
|
|||||||
;
|
;
|
||||||
; Piotr Fusik, 15.04.2002
|
; Piotr Fusik, 15.04.2002
|
||||||
; originally by Ullrich von Bassewitz
|
; originally by Ullrich von Bassewitz
|
||||||
;
|
;
|
||||||
; Long int compare function - used by the compare operators
|
; Long int compare function - used by the compare operators
|
||||||
;
|
;
|
||||||
|
|
||||||
.export toslcmp
|
.export toslcmp
|
||||||
.import incsp4
|
.import incsp4
|
||||||
.importzp sp, sreg, ptr1
|
.importzp sp, sreg, ptr1
|
||||||
|
|
||||||
|
|
||||||
toslcmp:
|
toslcmp:
|
||||||
sta ptr1
|
sta ptr1
|
||||||
stx ptr1+1 ; EAX now in sreg:ptr1
|
stx ptr1+1 ; EAX now in sreg:ptr1
|
||||||
|
|
||||||
ldy #$03
|
ldy #$03
|
||||||
lda (sp),y
|
lda (sp),y
|
||||||
sec
|
sec
|
||||||
sbc sreg+1
|
sbc sreg+1
|
||||||
bne L4
|
bne L4
|
||||||
|
|
||||||
dey
|
dey
|
||||||
lda (sp),y
|
lda (sp),y
|
||||||
cmp sreg
|
cmp sreg
|
||||||
bne L1
|
bne L1
|
||||||
|
|
||||||
dey
|
dey
|
||||||
lda (sp),y
|
lda (sp),y
|
||||||
cmp ptr1+1
|
cmp ptr1+1
|
||||||
bne L1
|
bne L1
|
||||||
|
|
||||||
dey
|
dey
|
||||||
lda (sp),y
|
lda (sp),y
|
||||||
cmp ptr1
|
cmp ptr1
|
||||||
|
|
||||||
L1: php ; Save flags
|
L1: php ; Save flags
|
||||||
jsr incsp4 ; Drop TOS
|
jsr incsp4 ; Drop TOS
|
||||||
plp ; Restore the flags
|
plp ; Restore the flags
|
||||||
beq L2
|
beq L2
|
||||||
bcs L3
|
bcs L3
|
||||||
lda #$FF ; Set the N flag
|
lda #$FF ; Set the N flag
|
||||||
L2: rts
|
L2: rts
|
||||||
|
|
||||||
L3: lda #$01 ; Clear the N flag
|
L3: lda #$01 ; Clear the N flag
|
||||||
rts
|
rts
|
||||||
|
|
||||||
L4: bvc L5
|
L4: bvc L5
|
||||||
eor #$FF ; Fix the N flag if overflow
|
eor #$FF ; Fix the N flag if overflow
|
||||||
ora #$01 ; Clear the Z flag
|
ora #$01 ; Clear the Z flag
|
||||||
L5: php ; Save flags
|
L5: php ; Save flags
|
||||||
jsr incsp4 ; Drop TOS
|
jsr incsp4 ; Drop TOS
|
||||||
plp ; Restore flags
|
plp ; Restore flags
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user