X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libsrc%2Flynx%2Flynx-160-102-16.s;h=83e0c10afd8d8a8f1e99cc154554223e3b19c7a1;hb=148a6569e55822a562380c56df0340bccc653749;hp=f37723df9e1aaa1ca2178876a406e6f1efcb2fa6;hpb=c9de0e68418270b30fd5e77935c74c1fd4d14799;p=cc65 diff --git a/libsrc/lynx/lynx-160-102-16.s b/libsrc/lynx/lynx-160-102-16.s index f37723df9..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 @@ -433,14 +446,14 @@ SETVIEWPAGE: ; SETDRAWPAGE: - cmp #1 + 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,39 +463,24 @@ 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 - bne IRQVBL - clc ; Not a VBL interrupt - exit - rts -IRQVBL: - lda SWAPREQUEST - beq @L0 - lda DRAWPAGE - jsr SETVIEWPAGE - lda DRAWPAGE - eor #1 - sta DRAWPAGE - jsr SETDRAWPAGE - stz SWAPREQUEST + lda INTSET ; Poll all pending interrupts + and #VBL_INTERRUPT + beq IRQEND ; Exit if not a VBL interrupt + + lda SWAPREQUEST + beq @L0 + lda DRAWPAGE + jsr SETVIEWPAGE + lda DRAWPAGE + eor #1 + sta DRAWPAGE + jsr SETDRAWPAGE + stz SWAPREQUEST @L0: - jsr VBLHOOK - clc - rts +IRQEND: + clc + rts ; ------------------------------------------------------------------------ ; SETCOLOR: Set the drawing color (in A). The new color is already checked @@ -1003,7 +1001,7 @@ text_c: ; The Font ; 96 characters from ASCII 32 to 127 ; 8 pixels wide, 8 pixels high -; bit value 0 = foreground, bit value 1 = background / transparent +; bit value 0 = foreground, bit value 1 = background / transparent font: ; VERSAIL .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ;32