mirror of
https://github.com/a2stuff/vnIIc.git
synced 2024-06-18 03:29:29 +00:00
reformat, dedupe
This commit is contained in:
parent
efeff6cdb9
commit
684b82ca56
Binary file not shown.
|
@ -2,6 +2,12 @@ ca65 V2.16 - Git f5e9b401
|
|||
Main file : client.s
|
||||
Current file: client.s
|
||||
|
||||
000000r 1 ;;;-------------------------------------------------------------------
|
||||
000000r 1 ;;;
|
||||
000000r 1 ;;; vnIIc Client Application
|
||||
000000r 1 ;;;
|
||||
000000r 1 ;;;-------------------------------------------------------------------
|
||||
000000r 1
|
||||
000000r 1 PADDLE_SUPPORT = 1
|
||||
000000r 1 ;;; MOUSE_SUPPORT = 1
|
||||
000000r 1
|
||||
|
@ -72,13 +78,38 @@ Current file: client.s
|
|||
000000r 2 BUTN1 := $C062 ; Closed-Apple Key
|
||||
000000r 2
|
||||
000000r 1
|
||||
000000r 1 .include "macros.inc"
|
||||
000000r 2 ;;;---------------------------------------------------------
|
||||
000000r 2 ;;;
|
||||
000000r 2 ;;; Generic Macros
|
||||
000000r 2 ;;;
|
||||
000000r 2 ;;;---------------------------------------------------------
|
||||
000000r 2
|
||||
000000r 2 .macro SaveRegisters
|
||||
000000r 2 pha
|
||||
000000r 2 txa
|
||||
000000r 2 pha
|
||||
000000r 2 tya
|
||||
000000r 2 pha
|
||||
000000r 2 .endmacro
|
||||
000000r 2
|
||||
000000r 2 .macro RestoreRegisters
|
||||
000000r 2 pla
|
||||
000000r 2 tay
|
||||
000000r 2 pla
|
||||
000000r 2 tax
|
||||
000000r 2 pla
|
||||
000000r 2 .endmacro
|
||||
000000r 2
|
||||
000000r 1
|
||||
000000r 1 ;;;---------------------------------------------------------
|
||||
000000r 1 ;;; Hi-res graphics constants/locations
|
||||
000000r 1 ;;;---------------------------------------------------------
|
||||
000000r 1
|
||||
000000r 1 PLOTPAGE := $E6 ; Active hires plotting page (Applesoft)
|
||||
000000r 1 PLOTPAGE1 := $20
|
||||
000000r 1 PLOTPAGE2 := $40
|
||||
000000r 1 PAGE := $E6 ; Active hires plotting page (Applesoft)
|
||||
000000r 1 PAGE1 := $20
|
||||
000000r 1 PAGE2 := $40
|
||||
000000r 1
|
||||
000000r 1 PAGESIZE := $20 ; Size of hi-res screen in pages
|
||||
000000r 1
|
||||
000000r 1 ;;;---------------------------------------------------------
|
||||
|
@ -88,6 +119,8 @@ Current file: client.s
|
|||
000000r 1 PREAD := $FB1E ; Monitor paddle reading routine, call
|
||||
000000r 1 ; with paddle # in X, returns value in Y
|
||||
000000r 1
|
||||
000000r 1 HCLR := $F3F2 ; Clear current hires screen to black
|
||||
000000r 1
|
||||
000000r 1 ;;;---------------------------------------------------------
|
||||
000000r 1 ;;; Other
|
||||
000000r 1 ;;;---------------------------------------------------------
|
||||
|
@ -96,38 +129,13 @@ Current file: client.s
|
|||
000000r 1
|
||||
000000r 1 ZP_PTR := $FA ; Write cursor location on zero page
|
||||
000000r 1
|
||||
000000r 1 ;;;---------------------------------------------------------
|
||||
000000r 1 ;;; Generic Macros
|
||||
000000r 1 ;;;---------------------------------------------------------
|
||||
000000r 1
|
||||
000000r 1 ;;;----------------------------------------
|
||||
000000r 1 .macro SaveRegisters
|
||||
000000r 1 ;;;----------------------------------------
|
||||
000000r 1 pha
|
||||
000000r 1 txa
|
||||
000000r 1 pha
|
||||
000000r 1 tya
|
||||
000000r 1 pha
|
||||
000000r 1 .endmacro
|
||||
000000r 1
|
||||
000000r 1 ;;;----------------------------------------
|
||||
000000r 1 .macro RestoreRegisters
|
||||
000000r 1 ;;;----------------------------------------
|
||||
000000r 1 pla
|
||||
000000r 1 tay
|
||||
000000r 1 pla
|
||||
000000r 1 tax
|
||||
000000r 1 pla
|
||||
000000r 1 .endmacro
|
||||
000000r 1
|
||||
000000r 1
|
||||
000000r 1 ;;;-------------------------------------------------------------------
|
||||
000000r 1 ;;;
|
||||
000000r 1 ;;; Application-level logic
|
||||
000000r 1 ;;; Client Code
|
||||
000000r 1 ;;;
|
||||
000000r 1 ;;;-------------------------------------------------------------------
|
||||
000000r 1
|
||||
000000r 1
|
||||
000000r 1 .org $6000
|
||||
006000 1 4C 60 60 jmp AppEntry
|
||||
006003 1
|
||||
|
@ -166,10 +174,9 @@ Current file: client.s
|
|||
006007 2
|
||||
006007 2
|
||||
006007 2 ;;;---------------------------------------------------------
|
||||
006007 2 .proc Init
|
||||
006007 2 ;;;---------------------------------------------------------
|
||||
006007 2 ;;; Initialize the SSC; slot passed in A
|
||||
006007 2 ;;;---------------------------------------------------------
|
||||
006007 2
|
||||
006007 2 .proc Init
|
||||
006007 2 0A asl ; Slot passed in A
|
||||
006008 2 0A asl
|
||||
006009 2 0A asl
|
||||
|
@ -193,10 +200,9 @@ Current file: client.s
|
|||
006030 2
|
||||
006030 2
|
||||
006030 2 ;;;---------------------------------------------------------
|
||||
006030 2 .proc Put
|
||||
006030 2 ;;;---------------------------------------------------------
|
||||
006030 2 ;;; Send accumulator out the serial port
|
||||
006030 2 ;;;---------------------------------------------------------
|
||||
006030 2
|
||||
006030 2 .proc Put
|
||||
006030 2 48 pha ; Push A onto the stack
|
||||
006031 2 MOD_UASTAT_1 := *+1
|
||||
006031 2 AD 89 C0 : lda UASTAT ; Check status bits
|
||||
|
@ -212,10 +218,9 @@ Current file: client.s
|
|||
00603F 2 MOD_UADATA_1 := Put::MOD_UADATA_1
|
||||
00603F 2
|
||||
00603F 2 ;;;---------------------------------------------------------
|
||||
00603F 2 .proc Get
|
||||
00603F 2 ;;;---------------------------------------------------------
|
||||
00603F 2 ;;; Read a character from the serial port to the accumulator
|
||||
00603F 2 ;;;---------------------------------------------------------
|
||||
00603F 2
|
||||
00603F 2 .proc Get
|
||||
00603F 2 MOD_UASTAT_2 := *+1
|
||||
00603F 2 AD 89 C0 lda UASTAT ; Check status bits
|
||||
006042 2 29 68 and #$68
|
||||
|
@ -229,10 +234,9 @@ Current file: client.s
|
|||
00604C 2 MOD_UADATA_2 := Get::MOD_UADATA_2
|
||||
00604C 2
|
||||
00604C 2 ;;;---------------------------------------------------------
|
||||
00604C 2 ;;; Check if the serial port has pending data
|
||||
00604C 2
|
||||
00604C 2 .proc HasData
|
||||
00604C 2 ;;;---------------------------------------------------------
|
||||
00604C 2 ;;; Read a character from the serial port to the accumulator
|
||||
00604C 2 ;;;---------------------------------------------------------
|
||||
00604C 2 MOD_UASTAT_3 := *+1
|
||||
00604C 2 AD 89 C0 lda UASTAT ; Check status bits
|
||||
00604F 2 29 68 and #$68
|
||||
|
@ -243,10 +247,9 @@ Current file: client.s
|
|||
006054 2
|
||||
006054 2
|
||||
006054 2 ;;;---------------------------------------------------------
|
||||
006054 2 .proc Reset
|
||||
006054 2 ;;;---------------------------------------------------------
|
||||
006054 2 ;;; Clean up serial port
|
||||
006054 2 ;;;---------------------------------------------------------
|
||||
006054 2
|
||||
006054 2 .proc Reset
|
||||
006054 2 MOD_UADATA_3 := *+1
|
||||
006054 2 2C 88 C0 bit UADATA
|
||||
006057 2 60 rts
|
||||
|
@ -258,7 +261,7 @@ Current file: client.s
|
|||
006058 1
|
||||
006058 1 .ifdef MOUSE_SUPPORT
|
||||
006058 1 .include "mouse.inc"
|
||||
006058 1 .endif ; MOUSE_SUPPORT
|
||||
006058 1 .endif
|
||||
006058 1
|
||||
006058 1
|
||||
006058 1 ;;;-------------------------------------------------------------------
|
||||
|
@ -285,10 +288,9 @@ Current file: client.s
|
|||
006060 1
|
||||
006060 1
|
||||
006060 1 ;;;---------------------------------------------------------
|
||||
006060 1 .proc AppEntry
|
||||
006060 1 ;;;---------------------------------------------------------
|
||||
006060 1 ;;; Initialize the application, and enter the main loop
|
||||
006060 1 ;;;---------------------------------------------------------
|
||||
006060 1
|
||||
006060 1 .proc AppEntry
|
||||
006060 1 AD 59 60 lda PSLOT ; Use slot 2
|
||||
006063 1 20 07 60 jsr SSC::Init ; Initialize Super Serial Card
|
||||
006066 1 20 8C 61 jsr InitHires ; Initialize Hi-Res graphics
|
||||
|
@ -299,10 +301,9 @@ Current file: client.s
|
|||
00606F 1 .endproc
|
||||
00606F 1
|
||||
00606F 1 ;;;---------------------------------------------------------
|
||||
00606F 1 .proc AppExit
|
||||
00606F 1 ;;;---------------------------------------------------------
|
||||
00606F 1 ;;; Clean up and exit app
|
||||
00606F 1 ;;;---------------------------------------------------------
|
||||
00606F 1
|
||||
00606F 1 .proc AppExit
|
||||
00606F 1 20 54 60 jsr SSC::Reset
|
||||
006072 1 8D 54 C0 sta LOWSCR
|
||||
006075 1 8D 51 C0 sta TXTSET
|
||||
|
@ -319,11 +320,10 @@ Current file: client.s
|
|||
006079 1
|
||||
006079 1 ;;;---------------------------------------------------------
|
||||
006079 1 .proc MainLoop
|
||||
006079 1 ;;;---------------------------------------------------------
|
||||
006079 1
|
||||
006079 1 ;;; TODO: Sort out the protocol - should be able to send
|
||||
006079 1 ;;; input state without receiving data
|
||||
006079 1 ;;; jsr SSCHasData ; Anything to read?
|
||||
006079 1 ;;; jsr SSC::HasData ; Anything to read?
|
||||
006079 1 ;;; bne :+ ; Nope
|
||||
006079 1
|
||||
006079 1 20 83 60 : jsr ReceivePage
|
||||
|
@ -334,18 +334,16 @@ Current file: client.s
|
|||
006083 1
|
||||
006083 1
|
||||
006083 1 ;;;---------------------------------------------------------
|
||||
006083 1 .proc ReceivePage
|
||||
006083 1 ;;;---------------------------------------------------------
|
||||
006083 1 ;;; Pull a hi-res page down over serial
|
||||
006083 1 ;;;
|
||||
006083 1 ;;; Protocol is:
|
||||
006083 1 ;;; * Recieve 256 bytes (graphic data)
|
||||
006083 1 ;;; * Send 1 byte (input state)
|
||||
006083 1 ;;;---------------------------------------------------------
|
||||
006083 1
|
||||
006083 1 .proc ReceivePage
|
||||
006083 1 A9 00 lda #0 ; set up write pointer
|
||||
006085 1 85 FA sta ZP_PTR
|
||||
006087 1 A5 E6 lda PLOTPAGE
|
||||
006087 1 A5 E6 lda PAGE
|
||||
006089 1 85 FB sta ZP_PTR+1
|
||||
00608B 1 A2 20 ldx #PAGESIZE ; plan to receive this many pages
|
||||
00608D 1 A0 00 ldy #0
|
||||
|
@ -391,11 +389,10 @@ Current file: client.s
|
|||
0060A0 1 SIS_SYNC = $7f
|
||||
0060A0 1
|
||||
0060A0 1 ;;;---------------------------------------------------------
|
||||
0060A0 1 .proc InitInput
|
||||
0060A0 1 ;;;---------------------------------------------------------
|
||||
0060A0 1 ;;; Initialize input devices and storage for detecting
|
||||
0060A0 1 ;;; state transitions
|
||||
0060A0 1 ;;;---------------------------------------------------------
|
||||
0060A0 1
|
||||
0060A0 1 .proc InitInput
|
||||
0060A0 1
|
||||
0060A0 1 ;;; Init keyboard state
|
||||
0060A0 1 A9 00 lda #SIS_KBUP
|
||||
|
@ -426,8 +423,6 @@ Current file: client.s
|
|||
0060BE 1
|
||||
0060BE 1
|
||||
0060BE 1 ;;;---------------------------------------------------------
|
||||
0060BE 1 .proc SendInputState
|
||||
0060BE 1 ;;;---------------------------------------------------------
|
||||
0060BE 1 ;;; Send keyboard joystick and/or mouse state over the
|
||||
0060BE 1 ;;; serial port
|
||||
0060BE 1 ;;;
|
||||
|
@ -438,7 +433,8 @@ Current file: client.s
|
|||
0060BE 1 ;;; - otherwise send paddle 0 state (if it changed)
|
||||
0060BE 1 ;;; - (TODO: Mouse state)
|
||||
0060BE 1 ;;; - otherwise send sync byte
|
||||
0060BE 1 ;;;---------------------------------------------------------
|
||||
0060BE 1
|
||||
0060BE 1 .proc SendInputState
|
||||
0060BE 1
|
||||
0060BE 1 48 8A 48 98 SaveRegisters ; Store registers
|
||||
0060C2 1 48
|
||||
|
@ -611,13 +607,12 @@ Current file: client.s
|
|||
00618C 1 ;;;-------------------------------------------------------------------
|
||||
00618C 1
|
||||
00618C 1 ;;;---------------------------------------------------------
|
||||
00618C 1 .proc InitHires
|
||||
00618C 1 ;;;---------------------------------------------------------
|
||||
00618C 1 ;;; Set up the graphics display and pointers
|
||||
00618C 1 ;;;---------------------------------------------------------
|
||||
00618C 1 A9 20 lda #PLOTPAGE1 ; clear page 1
|
||||
00618E 1 85 E6 sta PLOTPAGE
|
||||
006190 1 20 B9 61 jsr ClearHires
|
||||
00618C 1
|
||||
00618C 1 .proc InitHires
|
||||
00618C 1 A9 20 lda #PAGE1 ; clear page 1
|
||||
00618E 1 85 E6 sta PAGE
|
||||
006190 1 20 F2 F3 jsr HCLR
|
||||
006193 1
|
||||
006193 1 20 A3 61 jsr FlipHires ; then show it and flip to 2
|
||||
006196 1 8D 57 C0 sta HIRES
|
||||
|
@ -630,47 +625,23 @@ Current file: client.s
|
|||
0061A3 1
|
||||
0061A3 1
|
||||
0061A3 1 ;;;---------------------------------------------------------
|
||||
0061A3 1 .proc FlipHires
|
||||
0061A3 1 ;;;---------------------------------------------------------
|
||||
0061A3 1 ;;; Call when done with the current plotting page
|
||||
0061A3 1 ;;; (selected in PLOTPAGE) and it will be shown and the
|
||||
0061A3 1 ;;; (selected in PAGE) and it will be shown and the
|
||||
0061A3 1 ;;; other page will be shown.
|
||||
0061A3 1 ;;;---------------------------------------------------------
|
||||
0061A3 1 A5 E6 lda PLOTPAGE ; plotting on which page?
|
||||
0061A5 1 C9 20 cmp #PLOTPAGE1
|
||||
0061A3 1
|
||||
0061A3 1 .proc FlipHires
|
||||
0061A3 1 A5 E6 lda PAGE ; plotting on which page?
|
||||
0061A5 1 C9 20 cmp #PAGE1
|
||||
0061A7 1 F0 08 beq :+
|
||||
0061A9 1
|
||||
0061A9 1 8D 55 C0 sta HISCR ; page 2 - so show it
|
||||
0061AC 1 A9 20 lda #PLOTPAGE1 ; and plot on page 1
|
||||
0061AE 1 85 E6 sta PLOTPAGE
|
||||
0061AC 1 A9 20 lda #PAGE1 ; and plot on page 1
|
||||
0061AE 1 85 E6 sta PAGE
|
||||
0061B0 1 60 rts
|
||||
0061B1 1
|
||||
0061B1 1 8D 54 C0 : sta LOWSCR ; page 1 - so show it
|
||||
0061B4 1 A9 40 lda #PLOTPAGE2 ; and plot on page 2
|
||||
0061B6 1 85 E6 sta PLOTPAGE
|
||||
0061B4 1 A9 40 lda #PAGE2 ; and plot on page 2
|
||||
0061B6 1 85 E6 sta PAGE
|
||||
0061B8 1 60 rts
|
||||
0061B9 1 .endproc
|
||||
0061B9 1
|
||||
0061B9 1
|
||||
0061B9 1 ;;;---------------------------------------------------------
|
||||
0061B9 1 .proc ClearHires
|
||||
0061B9 1 ;;;---------------------------------------------------------
|
||||
0061B9 1 ;;; Clear hires plotting page (selected in PLOTPAGE) to
|
||||
0061B9 1 ;;; black uses ZP_PTR; not terribly efficient
|
||||
0061B9 1 ;;;---------------------------------------------------------
|
||||
0061B9 1 A9 00 lda #0 ; Set up ZP_PTR as a pointer into the hires page
|
||||
0061BB 1 85 FA sta ZP_PTR
|
||||
0061BD 1 A5 E6 lda PLOTPAGE
|
||||
0061BF 1 85 FB sta ZP_PTR+1
|
||||
0061C1 1 A2 20 ldx #PAGESIZE ; Clear this many pages
|
||||
0061C3 1 A9 00 lda #0 ; with black!
|
||||
0061C5 1 A8 tay
|
||||
0061C6 1 91 FA : sta (ZP_PTR),Y
|
||||
0061C8 1 C8 iny
|
||||
0061C9 1 D0 FB bne :-
|
||||
0061CB 1 E6 FB inc ZP_PTR+1
|
||||
0061CD 1 CA dex
|
||||
0061CE 1 D0 F6 bne :-
|
||||
0061D0 1 60 rts
|
||||
0061D1 1 .endproc
|
||||
0061D1 1
|
||||
|
|
128
client/client.s
128
client/client.s
|
@ -1,15 +1,24 @@
|
|||
;;;-------------------------------------------------------------------
|
||||
;;;
|
||||
;;; vnIIc Client Application
|
||||
;;;
|
||||
;;;-------------------------------------------------------------------
|
||||
|
||||
PADDLE_SUPPORT = 1
|
||||
;;; MOUSE_SUPPORT = 1
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
.include "macros.inc"
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
;;; Hi-res graphics constants/locations
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
PLOTPAGE := $E6 ; Active hires plotting page (Applesoft)
|
||||
PLOTPAGE1 := $20
|
||||
PLOTPAGE2 := $40
|
||||
PAGE := $E6 ; Active hires plotting page (Applesoft)
|
||||
PAGE1 := $20
|
||||
PAGE2 := $40
|
||||
|
||||
PAGESIZE := $20 ; Size of hi-res screen in pages
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
|
@ -19,6 +28,8 @@ PAGESIZE := $20 ; Size of hi-res screen in pages
|
|||
PREAD := $FB1E ; Monitor paddle reading routine, call
|
||||
; with paddle # in X, returns value in Y
|
||||
|
||||
HCLR := $F3F2 ; Clear current hires screen to black
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
;;; Other
|
||||
;;;---------------------------------------------------------
|
||||
|
@ -27,38 +38,13 @@ MAX_SLOT := 7 ; Maximum slot # on an Apple II
|
|||
|
||||
ZP_PTR := $FA ; Write cursor location on zero page
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
;;; Generic Macros
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
;;;----------------------------------------
|
||||
.macro SaveRegisters
|
||||
;;;----------------------------------------
|
||||
pha
|
||||
txa
|
||||
pha
|
||||
tya
|
||||
pha
|
||||
.endmacro
|
||||
|
||||
;;;----------------------------------------
|
||||
.macro RestoreRegisters
|
||||
;;;----------------------------------------
|
||||
pla
|
||||
tay
|
||||
pla
|
||||
tax
|
||||
pla
|
||||
.endmacro
|
||||
|
||||
|
||||
;;;-------------------------------------------------------------------
|
||||
;;;
|
||||
;;; Application-level logic
|
||||
;;; Client Code
|
||||
;;;
|
||||
;;;-------------------------------------------------------------------
|
||||
|
||||
|
||||
.org $6000
|
||||
jmp AppEntry
|
||||
|
||||
|
@ -66,7 +52,7 @@ ZP_PTR := $FA ; Write cursor location on zero page
|
|||
|
||||
.ifdef MOUSE_SUPPORT
|
||||
.include "mouse.inc"
|
||||
.endif ; MOUSE_SUPPORT
|
||||
.endif
|
||||
|
||||
|
||||
;;;-------------------------------------------------------------------
|
||||
|
@ -92,11 +78,10 @@ LASTP1: .byte 0
|
|||
.endif ; PADDLE_SUPPORT
|
||||
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
.proc AppEntry
|
||||
;;;---------------------------------------------------------
|
||||
;;; Initialize the application, and enter the main loop
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
.proc AppEntry
|
||||
lda PSLOT ; Use slot 2
|
||||
jsr SSC::Init ; Initialize Super Serial Card
|
||||
jsr InitHires ; Initialize Hi-Res graphics
|
||||
|
@ -106,11 +91,10 @@ LASTP1: .byte 0
|
|||
; fall through
|
||||
.endproc
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
.proc AppExit
|
||||
;;;---------------------------------------------------------
|
||||
;;; Clean up and exit app
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
.proc AppExit
|
||||
jsr SSC::Reset
|
||||
sta LOWSCR
|
||||
sta TXTSET
|
||||
|
@ -127,11 +111,10 @@ LASTP1: .byte 0
|
|||
|
||||
;;;---------------------------------------------------------
|
||||
.proc MainLoop
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
;;; TODO: Sort out the protocol - should be able to send
|
||||
;;; input state without receiving data
|
||||
;;; jsr SSCHasData ; Anything to read?
|
||||
;;; jsr SSC::HasData ; Anything to read?
|
||||
;;; bne :+ ; Nope
|
||||
|
||||
: jsr ReceivePage
|
||||
|
@ -141,19 +124,17 @@ LASTP1: .byte 0
|
|||
.endproc
|
||||
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
.proc ReceivePage
|
||||
;;;---------------------------------------------------------
|
||||
;;; Pull a hi-res page down over serial
|
||||
;;;
|
||||
;;; Protocol is:
|
||||
;;; * Recieve 256 bytes (graphic data)
|
||||
;;; * Send 1 byte (input state)
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
.proc ReceivePage
|
||||
lda #0 ; set up write pointer
|
||||
sta ZP_PTR
|
||||
lda PLOTPAGE
|
||||
lda PAGE
|
||||
sta ZP_PTR+1
|
||||
ldx #PAGESIZE ; plan to receive this many pages
|
||||
ldy #0
|
||||
|
@ -198,12 +179,11 @@ LASTP1: .byte 0
|
|||
;;;
|
||||
SIS_SYNC = $7f
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
.proc InitInput
|
||||
;;;---------------------------------------------------------
|
||||
;;; Initialize input devices and storage for detecting
|
||||
;;; state transitions
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
.proc InitInput
|
||||
|
||||
;;; Init keyboard state
|
||||
lda #SIS_KBUP
|
||||
|
@ -233,8 +213,6 @@ LASTP1: .byte 0
|
|||
.endproc
|
||||
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
.proc SendInputState
|
||||
;;;---------------------------------------------------------
|
||||
;;; Send keyboard joystick and/or mouse state over the
|
||||
;;; serial port
|
||||
|
@ -246,7 +224,8 @@ LASTP1: .byte 0
|
|||
;;; - otherwise send paddle 0 state (if it changed)
|
||||
;;; - (TODO: Mouse state)
|
||||
;;; - otherwise send sync byte
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
.proc SendInputState
|
||||
|
||||
SaveRegisters ; Store registers
|
||||
clc
|
||||
|
@ -414,14 +393,13 @@ DONE:
|
|||
;;;
|
||||
;;;-------------------------------------------------------------------
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
.proc InitHires
|
||||
;;;---------------------------------------------------------
|
||||
;;; Set up the graphics display and pointers
|
||||
;;;---------------------------------------------------------
|
||||
lda #PLOTPAGE1 ; clear page 1
|
||||
sta PLOTPAGE
|
||||
jsr ClearHires
|
||||
|
||||
.proc InitHires
|
||||
lda #PAGE1 ; clear page 1
|
||||
sta PAGE
|
||||
jsr HCLR
|
||||
|
||||
jsr FlipHires ; then show it and flip to 2
|
||||
sta HIRES
|
||||
|
@ -433,47 +411,23 @@ DONE:
|
|||
.endproc
|
||||
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
.proc FlipHires
|
||||
;;;---------------------------------------------------------
|
||||
;;; Call when done with the current plotting page
|
||||
;;; (selected in PLOTPAGE) and it will be shown and the
|
||||
;;; (selected in PAGE) and it will be shown and the
|
||||
;;; other page will be shown.
|
||||
;;;---------------------------------------------------------
|
||||
lda PLOTPAGE ; plotting on which page?
|
||||
cmp #PLOTPAGE1
|
||||
|
||||
.proc FlipHires
|
||||
lda PAGE ; plotting on which page?
|
||||
cmp #PAGE1
|
||||
beq :+
|
||||
|
||||
sta HISCR ; page 2 - so show it
|
||||
lda #PLOTPAGE1 ; and plot on page 1
|
||||
sta PLOTPAGE
|
||||
lda #PAGE1 ; and plot on page 1
|
||||
sta PAGE
|
||||
rts
|
||||
|
||||
: sta LOWSCR ; page 1 - so show it
|
||||
lda #PLOTPAGE2 ; and plot on page 2
|
||||
sta PLOTPAGE
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
.proc ClearHires
|
||||
;;;---------------------------------------------------------
|
||||
;;; Clear hires plotting page (selected in PLOTPAGE) to
|
||||
;;; black uses ZP_PTR; not terribly efficient
|
||||
;;;---------------------------------------------------------
|
||||
lda #0 ; Set up ZP_PTR as a pointer into the hires page
|
||||
sta ZP_PTR
|
||||
lda PLOTPAGE
|
||||
sta ZP_PTR+1
|
||||
ldx #PAGESIZE ; Clear this many pages
|
||||
lda #0 ; with black!
|
||||
tay
|
||||
: sta (ZP_PTR),Y
|
||||
iny
|
||||
bne :-
|
||||
inc ZP_PTR+1
|
||||
dex
|
||||
bne :-
|
||||
lda #PAGE2 ; and plot on page 2
|
||||
sta PAGE
|
||||
rts
|
||||
.endproc
|
||||
|
|
21
client/macros.inc
Normal file
21
client/macros.inc
Normal file
|
@ -0,0 +1,21 @@
|
|||
;;;---------------------------------------------------------
|
||||
;;;
|
||||
;;; Generic Macros
|
||||
;;;
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
.macro SaveRegisters
|
||||
pha
|
||||
txa
|
||||
pha
|
||||
tya
|
||||
pha
|
||||
.endmacro
|
||||
|
||||
.macro RestoreRegisters
|
||||
pla
|
||||
tay
|
||||
pla
|
||||
tax
|
||||
pla
|
||||
.endmacro
|
|
@ -53,7 +53,7 @@ LAST_MY: .byte $7f
|
|||
;;; Routines
|
||||
;;;--------------------------------------------------
|
||||
|
||||
MOUSEPTR = $EB ; Zero page location
|
||||
MOUSEPTR := $EB ; Zero page location
|
||||
|
||||
MOUSE_MIN_X := $10
|
||||
MOUSE_MAX_X := $1f
|
||||
|
@ -74,7 +74,6 @@ MOUSE_CENTER_Y := $2f
|
|||
;;; min: minimum value (2 byte)
|
||||
;;; max: maximum value (2 byte)
|
||||
;;;----------------------------------------
|
||||
; Clamp X to 0...255
|
||||
lda #<min
|
||||
sta MOUSE_CMIN_LSB
|
||||
lda #>min
|
||||
|
@ -103,11 +102,10 @@ MOUSE_CENTER_Y := $2f
|
|||
.endmacro
|
||||
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
.proc FindMouse
|
||||
;;;---------------------------------------------------------
|
||||
;;; Find and initialize the mouse port
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
.proc FindMouse
|
||||
|
||||
;;; Reference: http://home.swbell.net/rubywand/R034MOUSEPRG.TXT
|
||||
|
||||
|
@ -210,8 +208,8 @@ INITMOUSE: ldy #$19
|
|||
jmp GoMouse
|
||||
|
||||
;;;--------------------------------------------------
|
||||
|
||||
.proc GoMouse
|
||||
;;;--------------------------------------------------
|
||||
tax ; Preserve the value in A
|
||||
lda (MOUSEPTR),Y ; Get the routine entry point
|
||||
sta TOMOUSE_lsb ; Patch the JMP instruction
|
||||
|
@ -246,9 +244,7 @@ TOMOUSE_msb := GoMouse::TOMOUSE_slot+1
|
|||
|
||||
;;;--------------------------------------------------
|
||||
.proc FOOMOUSE
|
||||
;;;--------------------------------------------------
|
||||
;
|
||||
;;;--------------------------------------------------
|
||||
|
||||
txa ; save x
|
||||
pha
|
||||
tya ; save y
|
||||
|
|
|
@ -31,11 +31,10 @@ BPSCTRL: .byte $16,$1E,$1F,$10 ; 300, 9600, 19200, 115k (with 8 data bits, 1 sto
|
|||
CMND_NRDI = $0B ; Command: no parity, RTS on, DTR on, no interrupts
|
||||
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
.proc Init
|
||||
;;;---------------------------------------------------------
|
||||
;;; Initialize the SSC; slot passed in A
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
.proc Init
|
||||
asl ; Slot passed in A
|
||||
asl
|
||||
asl
|
||||
|
@ -58,11 +57,10 @@ CMND_NRDI = $0B ; Command: no parity, RTS on, DTR on, no interrupts
|
|||
.endproc
|
||||
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
.proc Put
|
||||
;;;---------------------------------------------------------
|
||||
;;; Send accumulator out the serial port
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
.proc Put
|
||||
pha ; Push A onto the stack
|
||||
MOD_UASTAT_1 := *+1
|
||||
: lda UASTAT ; Check status bits
|
||||
|
@ -77,11 +75,10 @@ MOD_UADATA_1 := *+1
|
|||
MOD_UASTAT_1 := Put::MOD_UASTAT_1
|
||||
MOD_UADATA_1 := Put::MOD_UADATA_1
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
.proc Get
|
||||
;;;---------------------------------------------------------
|
||||
;;; Read a character from the serial port to the accumulator
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
.proc Get
|
||||
MOD_UASTAT_2 := *+1
|
||||
lda UASTAT ; Check status bits
|
||||
and #$68
|
||||
|
@ -95,10 +92,9 @@ MOD_UADATA_2 := *+1
|
|||
MOD_UADATA_2 := Get::MOD_UADATA_2
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
;;; Check if the serial port has pending data
|
||||
|
||||
.proc HasData
|
||||
;;;---------------------------------------------------------
|
||||
;;; Read a character from the serial port to the accumulator
|
||||
;;;---------------------------------------------------------
|
||||
MOD_UASTAT_3 := *+1
|
||||
lda UASTAT ; Check status bits
|
||||
and #$68
|
||||
|
@ -108,11 +104,10 @@ MOD_UASTAT_3 := *+1
|
|||
MOD_UASTAT_3 := HasData::MOD_UASTAT_3
|
||||
|
||||
|
||||
;;;---------------------------------------------------------
|
||||
.proc Reset
|
||||
;;;---------------------------------------------------------
|
||||
;;; Clean up serial port
|
||||
;;;---------------------------------------------------------
|
||||
|
||||
.proc Reset
|
||||
MOD_UADATA_3 := *+1
|
||||
bit UADATA
|
||||
rts
|
||||
|
|
Loading…
Reference in New Issue
Block a user