git-svn-id: http://svn.code.sf.net/p/netboot65/code@303 93682198-c243-4bdb-bd91-e943c89aac3b

This commit is contained in:
jonnosan 2011-01-08 11:24:25 +00:00
parent 464fef626b
commit b955d8a029
7 changed files with 109 additions and 85 deletions

View File

@ -24,19 +24,15 @@ all: $(DRIVERS)
apple2prog.lib: a2print.o uthernet.o a2timer.o a2kernal.o a2input.o a2charconv.o cs8900a.o
ar65 a $@ $^
c64rrnet.lib: c64print.o rr-net.o c64timer.o c64kernal.o c64inputs.o c64_disk_access.o c64charconv.o c64_vt100.o cs8900a.o
c64rrnet.lib: c64print.o rr-net.o c64timer.o c64kernal.o c64inputs.o cbm_disk_access.o petscii_charconv.o c64_vt100.o cs8900a.o
ar65 a $@ $^
c64wiznet.lib: w5100.o c64print.o c64timer.o c64kernal.o c64inputs.o c64_disk_access.o c64charconv.o c64_vt100.o
c64wiznet.lib: w5100.o c64print.o c64timer.o c64kernal.o c64inputs.o cbm_disk_access.o petscii_charconv.o c64_vt100.o
ar65 a $@ $^
vic20rrnet.lib: c64print.o vic20-rr-net.o vic20timer.o c64kernal.o c64inputs.o c64_disk_access.o c64charconv.o cs8900a.o
vic20rrnet.lib: vic20print.o vic20-rr-net.o vic20timer.o cbm_disk_access.o petscii_charconv.o cs8900a.o
ar65 a $@ $^
# ar65 a $@ $^
clean:
rm -f *.o
rm -f *.lib

View File

@ -7,7 +7,7 @@
.export timer_init
.export timer_read
.export timer_seconds ; this should return a single BCD byte (00..59) which is a count of seconds
.code
; initialize timers
@ -28,8 +28,14 @@ timer_init:
lda #$c1 ; timer B to count timer A underflows
sta $dd0f
lda #0
sta $dc08
sta $dc09
rts
timer_seconds:
lda $dc09
rts
; return the current value
timer_read:

View File

@ -1,76 +0,0 @@
; timer routines
;
; the timer should be a 16-bit counter that's incremented by about
; 1000 units per second. it doesn't have to be particularly accurate.
; this C64 implementation requires the routine timer_vbl_handler be called 60 times per second
; this is for use in the NB65 ROM, where we also install an IRQ handler
; for normal userland programs where it is known what else is going on with the timer ,
; use "c64timer.s" routines instead
.include "../inc/common.i"
.export timer_init
.export timer_read
.export timer_vbl_handler
.bss
current_time_value: .res 2
.code
;reset timer to 0
;inputs: none
;outputs: none
timer_init:
ldax #0
stax current_time_value
rts
;read the current timer value
; inputs: none
; outputs: AX = current timer value (roughly equal to number of milliseconds since the last call to 'timer_init')
timer_read:
ldax current_time_value
rts
; tick over the current timer value - should be called 60 times per second
; inputs: none
; outputs: none (all registers preserved, by carry flag can be modified)
timer_vbl_handler:
pha
lda $02A6 ;PAL/NTSC flag (0 = NTSC, 1 = PAL),
beq @was_ntsc
lda #$14 ;PAL = 50 HZ =~ 20 ms per 'tick'
bne :+
@was_ntsc:
lda #$11 ;NTSC = 60 HZ =~ 17 ms per 'tick'
:
adc current_time_value
sta current_time_value
bcc :+
inc current_time_value+1
:
pla
rts
;-- LICENSE FOR c64timer_nb65.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 --

View File

@ -0,0 +1,95 @@
.export print_a
.export print_cr
.export cls
.export beep
.export print_a_inverse
.import timer_read
.exportzp screen_current_row
.exportzp screen_current_col
screen_current_row=$d6
screen_current_col=$d3
;use VIC 20 Kernel ROM function to print a character to the screen
;inputs: A contains petscii value of character to print
;outputs: none
print_a = $ffd2
.bss
beep_timer: .res 1
.code
;use VIC 20 Kernel ROM function to move to a new line
;inputs: none
;outputs: none
print_cr:
lda #13
jmp print_a
;use VIC 20 Kernel ROM function to clear the screen
;inputs: none
;outputs: none
cls:
lda #147 ; 'CLR/HOME'
jmp print_a
;currently does nothing (should make a 'beep noise')
;inputs: none
;outputs: none
beep:
lda $900e
ora #15
sta $900e ;set volume
;turn on osc. 3
lda #$FF
sta $900c
; pause for qtr second
jsr timer_read
stx beep_timer
inc beep_timer
inc beep_timer
:
jsr timer_read
cpx beep_timer
bne :-
;turn off osc. 3
lda #$00
sta $900c
rts
;print a single char in inverse text:
print_a_inverse:
pha
lda #18 ;inverse mode on
jsr print_a
pla
jsr print_a
lda #146 ;inverse mode off
jmp print_a
; 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 --

View File

@ -9,6 +9,7 @@
.export timer_init
.export timer_read
.export timer_seconds
IRQ_VECTOR=$314
@ -51,7 +52,6 @@ timer_read:
timer_vbl_handler:
pha
lda #$11 ; 60 HZ =~ 17 ms per 'tick'
:
adc current_time_value
sta current_time_value
bcc :+
@ -60,6 +60,9 @@ timer_vbl_handler:
pla
jmp jmp_old_handler
timer_seconds:
lda #0
rts
;-- LICENSE FOR c64timer_nb65.s --
; The contents of this file are subject to the Mozilla Public License