mirror of
https://github.com/uffejakobsen/acme.git
synced 2024-11-12 14:04:28 +00:00
ACME_Lib: changed macro parameters to cheap locals (there should be no change in functionality)
git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@102 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
parent
6ff2e95da8
commit
b31e6c4e70
@ -1,4 +1,4 @@
|
||||
;ACME 0.95
|
||||
;ACME 0.96.4
|
||||
|
||||
!ifdef lib_6502_std_a !eof
|
||||
lib_6502_std_a = 1
|
||||
@ -22,57 +22,57 @@ lib_6502_std_a = 1
|
||||
}
|
||||
|
||||
; increase 16-bit counter
|
||||
!macro inc16 .t {
|
||||
inc .t
|
||||
!macro inc16 @t {
|
||||
inc @t
|
||||
bne +
|
||||
inc .t + 1
|
||||
inc @t + 1
|
||||
+
|
||||
}
|
||||
|
||||
; far branches
|
||||
!macro bcc .t {
|
||||
!macro bcc @t {
|
||||
bcs +
|
||||
jmp .t
|
||||
jmp @t
|
||||
+
|
||||
}
|
||||
!macro bcs .t {
|
||||
!macro bcs @t {
|
||||
bcc +
|
||||
jmp .t
|
||||
jmp @t
|
||||
+
|
||||
}
|
||||
|
||||
!macro beq .t {
|
||||
!macro beq @t {
|
||||
bne +
|
||||
jmp .t
|
||||
jmp @t
|
||||
+
|
||||
}
|
||||
|
||||
!macro bne .t {
|
||||
!macro bne @t {
|
||||
beq +
|
||||
jmp .t
|
||||
jmp @t
|
||||
+
|
||||
}
|
||||
|
||||
!macro bmi .t {
|
||||
!macro bmi @t {
|
||||
bpl +
|
||||
jmp .t
|
||||
jmp @t
|
||||
+
|
||||
}
|
||||
|
||||
!macro bpl .t {
|
||||
!macro bpl @t {
|
||||
bmi +
|
||||
jmp .t
|
||||
jmp @t
|
||||
+
|
||||
}
|
||||
|
||||
!macro bvc .t {
|
||||
!macro bvc @t {
|
||||
bvs +
|
||||
jmp .t
|
||||
jmp @t
|
||||
+
|
||||
}
|
||||
|
||||
!macro bvs .t {
|
||||
!macro bvs @t {
|
||||
bvc +
|
||||
jmp .t
|
||||
jmp @t
|
||||
+
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
;ACME 0.96.3
|
||||
;ACME 0.96.4
|
||||
|
||||
!ifdef lib_65816_std_a !eof
|
||||
lib_65816_std_a = 2
|
||||
@ -72,11 +72,11 @@ lib_65816_std_a = 2
|
||||
+i8
|
||||
}
|
||||
|
||||
!macro inc24 .t {; increase 24-bit counter
|
||||
inc .t
|
||||
!macro inc24 @t {; increase 24-bit counter
|
||||
inc @t
|
||||
bne +
|
||||
inc .t + 1
|
||||
inc @t + 1
|
||||
bne +
|
||||
inc .t + 2
|
||||
inc @t + 2
|
||||
+
|
||||
}
|
||||
|
@ -19,32 +19,32 @@ lib_cbm_c64_float_a = 2
|
||||
; convenience macros:
|
||||
|
||||
; some float functions need a memory address in YYAA
|
||||
!macro movYYAA .adr {
|
||||
lda #<.adr
|
||||
ldy #>.adr
|
||||
!macro movYYAA @addr {
|
||||
lda #<@addr
|
||||
ldy #>@addr
|
||||
}
|
||||
; ...or in YYXX
|
||||
!macro movYYXX .adr {
|
||||
ldx #<.adr
|
||||
ldy #>.adr
|
||||
!macro movYYXX @addr {
|
||||
ldx #<@addr
|
||||
ldy #>@addr
|
||||
}
|
||||
; other float functions expect or output a value in AAYY
|
||||
!macro movAAYY .val {
|
||||
ldy #<.val
|
||||
lda #>.val
|
||||
!macro movAAYY @val {
|
||||
ldy #<@val
|
||||
lda #>@val
|
||||
}
|
||||
!macro ldAAYY .adr {
|
||||
ldy .adr
|
||||
lda .adr + 1
|
||||
!macro ldAAYY @addr {
|
||||
ldy @addr
|
||||
lda @addr + 1
|
||||
}
|
||||
!macro stAAYY .adr {
|
||||
sty .adr
|
||||
sta .adr + 1
|
||||
!macro stAAYY @addr {
|
||||
sty @addr
|
||||
sta @addr + 1
|
||||
}
|
||||
; ...or in AAXX
|
||||
!macro ldAAXX .adr {
|
||||
ldx .adr
|
||||
lda .adr + 1
|
||||
!macro ldAAXX @addr {
|
||||
ldx @addr
|
||||
lda @addr + 1
|
||||
}
|
||||
|
||||
!address {
|
||||
@ -118,12 +118,12 @@ lib_cbm_c64_float_a = 2
|
||||
}
|
||||
|
||||
; wrappers for names from older version of this file:
|
||||
!macro movAY .adr { +movYYAA .adr }
|
||||
!macro movXY .adr { +movYYXX .adr }
|
||||
!macro movYA .val { +movAAYY .val }
|
||||
!macro ldYA .adr { +ldAAYY .adr }
|
||||
!macro stYA .adr { +stAAYY .adr }
|
||||
!macro ldXA .adr { +ldAAXX .adr }
|
||||
!macro movAY @addr { +movYYAA @addr }
|
||||
!macro movXY @addr { +movYYXX @addr }
|
||||
!macro movYA @val { +movAAYY @val }
|
||||
!macro ldYA @addr { +ldAAYY @addr }
|
||||
!macro stYA @addr { +stAAYY @addr }
|
||||
!macro ldXA @addr { +ldAAXX @addr }
|
||||
fac1_to_signedYA = fac1_to_signedAAYY
|
||||
fac1_read_signedYA = fac1_read_signedAAYY
|
||||
fac1_to_unsignedYA = fac1_to_unsignedAAYY
|
||||
|
@ -1,4 +1,4 @@
|
||||
;ACME 0.95.7
|
||||
;ACME 0.96.4
|
||||
|
||||
!ifdef lib_cbm_c64_memcopy_a !eof
|
||||
lib_cbm_c64_memcopy_a = 1
|
||||
@ -11,24 +11,23 @@ lib_cbm_c64_memcopy_a = 1
|
||||
; higher addresses are copied first, so:
|
||||
; - moving data to higher addresses works even if areas overlap
|
||||
; - moving data to lower addresses only works if areas do not overlap
|
||||
!macro basic_memcopy .src_start, .src_end, .target_start {
|
||||
!address {
|
||||
.z_target_end = $58
|
||||
.z_src_end = $5a
|
||||
.z_src_start = $5f
|
||||
.fn = $a3bf
|
||||
}
|
||||
lda #<.src_start
|
||||
ldx #>.src_start
|
||||
sta .z_src_start
|
||||
stx .z_src_start + 1
|
||||
lda #<.src_end
|
||||
ldx #>.src_end
|
||||
sta .z_src_end
|
||||
stx .z_src_end + 1
|
||||
lda #<(.target_start + .src_end - .src_start)
|
||||
ldx #>(.target_start + .src_end - .src_start)
|
||||
sta .z_target_end
|
||||
stx .z_target_end + 1
|
||||
jsr .fn
|
||||
!macro basic_memcopy @src_start, @src_end, @target_start {
|
||||
!addr @z_target_end = $58
|
||||
!addr @z_src_end = $5a
|
||||
!addr @z_src_start = $5f
|
||||
!addr @fn = $a3bf
|
||||
|
||||
lda #<@src_start
|
||||
ldx #>@src_start
|
||||
sta @z_src_start
|
||||
stx @z_src_start + 1
|
||||
lda #<@src_end
|
||||
ldx #>@src_end
|
||||
sta @z_src_end
|
||||
stx @z_src_end + 1
|
||||
lda #<(@target_start + @src_end - @src_start)
|
||||
ldx #>(@target_start + @src_end - @src_start)
|
||||
sta @z_target_end
|
||||
stx @z_target_end + 1
|
||||
jsr @fn
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
;ACME 0.94.5
|
||||
;ACME 0.96.4
|
||||
|
||||
!ifdef lib_cbm_flpt_a !eof
|
||||
lib_cbm_flpt_a = 1
|
||||
@ -46,48 +46,48 @@ lib_cbm_flpt_a = 1
|
||||
|
||||
; this is ugly, but it gets the job done
|
||||
; (if it's stupid, but it works, then it's not stupid)
|
||||
!macro flpt .value {
|
||||
!set .float = float(.value) ; make sure to do passes until value is defined
|
||||
!ifndef .float {
|
||||
!macro flpt @value {
|
||||
!set @float = float(@value) ; make sure to do passes until value is defined
|
||||
!ifndef @float {
|
||||
!by $ff, $ff, $ff, $ff, $ff, $ff ; six place holder bytes
|
||||
} else {
|
||||
; value is defined, so split up into sign and non-negative value
|
||||
!if .float < 0 {
|
||||
!set .sign = $80
|
||||
!set .float = -.float
|
||||
!if @float < 0 {
|
||||
!set @sign = $80
|
||||
!set @float = -@float
|
||||
} else {
|
||||
!set .sign = $00
|
||||
!set @sign = $00
|
||||
}
|
||||
!if .float = 0 {
|
||||
!if @float = 0 {
|
||||
!by 0, 0, 0, 0, 0, 0 ; six zeroes (zero is represented by all bits zero)
|
||||
} else {
|
||||
; split up into exponent and mantissa
|
||||
!set .exponent = 128 + 32 ; 128 is cbm's bias, 32 is this algo's bias
|
||||
!set @exponent = 128 + 32 ; 128 is cbm's bias, 32 is this algo's bias
|
||||
; if mantissa is too large, shift right and adjust exponent
|
||||
!do while .float >= (2.0 ^ 32.0) {
|
||||
!set .float = .float >> 1
|
||||
!set .exponent = .exponent + 1
|
||||
!do while @float >= (2.0 ^ 32.0) {
|
||||
!set @float = @float >> 1
|
||||
!set @exponent = @exponent + 1
|
||||
}
|
||||
; if mantissa is too small, shift left and adjust exponent
|
||||
!do while .float < (2.0 ^ 31.0) {
|
||||
!set .float = .float << 1
|
||||
!set .exponent = .exponent - 1
|
||||
!do while @float < (2.0 ^ 31.0) {
|
||||
!set @float = @float << 1
|
||||
!set @exponent = @exponent - 1
|
||||
}
|
||||
!if .exponent < 1 {
|
||||
!if @exponent < 1 {
|
||||
!warn "FLPT underflow, using zero instead"
|
||||
!set .float = 0
|
||||
!set .exponent = 0
|
||||
!set .sign = 0
|
||||
!set @float = 0
|
||||
!set @exponent = 0
|
||||
!set @sign = 0
|
||||
}
|
||||
!if .exponent > 255 {
|
||||
!if @exponent > 255 {
|
||||
!error "FLPT overflow"
|
||||
}
|
||||
!by .exponent
|
||||
!by 255 & int(.float >> 24)
|
||||
!by 255 & int(.float >> 16)
|
||||
!by 255 & int(.float >> 8)
|
||||
!by 255 & int(.float)
|
||||
!by .sign
|
||||
!by @exponent
|
||||
!by 255 & int(@float >> 24)
|
||||
!by 255 & int(@float >> 16)
|
||||
!by 255 & int(@float >> 8)
|
||||
!by 255 & int(@float)
|
||||
!by @sign
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,47 +41,47 @@ lib_cbm_mflpt_a = 1
|
||||
|
||||
; this is ugly, but it gets the job done
|
||||
; (if it's stupid, but it works, then it's not stupid)
|
||||
!macro mflpt .value {
|
||||
!set .float = float(.value) ; make sure to do passes until value is defined
|
||||
!ifndef .float {
|
||||
!macro mflpt @value {
|
||||
!set @float = float(@value) ; make sure to do passes until value is defined
|
||||
!ifndef @float {
|
||||
!by $ff, $ff, $ff, $ff, $ff ; five place holder bytes
|
||||
} else {
|
||||
; value is defined, so split up into sign and non-negative value
|
||||
!if .float < 0 {
|
||||
!set .sign = $80
|
||||
!set .float = -.float
|
||||
!if @float < 0 {
|
||||
!set @sign = $80
|
||||
!set @float = -@float
|
||||
} else {
|
||||
!set .sign = $00
|
||||
!set @sign = $00
|
||||
}
|
||||
!if .float = 0 {
|
||||
!if @float = 0 {
|
||||
!by 0, 0, 0, 0, 0 ; five zeroes (zero is represented by all bits zero)
|
||||
} else {
|
||||
; split up into exponent and mantissa
|
||||
!set .exponent = 128 + 32 ; 128 is cbm's bias, 32 is this algo's bias
|
||||
!set @exponent = 128 + 32 ; 128 is cbm's bias, 32 is this algo's bias
|
||||
; if mantissa is too large, shift right and adjust exponent
|
||||
!do while .float >= (2.0 ^ 32.0) {
|
||||
!set .float = .float >> 1
|
||||
!set .exponent = .exponent + 1
|
||||
!do while @float >= (2.0 ^ 32.0) {
|
||||
!set @float = @float >> 1
|
||||
!set @exponent = @exponent + 1
|
||||
}
|
||||
; if mantissa is too small, shift left and adjust exponent
|
||||
!do while .float < (2.0 ^ 31.0) {
|
||||
!set .float = .float << 1
|
||||
!set .exponent = .exponent - 1
|
||||
!do while @float < (2.0 ^ 31.0) {
|
||||
!set @float = @float << 1
|
||||
!set @exponent = @exponent - 1
|
||||
}
|
||||
!if .exponent < 1 {
|
||||
!if @exponent < 1 {
|
||||
!warn "MFLPT underflow, using zero instead"
|
||||
!set .float = 0
|
||||
!set .exponent = 0
|
||||
!set .sign = 0
|
||||
!set @float = 0
|
||||
!set @exponent = 0
|
||||
!set @sign = 0
|
||||
}
|
||||
!if .exponent > 255 {
|
||||
!if @exponent > 255 {
|
||||
!error "MFLPT overflow"
|
||||
}
|
||||
!by .exponent
|
||||
!by (127 & int(.float >> 24)) | .sign
|
||||
!by 255 & int(.float >> 16)
|
||||
!by 255 & int(.float >> 8)
|
||||
!by 255 & int(.float)
|
||||
!by @exponent
|
||||
!by (127 & int(@float >> 24)) | @sign
|
||||
!by 255 & int(@float >> 16)
|
||||
!by 255 & int(@float >> 8)
|
||||
!by 255 & int(@float)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user