emailler/drivers/atrprint.s
2018-02-23 16:36:05 +01:00

111 lines
2.5 KiB
ArmAsm

.include "atari.inc"
.include "../inc/common.inc"
.export print_a
.export print_a_inverse
.export print_cr
.export cls
.export beep
.bss
char: .res 1
.code
; use ATARI CIOV function to display 1 char
; inputs: A should be set to ASCII char to display
; outputs: none
print_a:
cmp #10 ; is it a CR?
bne @not_lf
lda #ATEOL ; CR/LF char
@not_lf:
cmp #13 ; is it a LF?
bne @not_cr
lda #ATEOL ; CR/LF char
@not_cr:
sta char
txa
pha
tya
pha
ldax #1
stax ICBLL ; 2-byte buffer length
ldax #char
stax ICBAL ; 2-byte buffer address
ldx #PUTCHR ; put character(s)
stx ICCOM ; COMMAND CODE
ldx #0 ; use IOCB #0
jsr CIOV ; vector to CIO
pla
tay
pla
tax
rts
; use ATARI CIOV function to move to new line
; inputs: none
; outputs: none
print_cr:
lda #ATEOL ; CR/LF char
jmp print_a
; use ATARI CIOV function to clear the screen
; inputs: none
; outputs: none
cls:
lda #ATCLR ; clear screen
jmp print_a
; make a 'beep' noise the same way as the ROM does
; inputs: none
; outputs: none
beep:
tya ; FIXME: why is preservation of Y needed?
pha
ldy #20 ; do the next loop 20 times
@beep1:
ldx #63*2
@beep2:
stx CONSOL ; turn on speaker
lda VCOUNT ; current vertical line
@beep3:
cmp VCOUNT ; still the same?
beq @beep3 ; yes, delay...
dex
dex
bpl @beep2
dey
bpl @beep1
pla
tay
rts
print_a_inverse:
ora #$80 ; turn on top bit
jmp print_a
;-- LICENSE FOR atrprint.s --
; The contents of this file are subject to the Mozilla Public License
; Version 1.1 (the "License"); you may not use this file except in
; compliance with the License. You may obtain a copy of the License at
; http://www.mozilla.org/MPL/
;
; Software distributed under the License is distributed on an "AS IS"
; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
; License for the specific language governing rights and limitations
; under the License.
;
; The Original Code is ip65.
;
; The Initial Developer of the Original Code is Jonno Downes,
; jonno@jamtronix.com.
; Portions created by the Initial Developer are Copyright (C) 2009
; Jonno Downes. All Rights Reserved.
; -- LICENSE END --