prog8/prog8lib/prog8lib.p8

77 lines
1.0 KiB
Plaintext
Raw Normal View History

2018-09-15 14:21:05 +00:00
; Prog8 internal library routines - always included by the compiler
2017-12-30 12:34:52 +00:00
;
2018-01-08 02:31:23 +00:00
; Written by Irmen de Jong (irmen@razorvine.net) - license: GNU GPL 3.0
2018-01-13 13:17:18 +00:00
;
2017-12-30 12:34:52 +00:00
; indent format: TABS, size=8
2018-09-15 14:21:05 +00:00
~ prog8_lib {
2017-12-30 19:03:19 +00:00
; note: the following ZP scratch registers must be the same as in c64lib
memory ubyte SCRATCH_ZP1 = $02 ; scratch register #1 in ZP
memory ubyte SCRATCH_ZP2 = $03 ; scratch register #2 in ZP
memory uword SCRATCH_ZPWORD1 = $fb ; scratch word in ZP ($fb/$fc)
memory uword SCRATCH_ZPWORD2 = $fd ; scratch word in ZP ($fd/$fe)
2017-12-30 12:34:52 +00:00
2018-08-12 23:30:33 +00:00
%asm {{
2017-12-30 12:34:52 +00:00
; 16-bit rotate right (as opposed to the 6502's usual 17-bit rotate with carry)
; the word is placed in SCRATCH_ZPWORD1
ror2_word
lsr SCRATCH_ZPWORD1+1
ror SCRATCH_ZPWORD1
2018-02-03 00:44:14 +00:00
bcc +
lda SCRATCH_ZPWORD1+1
ora #$80
sta SCRATCH_ZPWORD1+1
2018-02-04 21:00:08 +00:00
+ rts
2018-10-23 23:39:52 +00:00
; @todo: stubs for now
ub2float
rts
uw2float
rts
push_float
rts
pop_var_float
rts
copy_float
rts
inc_var_f
rts
dec_var_f
rts
div_f
rts
add_f
rts
sub_f
rts
mul_f
rts
sub_uw
rts
less_ub
rts
less_f
rts
2018-08-12 23:30:33 +00:00
}}
2017-12-30 12:34:52 +00:00
}