1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-08 22:25:28 +00:00

Small size optimizations

git-svn-id: svn://svn.cc65.org/cc65/trunk@2746 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-12-13 15:16:11 +00:00
parent e25fefb2ca
commit 3b69c2fd21
2 changed files with 20 additions and 22 deletions

View File

@@ -78,35 +78,34 @@ reu_params: .word $0000 ; Host address, lo, hi
; ;
INSTALL: INSTALL:
ldx #$00 ; High byte of return code
lda #$55 lda #$55
sta REU_REUADDR sta REU_REUADDR
cmp REU_REUADDR ; Check for presence of REU cmp REU_REUADDR ; Check for presence of REU
bne nodevice bne nodevice
lda #$AA asl a ; A = $AA
sta REU_REUADDR sta REU_REUADDR
cmp REU_REUADDR ; Check for presence of REU cmp REU_REUADDR ; Check for presence of REU
bne nodevice bne nodevice
ldx #>(128*4) ; Assume 128KB ldy #>(128*4) ; Assume 128KB
lda REU_STATUS lda REU_STATUS
and #$10 ; Check size bit and #$10 ; Check size bit
beq @L1 beq @L1
ldx #>(256*4) ; 256KB when size bit is set ldy #>(256*4) ; 256KB when size bit is set
@L1: stx pagecount+1 @L1: sty pagecount+1
ldx #$FF ldy #$FF
stx curpage sty curpage
stx curpage+1 ; Invalidate the current page sty curpage+1 ; Invalidate the current page
inx
txa ; X = A = EM_ERR_OK txa ; X = A = EM_ERR_OK
rts rts
; No REU found ; No REU found
nodevice: nodevice:
lda #<EM_ERR_NO_DEVICE lda #EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE ; rts ; Run into UNINSTALL instead
rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory. ; UNINSTALL routine. Is called before the driver is removed from memory.

View File

@@ -77,35 +77,34 @@ reu_params: .word $0000 ; Host address, lo, hi
; ;
INSTALL: INSTALL:
ldx #$00 ; High byte of return code
lda #$55 lda #$55
sta REU_REUADDR sta REU_REUADDR
cmp REU_REUADDR ; Check for presence of REU cmp REU_REUADDR ; Check for presence of REU
bne nodevice bne nodevice
lda #$AA asl a ; A = $AA
sta REU_REUADDR sta REU_REUADDR
cmp REU_REUADDR ; Check for presence of REU cmp REU_REUADDR ; Check for presence of REU
bne nodevice bne nodevice
ldx #>(128*4) ; Assume 128KB ldy #>(128*4) ; Assume 128KB
lda REU_STATUS lda REU_STATUS
and #$10 ; Check size bit and #$10 ; Check size bit
beq @L1 beq @L1
ldx #>(256*4) ; 256KB when size bit is set ldy #>(256*4) ; 256KB when size bit is set
@L1: stx pagecount+1 @L1: sty pagecount+1
ldx #$FF ldy #$FF
stx curpage sty curpage
stx curpage+1 ; Invalidate the current page sty curpage+1 ; Invalidate the current page
inx
txa ; X = A = EM_ERR_OK txa ; X = A = EM_ERR_OK
rts rts
; No REU found ; No REU found
nodevice: nodevice:
lda #<EM_ERR_NO_DEVICE lda #EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE ; rts ; Run into UNINSTALL instead
rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory. ; UNINSTALL routine. Is called before the driver is removed from memory.