mirror of
https://github.com/cc65/cc65.git
synced 2026-04-21 09:17:52 +00:00
Changes due to code review.
This commit is contained in:
committed by
Oliver Schmidt
parent
399250a105
commit
db8bd84a82
@@ -0,0 +1,47 @@
|
||||
; mul20.s
|
||||
;
|
||||
; This file is part of
|
||||
; cc65 - a freeware C compiler for 6502 based systems
|
||||
;
|
||||
; https://github.com/cc65/cc65
|
||||
;
|
||||
; See "LICENSE" file for legal information.
|
||||
;
|
||||
;
|
||||
; unsigned int __fastcall__ _mul20(unsigned char value);
|
||||
;
|
||||
; REMARKS: Function is defined to return with carry-flag cleared
|
||||
|
||||
|
||||
.importzp tmp4
|
||||
.export __mul20
|
||||
|
||||
.proc __mul20 ; = 30 bytes, 41/46 cycles
|
||||
|
||||
sta tmp4 ; remember value for later addition...
|
||||
ldx #0 ; clear high-byte
|
||||
asl a ; * 2
|
||||
bcc mul4 ; high-byte affected?
|
||||
ldx #2 ; this will be the 1st high-bit soon...
|
||||
|
||||
mul4: asl a ; * 4
|
||||
bcc mul5 ; high-byte affected?
|
||||
inx ; => yes, apply to 0 high-bit
|
||||
clc ; prepare addition
|
||||
|
||||
mul5: adc tmp4 ; * 5
|
||||
bcc mul10 ; high-byte affected?
|
||||
inx ; yes, correct...
|
||||
|
||||
mul10: stx tmp4 ; continue with classic shifting...
|
||||
|
||||
asl a ; * 10
|
||||
rol tmp4
|
||||
|
||||
asl a ; * 20
|
||||
rol tmp4
|
||||
|
||||
ldx tmp4 ; deliver high-byte in X
|
||||
rts
|
||||
|
||||
.endproc
|
||||
@@ -0,0 +1,50 @@
|
||||
; mul40.s
|
||||
;
|
||||
; This file is part of
|
||||
; cc65 - a freeware C compiler for 6502 based systems
|
||||
;
|
||||
; https://github.com/cc65/cc65
|
||||
;
|
||||
; See "LICENSE" file for legal information.
|
||||
;
|
||||
;
|
||||
; unsigned int __fastcall__ _mul40(unsigned char value);
|
||||
;
|
||||
; REMARKS: Function is defined to return with carry-flag cleared
|
||||
|
||||
|
||||
.importzp tmp4
|
||||
.export __mul40
|
||||
|
||||
.proc __mul40 ; = 33 bytes, 48/53 cycles
|
||||
|
||||
sta tmp4 ; remember value for later addition...
|
||||
ldx #0 ; clear high-byte
|
||||
asl a ; * 2
|
||||
bcc mul4 ; high-byte affected?
|
||||
ldx #2 ; this will be the 1st high-bit soon...
|
||||
|
||||
mul4: asl a ; * 4
|
||||
bcc mul5 ; high-byte affected?
|
||||
inx ; => yes, apply to 0 high-bit
|
||||
clc ; prepare addition
|
||||
|
||||
mul5: adc tmp4 ; * 5
|
||||
bcc mul10 ; high-byte affected?
|
||||
inx ; yes, correct...
|
||||
|
||||
mul10: stx tmp4 ; continue with classic shifting...
|
||||
|
||||
asl a ; * 10
|
||||
rol tmp4
|
||||
|
||||
asl a ; * 20
|
||||
rol tmp4
|
||||
|
||||
asl a ; * 40
|
||||
rol tmp4
|
||||
|
||||
ldx tmp4 ; deliver high-byte in X
|
||||
rts
|
||||
|
||||
.endproc
|
||||
Reference in New Issue
Block a user