Merge pull request #74 from FreddyOffenga/master

temporary fix for chrout and newline for atari and added two examples
This commit is contained in:
Irmen de Jong 2022-02-24 22:30:59 +01:00 committed by GitHub
commit 685ad1746e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()
}
}