Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.atari.8bit > #550

5200 emulator

From "Rick" <ricortes at yahoo dot com>
Newsgroups comp.sys.atari.8bit
Subject 5200 emulator
Date 2012-05-01 15:58 -0700
Message-ID <N9-dncpfHrIA9z3SnZ2dnUVZ_gKdnZ2d@earthlink.com> (permalink)

Show all headers | View raw


I'll give a plug for Notepad++, seems like a pretty good programming editor.

I was fooling around with my usual TASM testing out making 5200 ROMs and 
modified a bit of Dan's code so it would work with TASM and added the RTC & 
inverse video stuff.

Compile with the command line
TASM 5200RTC.SRC -65 -b -fFF
The 5200RTC.SRC is the source file name you use
-65 tells TASM to use the 6502 instruction set
-b tells TASM you want a binary or .OBJ file as opposed to some other output
-fFF tells TASM to fill the unused portions of the ROM with $FF. This isn't 
really important but when you erase an EPROM it is all $FF's. If for some 
reason the EPROM fails to program in an unused section, if the programmer 
reads an $FF it will think it is right. You should be able to just do 
sections and add stuff later depending on your EPROM.

I fumbled with this right and left, really rusty. Kept forgetting to look 
for decimal vs. HEX for calcs, made every mistake posible with the 
assembler -f FF is not the same as -fFF.<sigh>

*BUT* this really wasn't hugely bad. Talk about a good programming 
envirionment. I had a DOS window open to the TASM directory, the source file 
open in Notepad++, Atari800Win Plus 4.0, and Memo Pad in another.

I would edit the source code a bit and save, go to the DOS command line and 
hit "F3"<return> which would assemble the file, jump to Atari800 and go to 
the 'insert cart' menu and just let it load the same file. Whenever anything 
got to crazy I just loaded it into Memo Pad to inspect the binary. I 
probably should use a disassembler or monitor for the last step but heck, I 
never went that far south. Finished source to test didn't take 10 seconds 
and both TASM and NotePad++ were in sync on line numbers. At least for the 
emulator a BASIC would make sense. You have something like 32k of cartridge 
space so you could add  most of the features that were left out of the OS. 
Lack of storage doesn't mean much since you can save multiple copies of the 
emulator state with your resident program installed.

Rick

 Of course the newsgroup post will screw up my formatting but...
**********************************
; Atari 5200 "Hello World" sample code
; Written by Daniel Boris (dboris@comcast.net)
; Added code snippets for RTC
; Assemble with TASM now, Rick Cortese
;

;        processor 6502

DMACTL  =     $D400           ;DMA Control
sDMACTL =     $07             ;DMA Control Shadow
DLISTL  =     $D402           ;Display list lo
DLISTH  =     $D403           ;Display list hi
sDLISTL =     $05             ;Display list lo shadow
sDLISTH =     $06             ;Display list hi shadow
CHBASE  =     $D409           ;Character set base
CHACTL  =     $D401           ;Character control
NMIEN   =     $D40E           ;NMI Enable
COLOR1  =     $0D             ;Color 1 shadow
COLOR2  =     $0E             ;Color 2 shadow

        *=     $4000           ;Start of cartridge area
        sei                     ;Disable interrupts
        cld                     ;Clear decimal mode
Start
        ldx     #$00
        lda     #$00
crloop1
        sta     $00,x           ;Clear zero page
        sta     $D400,x         ;Clear ANTIC
        sta     $C000,x         ;Clear GTIA
        sta     $E800,x         ;Clear POKEY
        dex
        bne     crloop1
        ldy     #$00            ;Clear Ram
        lda     #$02            ;Start at $0200
        sta     $81
        lda     #$00
        sta     $80
crloop2
        lda     #$00
crloop3
        sta     ($80),y         ;Store data
        iny                     ;Next byte
        bne     crloop3         ;Branch if not done page
        inc     $81             ;Next page
        lda     $81
        cmp     #$40            ;Check if end of RAM
        bne     crloop2         ;Branch if not

        ldx     #$21
dlloop                          ;Create Display List REM rc, could have just 
pointed to DL in ROM
        lda     dlist,x         ;Get byte
        sta     $1000,x         ;Copy to RAM
        dex                     ;next byte
        bpl     dlloop

        lda     #$03            ;point IRQ vector
        sta     $200            ;to BIOS routine
        lda     #$FC
        sta     $201
        lda     #$B8            ;point VBI vector
        sta     $202            ;to BIOS routine
        lda     #$FC
        sta     $203
        lda     #$B2            ;point Deferred VBI
        sta     $204            ;to BIOS routine
        lda     #$FC
        sta     $205
        lda     #$02   ;Changed to display inverse properly rc
        sta     CHACTL          ;Set Character Control
        lda     #$84            ;Set color PF2
        sta     COLOR2
        lda     #$0F            ;Set color PF1
        sta     COLOR1
        lda     #$00            ;Set Display list pointer
        sta     sDLISTL
        sta     DLISTL
        lda     #$10
        sta     sDLISTH
        sta     DLISTH
        lda     #$f8            ;Set Charcter Set Base
        sta     CHBASE
        lda     #$22            ;Enable DMA
        sta     sDMACTL
        lda     #$40            ;Enable NMI
        sta     NMIEN

print
        ldy     #$00
        cld
prloop
        lda     text1,y         ;Get character
        sec
        sbc     #$20            ;Convert to ATASCII
        sta     $1800,y         ;Store in video memory
        iny                     ;Next character
        cpy     #39
        bne     prloop
wait       ;endless loop that does something
  ldy  #$00
        lda     $1,y          ;Get big end RTC
        sta     $1850           ;Store in video memory + 2 lines down
  iny                     ;increment pointer: Yes, could have just directly 
referenced locations
        lda     $1,y          ;Get little end RTC
        sta     $1851           ;Store in video memory + 2 lines down +1 
over
        jmp     wait

        ;Display list data
        *=     $b000
dlist   .byte     $70,$70,$70,$42,$00,$18,$02,$02,$02,$02,$02,$02,$02
        .byte     $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02
        .byte      $02,$02,$02,$41,$00,$10

        ;Text data
         *=     $b100
text1   .byte      "HELLO WORLD CAPS ONLY TO KEEP IT SIMPLE"

        *=     $bffd
        .byte   $FF         ;Don't display Atari logo
        .byte   $00,$40     ;Start code at $4000

 .end

Back to comp.sys.atari.8bit | Previous | Next | Find similar


Thread

5200 emulator "Rick" <ricortes at yahoo dot com> - 2012-05-01 15:58 -0700

csiph-web