Jump to content

CaptMatteus

Members
  • Posts

    19
  • Joined

  • Last visited

Everything posted by CaptMatteus

  1. Ahh, totally makes sense. So I can add a little code to clear out the screen memory and then it'll be good to go. I love feedback, it (nearly) always makes me a better programmer. I certainly do not claim to be ANY sort of expert on the Atari platform. So, much appreciated.
  2. I also tested on my Incognito-equipped Atari 800 (what a fabulous piece of hardware BTW) against most of the OSes. I had no problems against a Stock OS-B 48K machine, Altirra OS, XL/XE 64K and AXLON 1088, all were good. I wonder what is causing the problem on Altirra?
  3. Interesting. I tested on my 800XL and the Atari800MacX emulator without any problem. I have not run it on Altirra. I do want to try on my 800 as well, because it has the Atari key.
  4. I needed to do some keyboard input, and given that all the books I have list all the various keyboard codes in decimal and not hex, I scratched my itch. My program opens the K: keyboard device and shows the various codes for each key pressed. It's a toy, and certainly not perfect, but I wanted to explore CIO and keyboard input in assembly. KeyTest.s KeyTest.xex
  5. If it's any consolation, after I put the pin assignments and jumper connections I would need to make on paper and double checked everything I needed to do, I did all of the soldering work and replaced the resistors in about an hour. Worked on the first boot.
  6. One must always be careful! I didn't see anyone else mentioning it so I thought I would point it out.
  7. The cable I received in the box does not match all of the online documentation for the install. See the attached photo. If I have the green wire in the same position that it is in in the documentation on Lotharek's Lair, then I believe the mapping now becomes: Yellow Red Black Blue White Green (OLD) | | | | | | Black Red White Yellow Orange Green (NEW)
  8. Revised VBI. Works perfect! vbi_isr INC Counter ; increment timer by 1/60 sec LDA Counter CMP #$30 ; has half a second gone by? BCS SwapDL ; Yes -> so go swap the display lists JMP SYSVBV ; no -> do nothing and return SwapDL LDA #0 ; before swapping... STA Counter ; reset counter LDA sdlstl+1 ; get hi byte of current display list in use AND #1 ; if odd, we are on DL1 and result of operation non-zero BEQ ToDL1 ; If 0 -> switch to DL1 DEC sdlstl+1 ; using DL1, so switch to DL0 LDX #$7F ; Play "Tick" sound (loop takes ~1000 cycles, so safe here) Click0 STX CONSOL DEX BPL Click0 JMP SYSVBV ToDL1 INC sdlstl+1 ; on DL0, switch to DL1 LDX #$3F ; Play "Tock" sound (loop takes ~500 cycles) Click1 STX CONSOL DEX BPL Click1 JMP SYSVBV
  9. That is a great idea! Not a huge time saver in this application, but when there is more going on, very useful both in cycle count and reduced page zero footprint.
  10. I built another simple double buffering scheme, this time in graphics mode 6 (BASIC GR.1). Because the uppercase/lowercase restrictions and colors were annoying me, I moved the character set into RAM and stuffed the lower case bit maps into the corresponding upper case locations. I added "tick" and "tock" sounds because, you know, why not? Here is the code: .MACRO CopyChar LDY #0 CharLp LDA (SrcLO),Y STA (DestLO),Y INY CPY #8 BNE CharLp .ENDM *= $3000 Counter = $A2 ListInUse = $A3 SrcLO = $B0 SrcHI = $B1 DestLo = $B2 DestHi = $B3 .include "hardware.s" init ; load display list 0 LDA #<dlist_0 STA sdlstl LDA #>dlist_0 STA sdlstl+1 ; Play first "Tick" sound. After this, handled in VBI ISR LDX #$7F Click STX CONSOL DEX BPL Click ; If you want to use mixed lower and upper case characters in graphics mode 6, ; you have modify the character set ; Copy character set LDA #0 ; Atari character set starts on a 1K page boundary STA SrcLO ; only get the high byte in CHBAS, $00 is assumed for lo byte STA DestLO LDA CHBAS ; Hi byte of character set location from OS STA SrcHI LDA #$70 STA DestHI LDX #4 ; copying four pages PageLp LDY #0 ByteLp LDA (SrcLO), Y STA (DestLO), Y DEY BNE ByteLp INC SrcHI INC DestHI DEX BNE PageLp ;Copy the four needed lower case characters into the upper case locations ; move 'c' into 'C' LDA #$18 STA SrcLO STA DestLO LDA #$71 STA DestHI LDA #$73 STA SrcHI CopyChar ; move 'i' into 'I' LDA #$48 STA SrcLO STA DestLO CopyChar ; move 'k' into 'K' LDA #$58 STA SrcLO STA DestLO CopyChar ; move 'o' into 'O' LDA #$78 STA SrcLO STA DestLO CopyChar ; point to our modified charater set LDA #$70 STA CHBAS ; set graphics mode 6 (Basic GR.1_) colors LDA #$0 ; black background STA COLOR4 LDA #$0E ; white STA COLOR0 LDA #0 STA Counter ; initialize half-second timer STA ListInUse ; start with display list 0 LDY #<vbi_isr ; load registers to add vertical blank ISR LDX #>vbi_isr ; lo and hit address bytes go in Y and X LDA #6 ; set in the immediate routine JSR SETVBV forever JMP forever * = $3500 vbi_isr INC Counter ; increment timer by 1/60 sec LDA Counter CMP #$30 ; has half a second gone by? BCS SwapDL ; Yes -> so go swap the display lists JMP SYSVBV ; no -> do nothing and return SwapDL LDA #0 ; before swapping... STA Counter ; reset counter LDA ListInUse ; get current display list in use BEQ ToDL1 ; LDX sets Z flag; if 0 -> switch to DL1 LDA #0 ; Currently using DL1 -> switch to DL0 STA ListInUse LDA #<dlist_0 ; point OS to DL0 STA sdlstl LDA #>dlist_0 STA sdlstl+1 LDX #$7F ; Play "Tick" sound (loop takes ~1000 cycles, so safe here) Click0 STX CONSOL DEX BPL Click0 JMP SYSVBV ToDL1 LDA #1 ; Currently using DL0 -> switch to DL1 STA ListInUse LDA #<dlist_1 ; Point OS to DL1 STA sdlstl LDA #>dlist_1 STA sdlstl+1 LDX #$3F ; Play "Tock" sound (loop takes ~500 cycles) Click1 STX CONSOL DEX BPL Click1 JMP SYSVBV ; mode 0 standard display list * = $7800 dlist_0 .byte $70,$70,$70 ; 24 blank scan lines .byte $46,$00,$90 ; Line of mode 6, LMS @ $9000 .byte $6,$6,$6,$6,$6,$6,$6,$6,$6,$6,$6, ; 11 lines of mode 6 .byte $6,$6,$6,$6,$6,$6,$6,$6,$6,$6,$6,$6, ; 12 lines of mode 6 .byte $41,<dlist_0,>dlist_0 * = $7900 dlist_1 .byte $70,$70,$70 ; 24 blank scan lines .byte $46,$00,$95 ; Line of mode 6, LMS @ $9500 .byte $6,$6,$6,$6,$6,$6,$6,$6,$6,$6,$6, ; 11 lines of mode 6 .byte $6,$6,$6,$6,$6,$6,$6,$6,$6,$6,$6,$6, ; 12 lines of mode 6 .byte $41,<dlist_1,>dlist_1 * = $90D0 .sbyte "TICK" * = $95E4 .sbyte "TOCK" ; tell DOS where to run the program when loaded * = $2e0 .word init
  11. So with that change the code looks like this: *= $3000 Counter = $A2 ListInUse = $A3 .include "hardware.s" init ; load display list 0 LDA #<dlist_0 STA sdlstl LDA #>dlist_0 STA sdlstl+1 ; for graphics mode 0, we can set the background color and a foreground luminance ; wheich here will be the text color LDA #$0 ; Mode 0 background color STA COLOR2 LDA #$0E ; Mode 0 foreground luminance STA COLOR1 ; set up counter and current disply list in use variable LDA #0 STA Counter STA ListInUse ; set up registers to insert our vertical blank interrupt routine LDY #<vbi_isr ; Y gets low address byte of ISR LDX #>vbi_isr ; X gets high byte of ISR LDA #6 ; use immediate routine JSR SETVBV ; execute call forever JMP forever * = $3500 vbi_isr INC Counter ; increment timer by 1/60 sec LDA Counter CMP #$30 ; has half a second gone by? BCS SwapDL ; Yes -> so go swap the display lists JMP SYSVBV ; no -> do nothing and return SwapDL LDA #0 ; before swapping... STA Counter ; reset counter LDA ListInUse ; get current display list in use BEQ ToDL1 ; LDX sets Z flag; if 0 -> switch to DL1 LDA #0 ; Currently using DL1 -> switch to DL0 STA ListInUse LDA #<dlist_0 ; point OS to DL0 STA sdlstl LDA #>dlist_0 STA sdlstl+1 JMP SYSVBV ToDL1 LDA #1 ; Currently using DL0 -> switch to DL1 STA ListInUse LDA #<dlist_1 ; Point OS to DL1 STA sdlstl LDA #>dlist_1 STA sdlstl+1 JMP SYSVBV ; mode 0 display lists * = $7800 dlist_0 .byte $70,$70,$70 ; 24 blank scan lines .byte $42,$00,$90 ; Line of mode 0, LMS @ $9000 .byte $2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2, ; 11 lines of mode 0 .byte $2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2, ; 12 lines of mode 0 .byte $41,<dlist_0,>dlist_0 * = $7900 dlist_1 .byte $70,$70,$70 ; 24 blank scan lines .byte $42,$00,$95 ; Line of mode 0, LMS @ $9500 .byte $2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2, ; 11 lines of mode 0 .byte $2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2, ; 12 lines of mode 0 .byte $41,<dlist_1,>dlist_1 * = $91F2 .sbyte "Tick" * = $971A .sbyte "Tock" ; tell DOS where to run the program when loaded * = $2e0 .word init
  12. Thanks for the feedback. I had not considered the update of the shadow registers. After reviewing De Re Atari I see that I need to place my ISR in the VBI immediate slot so that I update the DLIST pointer prior to the update of the shadow registers.
  13. I had been looking for a complete example of how to do double buffering on the Atari 800, but although there are some extracts from very sophisticated programs, the basics were not represented. I decided to create my own example to build upon. My example creates two graphics mode 0 display lists, and plants a couple of words to show that the screens are being swapped. I use a deferred mode vertical blank interrupt routine to switch between the two. Enjoy! *= $3000 Counter = $A2 ListInUse = $A3 .include "hardware.s" init ; load display list 0 LDA #<dlist_0 STA sdlstl LDA #>dlist_0 STA sdlstl+1 ; for graphics mode 0, we can set the background color and a foreground luminance ; wheich here will be the text color LDA #$0 ; Mode 0 background color STA COLOR2 LDA #$0E ; Mode 0 foreground luminance STA COLOR1 ; set up counter and current disply list in use variable LDA #0 STA Counter STA ListInUse ; set up registers to insert our vertical blank interrupt routine LDY #<vbi_isr ; Y gets low address byte of ISR LDX #>vbi_isr ; X gets high byte of ISR LDA #7 ; use deferred routine JSR SETVBV ; execute call forever JMP forever * = $3500 vbi_isr PHA ; save accumulator INC Counter ; increment timer by 1/60 sec LDA Counter CMP #$30 ; has half a second gone by? BCS SwapDL ; Yes -> so go swap the display lists JMP vbidone ; no -> do nothing and return SwapDL LDA #0 ; before swapping... STA Counter ; reset counter LDA ListInUse ; get current display list in use BEQ ToDL1 ; LDX sets Z flag; if 0 -> switch to DL1 LDA #0 ; Currently using DL1 -> switch to DL0 STA ListInUse LDA #<dlist_0 ; point OS to DL0 STA sdlstl LDA #>dlist_0 STA sdlstl+1 JMP vbidone ToDL1 LDA #1 ; Currently using DL0 -> switch to DL1 STA ListInUse LDA #<dlist_1 ; Point OS to DL1 STA sdlstl LDA #>dlist_1 STA sdlstl+1 vbidone PLA ; before exiting ISR, reset former accumulator state JMP XITVBV ; mode 0 display lists * = $7800 dlist_0 .byte $70,$70,$70 ; 24 blank scan lines .byte $42,$00,$90 ; Line of mode 0, LMS @ $9000 .byte $2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2, ; 11 lines of mode 0 .byte $2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2, ; 12 lines of mode 0 .byte $41,<dlist_0,>dlist_0 * = $7900 dlist_1 .byte $70,$70,$70 ; 24 blank scan lines .byte $42,$00,$95 ; Line of mode 0, LMS @ $9500 .byte $2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2, ; 11 lines of mode 0 .byte $2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2,$2, ; 12 lines of mode 0 .byte $41,<dlist_1,>dlist_1 * = $91F2 .sbyte "Tick" * = $971A .sbyte "Tock" ; tell DOS where to run the program when loaded * = $2e0 .word init Bufferx2mode0.s
×
×
  • Create New...