Rasmus-M / Old-Js99er

TI-99/4A emulator written in JavaScript
GNU General Public License v2.0
42 stars 13 forks source link

Beam retrace #3

Closed petersobolev closed 8 years ago

petersobolev commented 8 years ago

It seems that beam retrace interrupt works incorrectly.. Here is three screenshots attached: 1) Real TI-99/4a (NTSC) 2) Mess (mame) emulator (NTSC) 3) js99er

beamtest

Code:


          def  start

vdpsta    equ  >8802               ; VDP RAM status
vdpwa     equ  >8C02               ; VDP RAM read/write address
ws0       equ  >8300               ; Workspace 0 (till 831f)
R0L       equ  ws0+1               ; Workspace 0 R0 low byte

start:

          limi    0
          lwpi >8300               ; restore workspace

          li   r0,>01e7            ; Reg 1: 16K,  int enabled, sprx2
          bl   @vwtr               ; graphics 2, size = 1, mag = 0.

          clr r10

loop:

;
vwait
          movb @vdpsta,r12
          andi r12,>8000
          jeq  vwait               ; Wait for vsync

          li   r3,600
lp0       dec  r3
          jne  lp0

          ;mov r10,r1

          li  r1,>33

          swpb  r1
          li    r0,>0f00
          swpb  r0
          movb  r1,r0              ; Reg 7 (>0f) : text-mode color and backdrop color (fgbg)
          swpb  r0

          movb @R0L,@vdpwa         ; send low byte (value) to write to vdp register
          ori  r0,>8000            ; set up a vdp register write operation
          movb r0,@vdpwa           ; send high byte (address) of vdp register

          li   r3,50
lp1       dec  r3
          jne  lp1

          li   r0,>0f84            ; Reg 7: text-mode color and backdrop color (fgbg)
          movb @R0L,@vdpwa         ; send low byte (value) to write to vdp register
          ori  r0,>8000            ; set up a vdp register write operation
          movb r0,@vdpwa           ; send high byte (address) of vdp register

          nop
          nop
          nop
          nop
          nop
          nop
          nop
          nop

          li   r3,50
lp2       dec  r3
          jne  lp2

          li   r0,>0f31            ; Reg 7: text-mode color and backdrop color (fgbg)
          movb @R0L,@vdpwa         ; send low byte (value) to write to vdp register
          ori  r0,>8000            ; set up a vdp register write operation
          movb r0,@vdpwa           ; send high byte (address) of vdp register

          inc   r10

          b    @loop

vwtr:     movb @R0L,@vdpwa         ; send low byte (value) to write to vdp register
          ori  r0,>8000            ; set up a vdp register write operation
          movb r0,@vdpwa           ; send high byte (address) of vdp register
          rt

          end    start
Rasmus-M commented 8 years ago

It's not the interrupt that's not working but the fact that JS99er is not drawing the screen concurrently with execution of CPU instructions (a result of the single threaded nature of JavaScript). This makes raster effects impossible, and AFAIK MAME is the only TI-99 emulator that does this correctly.

On 26 March 2016 at 03:03, Peter Sobolev notifications@github.com wrote:

It seems that beam retrace interrupt works incorrectly.. Here is three screenshots attached: 1) Real TI-99/4a (NTSC) 2) Mess (mame) emulator (NTSC) 3) js99er

[image: beamtest] https://cloud.githubusercontent.com/assets/17679754/14057412/bac5596e-f30f-11e5-941c-f61fdb0d8cb9.jpg

Code:

      def  start

vdpsta equ >8802 ; VDP RAM status vdpwa equ >8C02 ; VDP RAM read/write address ws0 equ >8300 ; Workspace 0 (till 831f) R0L equ ws0+1 ; Workspace 0 R0 low byte

start:

      limi    0
      lwpi >8300               ; restore workspace

      li   r0,>01e7            ; Reg 1: 16K,  int enabled, sprx2
      bl   @vwtr               ; graphics 2, size = 1, mag = 0.

      clr r10

loop:

; vwait movb @vdpsta,r12 andi r12,>8000 jeq vwait ; Wait for vsync

      li   r3,600

lp0 dec r3 jne lp0

      ;mov r10,r1

      li  r1,>33

      swpb  r1
      li    r0,>0f00
      swpb  r0
      movb  r1,r0              ; Reg 7 (>0f) : text-mode color and backdrop color (fgbg)
      swpb  r0

      movb @R0L,@vdpwa         ; send low byte (value) to write to vdp register
      ori  r0,>8000            ; set up a vdp register write operation
      movb r0,@vdpwa           ; send high byte (address) of vdp register

      li   r3,50

lp1 dec r3 jne lp1

      li   r0,>0f84            ; Reg 7: text-mode color and backdrop color (fgbg)
      movb @R0L,@vdpwa         ; send low byte (value) to write to vdp register
      ori  r0,>8000            ; set up a vdp register write operation
      movb r0,@vdpwa           ; send high byte (address) of vdp register

      nop
      nop
      nop
      nop
      nop
      nop
      nop
      nop

      li   r3,50

lp2 dec r3 jne lp2

      li   r0,>0f31            ; Reg 7: text-mode color and backdrop color (fgbg)
      movb @R0L,@vdpwa         ; send low byte (value) to write to vdp register
      ori  r0,>8000            ; set up a vdp register write operation
      movb r0,@vdpwa           ; send high byte (address) of vdp register

      inc   r10

      b    @loop

vwtr: movb @R0L,@vdpwa ; send low byte (value) to write to vdp register ori r0,>8000 ; set up a vdp register write operation movb r0,@vdpwa ; send high byte (address) of vdp register rt

      end    start

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/Rasmus-M/Js99er/issues/3

petersobolev commented 8 years ago

I'm not sure about "impossible". Rather hard :) Because there is at least one emulator (Commodore 64) written in js which emulates raster effects nicely: http://vice.janicek.co/c64

Rasmus-M commented 8 years ago

I mean impossible in JS99er.

On 26 March 2016 at 20:16, Peter Sobolev notifications@github.com wrote:

I'm not sure about "impossible". Rather hard :) Because there is at least one emulator (Commodore 64) written in js which emulates raster effects nicely: http://vice.janicek.co/c64

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/Rasmus-M/Js99er/issues/3#issuecomment-201913063

Rasmus-M commented 8 years ago

The CPU and the VPD are now interleaved in the 9918A emulation.