-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[apple2][bus] Refactor _sp_get_xxx functions
- Loading branch information
1 parent
cb3f477
commit 3950b12
Showing
11 changed files
with
98 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,14 @@ | ||
.export _sp_get_clock_id | ||
.export _sp_clock_id | ||
|
||
.import _sp_find_device | ||
|
||
.import return0 | ||
.import return1 | ||
|
||
.macpack cpu | ||
|
||
sp_find_clock: | ||
lda #$13 | ||
jsr _sp_find_device | ||
|
||
bmi not_found | ||
beq not_found | ||
|
||
sta _sp_clock_id | ||
jmp return1 | ||
|
||
not_found: | ||
.if (.cpu .bitand ::CPU_ISET_65SC02) | ||
stz _sp_clock_id | ||
.else | ||
lda #$00 | ||
sta _sp_clock_id | ||
.endif | ||
jmp return0 | ||
|
||
.import sp_find_device_type | ||
|
||
; uint8_t sp_get_clock_id() | ||
_sp_get_clock_id: | ||
ldx #$00 ; prep the return hi byte for C callers | ||
lda _sp_clock_id | ||
bne :+ ; if it's already set, just exit | ||
|
||
; otherwise we need to try and find it from SP | ||
jsr sp_find_clock | ||
|
||
; return whatever was set in sp_clock | ||
ldx #$00 | ||
lda _sp_clock_id | ||
: rts | ||
lda #$13 | ||
ldx #<_sp_clock_id | ||
ldy #>_sp_clock_id | ||
jmp sp_find_device_type | ||
|
||
.data | ||
_sp_clock_id: .byte $00 | ||
_sp_clock_id: .byte $00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,14 @@ | ||
.export _sp_get_cpm_id | ||
.export _sp_cpm_id | ||
|
||
.import _sp_find_device | ||
|
||
.import return0 | ||
.import return1 | ||
|
||
.macpack cpu | ||
|
||
sp_find_cpm: | ||
lda #$12 | ||
jsr _sp_find_device | ||
|
||
bmi not_found | ||
beq not_found | ||
|
||
sta _sp_cpm_id | ||
jmp return1 | ||
|
||
not_found: | ||
.if (.cpu .bitand ::CPU_ISET_65SC02) | ||
stz _sp_cpm_id | ||
.else | ||
lda #$00 | ||
sta _sp_cpm_id | ||
.endif | ||
jmp return0 | ||
|
||
.import sp_find_device_type | ||
|
||
; uint8_t sp_get_cpm_id() | ||
_sp_get_cpm_id: | ||
ldx #$00 ; prep the return hi byte for C callers | ||
lda _sp_cpm_id | ||
bne :+ ; if it's already set, just exit | ||
|
||
; otherwise we need to try and find it from SP | ||
jsr sp_find_cpm | ||
|
||
; return whatever was set in sp_cpm | ||
ldx #$00 | ||
lda _sp_cpm_id | ||
: rts | ||
lda #$12 | ||
ldx #<_sp_cpm_id | ||
ldy #>_sp_cpm_id | ||
jmp sp_find_device_type | ||
|
||
.data | ||
_sp_cpm_id: .byte $00 | ||
_sp_cpm_id: .byte $00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,14 @@ | ||
.export _sp_get_modem_id | ||
.export _sp_modem_id | ||
|
||
.import _sp_find_device | ||
|
||
.import return0 | ||
.import return1 | ||
|
||
.macpack cpu | ||
|
||
sp_find_modem: | ||
lda #$15 | ||
jsr _sp_find_device | ||
|
||
bmi not_found | ||
beq not_found | ||
|
||
sta _sp_modem_id | ||
jmp return1 | ||
|
||
not_found: | ||
.if (.cpu .bitand ::CPU_ISET_65SC02) | ||
stz _sp_modem_id | ||
.else | ||
lda #$00 | ||
sta _sp_modem_id | ||
.endif | ||
jmp return0 | ||
|
||
.import sp_find_device_type | ||
|
||
; uint8_t sp_get_modem_id() | ||
_sp_get_modem_id: | ||
ldx #$00 ; prep the return hi byte for C callers | ||
lda _sp_modem_id | ||
bne :+ ; if it's already set, just exit | ||
|
||
; otherwise we need to try and find it from SP | ||
jsr sp_find_modem | ||
|
||
; return whatever was set in sp_modem | ||
ldx #$00 | ||
lda _sp_modem_id | ||
: rts | ||
lda #$15 | ||
ldx #<_sp_modem_id | ||
ldy #>_sp_modem_id | ||
jmp sp_find_device_type | ||
|
||
.data | ||
_sp_modem_id: .byte $00 | ||
_sp_modem_id: .byte $00 |
Oops, something went wrong.