atari8: added skeleton files, dasm: better parsing of unresolved symbols

This commit is contained in:
Steven Hugg 2021-05-30 18:36:35 -05:00
parent 04c9b8105c
commit 6e7934d1fe
7 changed files with 239 additions and 2 deletions

View File

@ -0,0 +1,16 @@
#include <conio.h>
#include <atari5200.h>
// Atari 5200 20x24 screen example
int main() {
clrscr();
// position the cursor, output text
gotoxy(0,0);
cputs("Hello Atari 5200");
// draw a line
gotoxy(0,23);
chline(20);
return 0;
}

View File

@ -0,0 +1,115 @@
; Atari 5200 "Hello World" sample code
; Written by Daniel Boris (danlb_2000@yahoo.com)
; Modified by Steven Hugg @8bitworkshop
; Assemble with DASM
processor 6502
include "atari5200.inc"
org $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 #$2f
dlloop ;Create Display List
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 #$06
sta CHACTL ;Set Character Control
lda #$84 ;Set color PF2
sta COLOR0+2
sta COLOR0+4 ; bakground
lda #$0F ;Set color PF1
sta COLOR0+1
lda #$3f
sta COLOR0+0
lda #$58
sta COLOR0+3
lda #$00 ;Set Display list pointer
sta SDLSTL ;Shadow DLISTL
sta DLISTL
lda #$10
sta SDLSTH ;Shadow DLISTH
sta DLISTH
lda #$f8 ;Set Charcter Set Base
sta CHBASE
lda #$22 ;Enable DMA
sta SDMCTL ;Shadow DMACTL
lda #$40 ;Enable NMI
sta NMIEN
print
ldy #$00
cld
prloop
lda text1,y ;Get character
beq wait
cmp #$60
bcs lower
sec
sbc #$20 ;Convert to ATASCII
lower
sta $1800,y ;Store in video memory
iny ;Next character
bne prloop
wait
nop
jmp wait
;Display list data (starts at $1000)
dlist .byte $70,$70,$70 ;24 blank scanlines
.byte $46,$00,$18,$02 ;mode 6 @ $1800
.byte $41,$00,$10 ;JMP -> $1000
;Text data
org $b100
text1 .byte "Hello World! "
.byte $a1,$a2,$a3
.byte 0
org $bffd
.byte $FF ;Don't display Atari logo
.byte $00,$40 ;Start code at $4000

View File

@ -0,0 +1,15 @@
#include <conio.h>
#include <atari.h>
void main() {
// clear the screen
clrscr();
// position the cursor, output text
gotoxy(0,1);
// print some text
cputs("Hello Atari 8-bit World!\r\n");
// cartridge ROMs do not exit, so loop forever
while (1) {
}
}

View File

@ -0,0 +1,75 @@
; Atari "Hello World" sample code
; Written by Daniel Boris (dboris@comcast.net)
; Modified by Steven Hugg @8bitworkshop
; Assemble with DASM
processor 6502
include "atari.inc"
org $a000 ;Start of left cartridge area
Start
ldx #(dlistend-dlist)
dlloop ;Create Display List
lda dlist,x ;Get byte
sta $1000,x ;Copy to RAM
dex ;next byte
bpl dlloop
lda #$06
sta CHACTL ;Set Character Control
lda #$84 ;Set color PF2
sta COLOR0+2
sta COLOR0+4 ; bakground
lda #$0F ;Set color PF1
sta COLOR0+1
lda #$3f
sta COLOR0+0
lda #$58
sta COLOR0+3
lda #$00 ;Set Display list pointer
sta SDLSTL ;Shadow DLISTL
lda #$10
sta SDLSTH ;Shadow DLISTH
lda #$e0 ;Set Charcter Set Base
sta CHBAS
lda #$22 ;Enable DMA
sta SDMCTL ;Shadow DMACTL
print
ldy #$00
cld
prloop
lda text1,y ;Get character
beq wait
cmp #$60
bcs lower
sec
sbc #$20 ;Convert to ATASCII
lower
sta $1800,y ;Store in video memory
iny ;Next character
bne prloop
wait
nop
jmp wait
;Display list data (starts at $1000)
dlist .byte $70,$70,$70 ;24 blank scanlines
.byte $42,$00,$18,$02 ;mode 2 @ $1800
.byte $41,$00,$10 ;JMP -> $1000
dlistend
;Text data
;(will be converted to ATASCII and stored in video RAM)
text1 .byte "Hello World! " ; ASCII text
.byte $c0 ; ATASCII
.byte 0
;Cartridge footer
org CARTCS
.word Start ; cold start address
.byte $00 ; 0 == cart exists
.byte $04 ; boot cartridge
.word Start ; start

View File

@ -0,0 +1,14 @@
GRAPHICS 3
?
? "HELLO BASIC WORLD!"
COLOR 2
FCOLOR 1
PLOT 0,0
FILLTO 39,19
REPEAT
PAUSE 0
UNTIL KEY()

View File

@ -900,7 +900,7 @@ a58lHiUcJQkD/Lj8svyh/gL9svxI5gzQBBkiJhkj9SUfJR8lHiUBI/0x/QD8`;
///
PLATFORMS['atari8-800'] = _Atari800Platform;
PLATFORMS['atari8-800xl'] = _Atari800Platform;
PLATFORMS['atari8-5200'] = _Atari5200Platform;
PLATFORMS['atari8-800xl.mame'] = Atari800MAMEPlatform;
PLATFORMS['atari8-5200.mame'] = Atari5200MAMEPlatform;

View File

@ -802,12 +802,14 @@ function parseDASMListing(lstpath:string, lsttext:string, listings:CodeListingMa
// TODO: ignore IFCONST and IFNCONST usage
for (let key in unresolved) {
let l = restline || line;
// find the identifier substring
let pos = l.indexOf(key);
if (pos >= 0) {
// strip the comment, if any
let cmt = l.indexOf(';');
if (cmt < 0 || cmt > pos) {
// make sure identifier is flanked by non-word chars
if (/\w+/.test(key) && new RegExp("\\b"+key+"\\b").test(key)) {
if (new RegExp("\\b"+key+"\\b").exec(l)) {
errors.push({
path:filename,
line:linenum,