X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libsrc%2Flynx%2Flynx-160-102-16.s;h=83e0c10afd8d8a8f1e99cc154554223e3b19c7a1;hb=5f006333bf97d98099a4702320f60c3551a5bbe5;hp=c41b89d2511e1978a43840307e5c582bfca9d399;hpb=fe652c8206c491ffc9c02e702a63bab86a8e5be0;p=cc65 diff --git a/libsrc/lynx/lynx-160-102-16.s b/libsrc/lynx/lynx-160-102-16.s index c41b89d25..83e0c10af 100644 --- a/libsrc/lynx/lynx-160-102-16.s +++ b/libsrc/lynx/lynx-160-102-16.s @@ -107,7 +107,6 @@ BGINDEX: .res 1 ; Pen to use for text background ; Double buffer IRQ stuff DRAWPAGE: .res 1 SWAPREQUEST: .res 1 -VBLHOOK: .res 3 text_bitmap: .res 8*(1+20+1)+1 ; 8 rows with (one offset-byte plus 20 character bytes plus one fill-byte) plus one 0-offset-byte @@ -168,8 +167,6 @@ INSTALL: stz BGINDEX stz DRAWPAGE stz SWAPREQUEST - lda #$60 ; rts op-code - sta VBLHOOK rts @@ -199,6 +196,19 @@ UNINSTALL: ; INIT: +; Enable interrupts for VBL + lda #$80 + tsb VTIMCTLA +; Set up collision buffer to $A058 + lda #$58 + sta COLLBASL + lda #$A0 + sta COLLBASH +; Put collision index before sprite data + lda #$FE + sta COLLOFFL + lda #$FF + sta COLLOFFH ; Done, reset the error code lda #TGI_ERR_OK sta ERROR @@ -246,26 +256,28 @@ GETERROR: ; To update displays you can call tgi_ioctl(4, 1) it will wait for the ; next VBL interrupt and swap draw and view buffers. ; -; Set an address for a subroutine you want to call at every VBL -; tgi_ioctl(5, hook) +; Activate or deactivate collision detection by calling tgi_ioctl(5, 0/1). CONTROL: pha ; Almost all control routines succeed lda #TGI_ERR_OK sta ERROR pla + cmp #5 - bne ControlSwapRequest - - lda ptr1 ; Set IRQ routine to be called at VBL - sta VBLHOOK+1 - lda ptr1+1 - sta VBLHOOK+2 - lda #$43 ; jmp op-code - sta VBLHOOK + bne ControlSwap + lda ptr1 + bne @L0 + lda __sprsys + ora #$20 + bra @L1 +@L0: lda __sprsys + and #$df +@L1: sta __sprsys + sta SPRSYS rts -ControlSwapRequest: +ControlSwap: cmp #4 bne ControlFramerate @@ -280,6 +292,7 @@ ControlFramerate: cmp #3 bne ControlTextBG + lda ptr1 cmp #75 ; Set framerate beq rate75 cmp #60 @@ -400,12 +413,12 @@ CLEAR: lda #$de20 + ldy #<$e018 ; page 0 + ldx #>$e018 bra @L2 @L1: - ldy #<$be40 ; page 1 - ldx #>$be40 + ldy #<$c038 ; page 1 + ldx #>$c038 @L2: sty VIEWPAGEL ; Save viewpage for getpixel stx VIEWPAGEH @@ -435,12 +448,12 @@ SETVIEWPAGE: SETDRAWPAGE: cmp #1 beq @L1 ; page == maxpages-1 - lda #<$de20 ; page 0 - ldx #>$de20 + lda #<$e018 ; page 0 + ldx #>$e018 bra @L2 @L1: - lda #<$be40 ; page 1 - ldx #>$be40 + lda #<$c038 ; page 1 + ldx #>$c038 @L2: sta DRAWPAGEL stx DRAWPAGEH @@ -450,19 +463,6 @@ SETDRAWPAGE: ; IRQ: VBL interrupt handler ; -TIMER0_INTERRUPT = $01 -TIMER1_INTERRUPT = $02 -TIMER2_INTERRUPT = $04 -TIMER3_INTERRUPT = $08 -TIMER4_INTERRUPT = $10 -TIMER5_INTERRUPT = $20 -TIMER6_INTERRUPT = $40 -TIMER7_INTERRUPT = $80 - -HBL_INTERRUPT = TIMER0_INTERRUPT -VBL_INTERRUPT = TIMER2_INTERRUPT -SERIAL_INTERRUPT = TIMER4_INTERRUPT - IRQ: lda INTSET ; Poll all pending interrupts and #VBL_INTERRUPT @@ -478,7 +478,6 @@ IRQ: jsr SETDRAWPAGE stz SWAPREQUEST @L0: - jsr VBLHOOK IRQEND: clc rts