Merge pull request #1 from groessler/something_to_pull

replace absolute values with defines from atari.inc
This commit is contained in:
Oliver Schmidt 2015-09-09 14:43:16 +02:00
commit 735dced371
3 changed files with 33 additions and 34 deletions

View File

@ -1,3 +1,5 @@
.include "atari.inc"
.export get_key .export get_key
.export check_for_abort_key .export check_for_abort_key
.export get_key_if_available .export get_key_if_available
@ -24,7 +26,7 @@ get_key:
; inputs: none ; inputs: none
; outputs: A contains ASCII value of key just pressed (0 if no key pressed) ; outputs: A contains ASCII value of key just pressed (0 if no key pressed)
get_key_if_available: get_key_if_available:
lda $02fc ; GLOBAL VARIABLE FOR KEYBOARD lda CH ; GLOBAL VARIABLE FOR KEYBOARD
cmp #255 cmp #255
beq @nokey beq @nokey
ldx iocb ; K: already open? ldx iocb ; K: already open?
@ -32,23 +34,23 @@ get_key_if_available:
ldx #$40 ; IOCB to use for keyboard input ldx #$40 ; IOCB to use for keyboard input
stx iocb ; mark K: as open stx iocb ; mark K: as open
lda #<kname lda #<kname
sta $344,x ; 1-byte low buffer address sta ICBAL,x ; 1-byte low buffer address
lda #>kname lda #>kname
sta $345,x ; 1-byte high buffer address sta ICBAH,x ; 1-byte high buffer address
lda #3 ; open lda #OPEN ; open
sta $342,x ; COMMAND CODE sta ICCOM,x ; COMMAND CODE
lda #4 ; open for input (all devices) lda #OPNIN ; open for input (all devices)
sta $34a,x ; 1-byte first auxiliary information sta ICAX1,x ; 1-byte first auxiliary information
jsr $e456 ; vector to CIO jsr CIOV ; vector to CIO
@read: @read:
lda #0 lda #0
sta $348,x ; 1-byte low buffer length sta ICBLL,x ; 1-byte low buffer length
sta $349,x ; 1-byte high buffer length sta ICBLH,x ; 1-byte high buffer length
lda #7 ; get character(s) lda #GETCHR ; get character(s)
sta $342,x ; COMMAND CODE sta ICCOM,x ; COMMAND CODE
jsr $e456 ; vector to CIO jsr CIOV ; vector to CIO
ldx #255 ldx #255
stx $02fc ; GLOBAL VARIABLE FOR KEYBOARD stx CH ; GLOBAL VARIABLE FOR KEYBOARD
rts rts
@nokey: @nokey:
lda #0 lda #0

View File

@ -1,3 +1,4 @@
.include "atari.inc"
.include "../inc/common.i" .include "../inc/common.i"
.export print_a .export print_a
@ -5,11 +6,6 @@
.export print_cr .export print_cr
.export cls .export cls
.export beep .export beep
.exportzp screen_current_row
.exportzp screen_current_col
screen_current_col = $55 ; 2-byte cursor column
screen_current_row = $54 ; 1-byte cursor row
.bss .bss
@ -25,11 +21,11 @@ char: .res 1
print_a: print_a:
cmp #10 ; is it a CR? cmp #10 ; is it a CR?
bne @not_lf bne @not_lf
lda #155 ; CR/LF char lda #ATEOL ; CR/LF char
@not_lf: @not_lf:
cmp #13 ; is it a LF? cmp #13 ; is it a LF?
bne @not_cr bne @not_cr
lda #155 ; CR/LF char lda #ATEOL ; CR/LF char
@not_cr: @not_cr:
sta char sta char
txa txa
@ -37,13 +33,13 @@ print_a:
tya tya
pha pha
ldax #1 ldax #1
stax $0348 ; 2-byte buffer length stax ICBLL ; 2-byte buffer length
ldax #char ldax #char
stax $0344 ; 2-byte buffer address stax ICBAL ; 2-byte buffer address
ldx #11 ; put character(s) ldx #PUTCHR ; put character(s)
stx $0342 ; COMMAND CODE stx ICCOM ; COMMAND CODE
ldx #0 ldx #0 ; use IOCB #0
jsr $e456 ; vector to CIO jsr CIOV ; vector to CIO
pla pla
tay tay
pla pla
@ -54,21 +50,21 @@ print_a:
; inputs: none ; inputs: none
; outputs: none ; outputs: none
print_cr: print_cr:
lda #155 ; CR/LF char lda #ATEOL ; CR/LF char
jmp print_a jmp print_a
; use ATARI CIOV function to clear the screen ; use ATARI CIOV function to clear the screen
; inputs: none ; inputs: none
; outputs: none ; outputs: none
cls: cls:
lda #125 ; clear screen lda #ATCLR ; clear screen
jmp print_a jmp print_a
; use ATARI CIOV function to make a 'beep' noise ; use ATARI CIOV function to make a 'beep' noise
; inputs: none ; inputs: none
; outputs: none ; outputs: none
beep: beep:
lda #253 ; beep char lda #ATBEL ; beep char
jmp print_a jmp print_a
print_a_inverse: print_a_inverse:

View File

@ -4,6 +4,7 @@
; 1000 units per second. it doesn't have to be particularly accurate. ; 1000 units per second. it doesn't have to be particularly accurate.
; this Atari implementation requires the routine timer_vbl_handler be called 60 times per second ; this Atari implementation requires the routine timer_vbl_handler be called 60 times per second
.include "atari.inc"
.include "../inc/common.i" .include "../inc/common.i"
.export timer_init .export timer_init
@ -32,12 +33,12 @@ vbichain: .word 0
timer_init: timer_init:
lda vbichain+1 lda vbichain+1
bne @handler_installed bne @handler_installed
ldax $222 ; IMMEDIATE VERTICAL BLANK NMI VECTOR ldax VVBLKI ; IMMEDIATE VERTICAL BLANK NMI VECTOR
stax vbichain ; save old immediate vector stax vbichain ; save old immediate vector
ldy #<timer_vbl_handler ldy #<timer_vbl_handler
ldx #>timer_vbl_handler ldx #>timer_vbl_handler
lda #6 ; STAGE 1 VBI lda #6 ; STAGE 1 VBI
jsr $e45c ; vector to set VBLANK parameters jsr SETVBV ; vector to set VBLANK parameters
@handler_installed: @handler_installed:
lda #0 lda #0
sta current_time_value sta current_time_value
@ -52,7 +53,7 @@ timer_exit:
ldy vbichain ldy vbichain
ldx vbichain+1 ldx vbichain+1
lda #6 ; STAGE 1 VBI lda #6 ; STAGE 1 VBI
jsr $e45c ; vector to set VBLANK parameters jsr SETVBV ; vector to set VBLANK parameters
@handler_not_installed: @handler_not_installed:
rts rts
@ -104,7 +105,7 @@ timer_vbl_handler:
: sta current_seconds : sta current_seconds
@done: @done:
pla pla
jmp $e45f ; vector to process immediate VBLANK jmp SYSVBV ; vector to process immediate VBLANK
timer_seconds: timer_seconds:
lda current_seconds lda current_seconds