Merge remote-tracking branch 'origin/master'

This commit is contained in:
Irmen de Jong 2022-02-24 22:52:08 +01:00
commit 6185d5eca1
3 changed files with 66 additions and 2 deletions

View File

@ -21,7 +21,7 @@ sub home() {
}
sub nl() {
txt.chrout('\n')
txt.chrout(155)
}
sub spc() {
@ -118,7 +118,28 @@ asmsub scroll_down (ubyte alsocolors @ Pc) clobbers(A) {
}
romsub $FFD2 = chrout(ubyte char @ A) ; TODO
romsub $F2B0 = outchar(ubyte char @ A)
romsub $F2Fd = waitkey()
asmsub chrout(ubyte char @ A) {
%asm {{
sta _tmp_outchar+1
pha
txa
pha
tya
pha
_tmp_outchar
lda #0
jsr outchar
pla
tay
pla
tax
pla
rts
}}
}
asmsub print (str text @ AY) clobbers(A,Y) {
; ---- print null terminated string from A/Y

View File

@ -0,0 +1,30 @@
%import textio
%zeropage basicsafe
%address $2000
; This example computes the first 20 values of the Fibonacci sequence.
; Note: this program is compatible with atari.
main {
sub start() {
txt.print("fibonacci sequence")
txt.nl()
repeat 21 {
txt.print_uw(fib_next())
txt.nl()
}
txt.waitkey()
}
uword fib_prev = 0
uword fib_current = 1
sub fib_next() -> uword {
uword new = fib_current + fib_prev
fib_prev = fib_current
fib_current = new
return fib_prev
}
}

13
examples/atari/hello.p8 Normal file
View File

@ -0,0 +1,13 @@
%import textio
%zeropage basicsafe
%address $2000
; hello world test for Atari 8-bit
main {
sub start() {
txt.print("Hello, World!")
txt.nl()
txt.waitkey()
}
}