2021-12-21 18:08:33 +00:00
|
|
|
%import textio
|
2022-01-08 00:33:40 +00:00
|
|
|
%import floats
|
2022-01-08 12:45:00 +00:00
|
|
|
%import test_stack
|
2022-01-01 15:35:36 +00:00
|
|
|
%zeropage basicsafe
|
2021-12-15 22:43:14 +00:00
|
|
|
|
2021-10-30 13:15:11 +00:00
|
|
|
main {
|
2022-01-13 01:29:55 +00:00
|
|
|
%option force_output
|
|
|
|
|
2022-01-01 15:35:36 +00:00
|
|
|
sub start() {
|
2022-01-09 17:49:44 +00:00
|
|
|
|
2022-01-13 01:29:55 +00:00
|
|
|
ubyte foobar = 2
|
|
|
|
str @shared @zp name = "irmen"
|
|
|
|
ubyte[] @shared @zp array = [1,2,3,4]
|
2022-01-09 12:10:01 +00:00
|
|
|
|
2022-01-13 01:29:55 +00:00
|
|
|
txt.print_uwhex(&name, true)
|
2022-01-11 20:10:40 +00:00
|
|
|
txt.nl()
|
2022-01-13 01:29:55 +00:00
|
|
|
txt.print_uwhex(&name, true)
|
|
|
|
txt.print_ub(foobar)
|
2022-01-11 20:10:40 +00:00
|
|
|
txt.nl()
|
|
|
|
|
2022-01-13 01:29:55 +00:00
|
|
|
; float fl
|
|
|
|
; test_stack.test()
|
|
|
|
;
|
|
|
|
; fl = addfloat3(addfloat2(addfloat1(1.234)))
|
|
|
|
; floats.print_f(fl)
|
|
|
|
; txt.nl()
|
|
|
|
;
|
|
|
|
; fl = 1.234 |> addfloat1 |> addfloat2 |> addfloat3
|
|
|
|
; floats.print_f(fl)
|
|
|
|
; txt.nl()
|
|
|
|
; 1.234 |> addfloat1
|
|
|
|
; |> addfloat2 |> addfloat3 |> floats.print_f
|
|
|
|
; txt.nl()
|
|
|
|
;
|
|
|
|
; txt.print_uw(times_two(add_one(sin8u(add_one(assemblything(9+3))))))
|
|
|
|
; txt.nl()
|
|
|
|
;
|
|
|
|
; 9+3 |> assemblything
|
|
|
|
; |> add_one
|
|
|
|
; |> sin8u
|
|
|
|
; |> add_one
|
|
|
|
; |> times_two
|
|
|
|
; |> txt.print_uw
|
|
|
|
; txt.nl()
|
|
|
|
;
|
|
|
|
; uword @shared uw= 9+3 |> assemblything
|
|
|
|
; |> add_one
|
|
|
|
; |> sin8u
|
|
|
|
; |> add_one
|
|
|
|
; |> times_two
|
|
|
|
; txt.print_uw(uw)
|
|
|
|
; txt.nl()
|
|
|
|
; test_stack.test()
|
2022-01-06 21:45:36 +00:00
|
|
|
}
|
2022-01-03 22:38:41 +00:00
|
|
|
|
2022-01-09 16:08:50 +00:00
|
|
|
sub func() -> ubyte {
|
|
|
|
txt.print("func!\n")
|
|
|
|
return 99
|
|
|
|
}
|
|
|
|
|
2022-01-08 12:45:00 +00:00
|
|
|
sub addfloat1(float fl) -> float {
|
2022-01-08 00:33:40 +00:00
|
|
|
return fl+1.11
|
|
|
|
}
|
2022-01-08 12:45:00 +00:00
|
|
|
|
|
|
|
sub addfloat2(float fl) -> float {
|
|
|
|
return fl+2.22
|
|
|
|
}
|
|
|
|
|
|
|
|
sub addfloat3(float fl) -> float {
|
|
|
|
return fl+3.33
|
|
|
|
}
|
|
|
|
|
2022-01-06 21:45:36 +00:00
|
|
|
sub add_one(ubyte input) -> ubyte {
|
|
|
|
return input+1
|
2021-12-25 01:34:00 +00:00
|
|
|
}
|
|
|
|
|
2022-01-06 21:45:36 +00:00
|
|
|
sub times_two(ubyte input) -> uword {
|
2022-01-11 20:10:40 +00:00
|
|
|
return input*$0002
|
2022-01-06 21:45:36 +00:00
|
|
|
}
|
2022-01-08 00:33:40 +00:00
|
|
|
|
2022-01-08 16:41:46 +00:00
|
|
|
asmsub assemblything(ubyte input @A) clobbers(X,Y) -> ubyte @A {
|
2022-01-08 00:33:40 +00:00
|
|
|
%asm {{
|
2022-01-09 15:18:13 +00:00
|
|
|
ldx #64
|
2022-01-08 00:33:40 +00:00
|
|
|
asl a
|
|
|
|
rts
|
|
|
|
}}
|
|
|
|
}
|
2021-05-12 22:35:22 +00:00
|
|
|
}
|
2022-01-06 21:45:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
;main {
|
|
|
|
; sub start() {
|
|
|
|
; %asm {{
|
|
|
|
; lda #<float5_111
|
|
|
|
; ldy #>float5_111
|
|
|
|
; jsr floats.MOVFM
|
|
|
|
; lda #<float5_122
|
|
|
|
; ldy #>float5_122
|
|
|
|
; jsr floats.FADD
|
|
|
|
; jsr floats.FOUT
|
|
|
|
; sta $7e
|
|
|
|
; sty $7f
|
2022-01-09 15:18:13 +00:00
|
|
|
; ldy #64
|
2022-01-06 21:45:36 +00:00
|
|
|
;_loop
|
|
|
|
; lda ($7e),y
|
|
|
|
; beq _done
|
|
|
|
; jsr c64.CHROUT
|
|
|
|
; iny
|
|
|
|
; bne _loop
|
|
|
|
;_done
|
|
|
|
; rts
|
|
|
|
;
|
2022-01-09 15:18:13 +00:00
|
|
|
;float5_111 .byte $81, $64e, $14, $7a, $e1 ; float 1.11
|
2022-01-06 21:45:36 +00:00
|
|
|
;float5_122 .byte $81, $1c, $28, $f5, $c2 ; float 1.22
|
|
|
|
;
|
|
|
|
; }}
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
;}
|