Jump to content
IGNORED

Anyone here familiar with the Atom and it's emulators?


JamesD

Recommended Posts

I want to test some code for the Acorn Atom and documentation on developing for the system is a bit... spotty.
Nothing about "here is what you need to get started" anyway.
I tracked down enough hardware info to where I think the code should run but I still haven't found what page 0 locations are ok to use.
What tools are best for transferring a binary executable file to a disk or tape image and how do I launch it from the emulator?

And for that matter, which emulator is best?

I tried creating an account on http://www.stardot.org.uk/which seems to have the most Atom support I've found but it appears to be offline.
How convenient... right when I needed it. LOL

Any help would be appreciated!

Link to comment
Share on other sites

Stardot is the right place to help you with all things Acorn/BBC, but as you found, it's down ATM. I'll expect it'll be up and running tomorrow sometime.

It's up but they are taking their sweet time approving my account.

 

I guess I'll work on a Plus/4 version (80 column) and worry about the Atom when I'm done with that.

At least I already know how to deal it and actually have a machine.

 

Link to comment
Share on other sites

Perhaps you're using an unusual email provider, which causes the admin not to let your account through? It happened to me once, some forum I signed up for but never got approved, because I don't use Hotmail, Gmail, AOL, Yahoo or a similar "known" provider. BS thinking I know, but that was the admin's frank and rather unwelcoming answer when I asked why nothing was happening. Just like bot spammers would be more likely to register their own domain names and pay for expensive web hotel hosting, than regular, honest people who think they can do better than Hotmail.

Link to comment
Share on other sites

FWIW, I found the format info for a .ATM file and I can load it it MESS.
I thought that was supposed to automatically run but apparently not... or I need to update MESS.
If anyone knows how to execute a specific address on the Atom that's the only thing I really need to know now.

Link to comment
Share on other sites

I figured out how to make a file for the emulator and how to load it. It just requires a simple header for .ATM files.
MESS seemed to have issues with quickload so I couldn't use it and making it into a tape file didn't seem to work either.
Atomulator's load doesn't seem to work properly even though the Atom displays the load address, execute address, and length it read from the file.
Until I resolve that I can't test the Atom version, but here is a preliminary version.
Feel free to tell me how horrible the code is.
Just remember I haven't worried about optimizing every last cycle.
I have spent a little effort optimizing the code so it should be fairly fast but I'm sure some 6502 guru will fine some better way of doing something.
*edit*
I used more complex addressing for accessing the font to save a lot of clock cycles from the multiply by 7 required if the font bytes are in order.
I haven't checked to see the exact comparison of clock cycles but I think this will be slightly faster.

 

;**************************************************
;* File: print64.6502
;**************************************************
;* Copyright (c) 2015 James Diffendaffer
;*
;*  I hereby grant an unrestricted license to use this code as long
;*  as you give me credit for my work.
;**************************************************
;* Description:
;*  Emulates a 64 character by 24 line text display using 
;*  4 bit wide characters on a 256 * 192 graphics display.
;*  This version is for the Acorn Atom and 6502 CPU
;*
;*  Contains functions to print a string at the current screen location,
;*  print strings @ a specific screen location, line wrapping, scrolling,
;*  clear screen, the character generator and a font.
;*  Characters are stored with identical data in the left and right nibble
;*  to make rendering faster and several loops have been unrolled for speed.
;*  This code has not been tested but assembles with the TASM assembler.
;*  
;*  Derived from my MC-10 6803 code
;**************************************************
;* Version history:
;*	V 0.04 Date: Sept 20, 2015 - Replaced LDA TAY with LDY and reordered code in left and right nibble print routines
;*  V 0.03 Date: Sept 19, 2015 - Added Atom ATM file header and started Plus/4 80 column version.
;*  V 0.02 Date: Sept 9, 2015 - finished print@ and print functions
;*	V 0.01 Date: Sept 8, 2015 - Created initial 6502 character generation code
;**************************************************
#define EQU     .EQU
#define ORG     .ORG
#define RMB     .BLOCK
#define FCB     .BYTE
#define FCC     .TEXT
#define FDB     .WORD
#define END		.END

#define equ     .EQU
#define org     .ORG
#define rmb     .BLOCK
#define fcb     .BYTE
#define fcc     .TEXT
#define fdb     .WORD
#define	end		.END


#define	BytesPerLine	32
#define	ScreenHeight	192
		org	$0000		; page zero variables
		
string	rmb	2			; string pointer
prntat	rmb	2			; Print @ location like Microsoft BASIC
row		rmb	1			;
col		rmb	1			;
temp0	rmb	2			; temporary storage
fscreen	rmb	2			; screen pointer for character generator
fscreen1	rmb	2			; screen pointer for character generator
ytemp	rmb	1			; temporary storage for y


;****************************
;* Acorn Atom ATM file header
;****************************
FNAME	FCC	PRINT64
		fcb	0,0,0,0,0,0,0,0,0		;File Name up to 12 characters + zero padding
;		fcb	0,0,0,0,0				;File Name up to 12 characters + zero padding

ADDRESS	fdb	$2B00					;current address is load address
EXECADD	fdb	$2B00					;current address is execute address
FLENGTH	fdb	(EOF-$2B00)				;file length = end of file value (EOF) munus start address
;****************************
		org	$2B00		; free RAM on Atom


		
;**************************************************
;* graphics text routine macros
;**************************************************
#DEFINE PRINTAT(loc,str) lda #<loc \ sta <prntat \ lda #>loc \ sta >prntat \ lda #>str \ sta <string \ lda #>str \ sta >string \ jsr print_at
#DEFINE PRINT(str) lda #>str \ sta <string \ lda #>str \ sta >string \ jsr print

;#DEFINE SETVDG()


;**************************************************
;* NAME: textdemo
;**************************************************
;* DESCRIPTION:
;*  a short program to demonstrate the use of 
;*  routines in the graphics library
;**************************************************
Textdemo:
	;save registers
	pha
	txa
	pha
	tya
	pha

	;clear the screen before we show it
	jsr		cls
;Acorn Atom
	; set the graphics mode here
	lda		#$F0			; RG6
	sta		$B000			; 6847 control - GM2 GM1 GM0 A/G 0 0 0 0
;Commodore Plus/4
;	lda		#$36
;	sta		$FF06			;set hi-res graphics mode

	
	
	lda		#0
	sta		row
	sta		col
	
; 64 character/line demo, prints entire character set
	lda		<String
	sta		<string
	lda		>String
	sta		>string
	ldx		#0
	
	lda		#' '			; the first character in the font
StringBuild:
	sta		,x
	inx
	inc
	cmp		#'~'				; are we past the last character in the font?
	bne		StringBuild
	lda		#0
	sta		,x
start:
	PRINT(string)
	bra	  start
	
	;restore registers
	pla
	tay
	pla
	tax
	pla

	rts
	
;**************************************************
;* cls
;**************************************************
;* clears the Atom hi-res screen
;**************************************************
#define clearblock()	 	sta (fscreen),y \ iny \ sta (fscreen),y \ iny \ sta (fscreen),y \ iny \ sta (fscreen),y \ iny \ sta (fscreen),y \ iny \ sta (fscreen),y \ iny \ sta (fscreen),y \ iny \ sta (fscreen),y \ iny
cls:
	lda		$80
	sta		<fscreen
	lda		#0
	sta		>fscreen
	tay					;clear y
clsloop:
	clearblock()
	bcc		clsloop
	lda		>fscreen
	inc
	cmp		$98				 ;$8000 + $1800
	beq		clsexit
	sta		>fscreen
	lda		#0
	bne		clsloop			;flag should still be set from cmp
clsexit:
	rts
	
	
;**************************************************
;* scroll
;**************************************************
;* scrolls the hi-res text display
;**************************************************
#define	scrollline()	 lda (fscreen1),y \ sta (fscreen),y \ iny \ lda (fscreen1),y \ sta (fscreen),y \ iny \ lda (fscreen1),y \ sta (fscreen),y \ iny \ lda (fscreen1),y \ sta (fscreen),y \ iny \ lda (fscreen1),y \ sta (fscreen),y \ iny \ lda (fscreen1),y \ sta (fscreen),y \ iny \ lda (fscreen1),y \ sta (fscreen),y \ iny \ lda (fscreen1),y \ sta (fscreen),y \ iny
scroll:
	lda		$80
	sta		<fscreen
	inc
	sta		<fscreen1
	lda		$00
	sta		>fscreen
	sta		>fscreen1
	tay					;clear y
scrollloop:
	scrollline()
	bcc		scrollloop
	lda		>fscreen1
	inc
	cmp		$98
	beq		scrollexit
	sta		>fscreen1
	inc		>fscreen
	clc
	bcc		scrollloop
scrollexit:
	rts
	
	
;**************************************************
;* print_at
;**************************************************
;* Prints a string at a screen location
;* works similar to print@ in Microsoft BASIC
;*  prntat contains @ location
;*  string contains string pointer
;* falls through to _print
;**************************************************
print_at:
	lda		<prntat				;
	and		#%00111111			;mask off row bits    (BytesPerLine*2)-1
	sta		col					;save the column
	lda		<prntat				;copy LSB
	and		#%11000000			;mask off column bits    254-(BytesPerLine*2)
	asl							;rotate bits into bottom of a
	asl							;rol?
	asl
	sta		row					;
	lda		>prntat
	asl
	asl
;	clc
	adc		row
	sta		row					;save row info
	
	
;**************************************************
;* print
;**************************************************
;* Prints a zero terminated string at the current x,y location
;*  string contains the string pointer
;* maximum sting length is 256
;**************************************************
print:
	ldy		#0
prn1:
	lda		(string),y			; get a character from the string
	cmp		#0					; strings are zero terminated
	beq		_printexit			; exit if it's a zero

	sty		ytemp				; save x
	jsr		print_64			; print the character
	ldy		ytemp				; restore x

	;update column, row, and scroll when needed
	lda		col					; next column
	inc
	sta		col
	cmp		#(BytesPerLine*2)	; 64 chsrs / line (0-63)
	bne		_cexit				; is column past the end of a line?

	lda		#0
	sta		col					; set column to zero
	lda		row					; increment the row
	inc
	sta		row
	cmp		#(ScreenHeight/8)	; 24 lines (0-23)
	bcc		_cexit				; branch if row isn't past the end of the screen

	dec		row					; reduce row back to last line
	clc							; branch always
	bcs		_cexit
	jsr		scroll				; scroll the screen

_cexit:	
	iny							; increment the string pointer y
	bcc		prn1				; keep printing

	inc		>string				; update string pointer MSB
	bcc		prn1				; keep printing

_printexit:						; we are done
	
	rts


;**************************************************
; NAME: print_64
;**************************************************
;* Description:
;*  64 Column text display driver
;*  Routine does not print at pixel X,Y but
;*  prints at a character position.
;**************************************************
print_64:
	; register a contains character
;	clc
	sbc		#' '				; printable character set data starts at space, ASCII 32
	tax							; save as character table offset

	; point screen to $8000 + row (base screen address + row)
	lda		#$80
	adc		row					; adding row to MSB = 256 * row
	sta		>fscreen
	
	; add the column
	lda		col					; 2 columns / byte
	lsr
	sta		<fscreen			; save it

	bcs		rightnibble


;**************************************************
;* left nibble 
;**************************************************
leftnibble:
;	ldy		#0					; top line is always black (1st byte of the font)
;								; start at zero offset from screen address
;	sta		(fscreen),y			; write to the screen

	lda		FCol1,X				; get the 2nd byte of the font
	and		%11110000			; mask area used by new character
	sta		temp0				; save it
	ldy		#32					;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%00001111			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen

	lda		FCol2,X				; get the 3rd byte of the font
	and		%11110000			; mask area used by new character
	sta		temp0				; save it
	ldy		#64					;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%00001111			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen

	lda		FCol3,X				; get the 4th byte of the font
	and		%11110000			; mask area used by new character
	sta		temp0				; save it
	ldy		#96					;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%00001111			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen

	lda		FCol4,X				; get the 5th byte of the font
	and		%11110000			; mask area used by new character
	sta		temp0				; save it
	ldy		#128				;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%00001111			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen

	lda		FCol5,X				; get the 6th byte of the font
	and		%11110000			; mask area used by new character
	sta		temp0				; save it
	ldy		#160				;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%00001111			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen

	lda		FCol6,X				; get the 7th byte of the font
	and		%11110000			; mask area used by new character
	sta		temp0				; save it
	ldy		#192				;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%00001111			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen

	lda		FCol7,X				; get the 8th byte of the font
	and		%11110000			; mask area used by new character
	sta		temp0				; save it
	ldy		#224				;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%00001111			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen
	
	rts
	
	
;**************************************************
; right nibble
;**************************************************
rightnibble:
;	ldy		#0					; top line is always black (1st byte of the font)
;								; start at zero offset from screen address
;	sta		(fscreen),y			; write to the screen

	lda		FCol1,X				; get the 2nd byte of the font
	and		%00001111			; mask area used by new character
	sta		temp0				; save it
	ldy		#32					;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%11110000			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen

	lda		FCol2,X				; get the 3rd byte of the font
	and		%00001111			; mask area used by new character
	sta		temp0				; save it
	ldy		#64					;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%11110000			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen

	lda		FCol3,X				; get the 4th byte of the font
	and		%00001111			; mask area used by new character
	sta		temp0				; save it
	ldy		#96					;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%11110000			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen

	lda		FCol4,X				; get the 5th byte of the font
	and		%00001111			; mask area used by new character
	sta		temp0				; save it
	ldy		#128				;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%11110000			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen

	lda		FCol5,X				; get the 6th byte of the font
	and		%00001111			; mask area used by new character
	sta		temp0				; save it
	ldy		#160				;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%11110000			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen

	lda		FCol6,X				; get the 7th byte of the font
	and		%00001111			; mask area used by new character
	sta		temp0				; save it
	ldy		#192				;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%11110000			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen

	lda		FCol7,X				; get the 8th byte of the font
	and		%00001111			; mask area used by new character
	sta		temp0				; save it
	ldy		#224				;point to next screen byte
	lda		(fscreen),y			; read byte at destination
	and		%11110000			; mask off unused half
	ora		temp0				; combine background with font data
	sta		(fscreen),y			; write back to the screen
	
	rts
		
	

;**************************************************
; HALF WIDTH 4x8 FONT
; Top row is always zero and not stored (336 bytes)
; characters are 4 bits wide and 7 bits high 
; (the top row is always blank)
; There are two characters stored in each group of
; 7 bytes.  Each byte has bits for one character in
; the high nibble and bits for another in the low nibble
; Font borrowed from Sinclair Spectrum code
;**************************************************
.MODULE Font
font:
FCol1:
	.byte	$00, $22, $55, $22, $22, $55, $22, $22, $11, $44, $22, $00, $00, $00, $00, $11
	.byte	$22, $22, $22, $77, $55, $77, $11, $77, $22, $22, $00, $00, $00, $00, $00, $22
	.byte	$22, $33, $66, $33, $66, $77, $77, $33, $55, $77, $33, $55, $44, $55, $66, $22
	.byte	$66, $22, $66, $33, $77, $55, $55, $55, $55, $55, $77, $33, $44, $66, $22, $00
	.byte	$22, $00, $44, $00, $11, $00, $11, $00, $44, $22, $11, $44, $66, $00, $00, $00
	.byte	$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $11, $22, $44, $55, $66
FCol2:
	.byte	$00, $22, $55, $77, $77, $11, $44, $22, $22, $22, $77, $00, $00, $00, $00, $11
	.byte	$55, $66, $55, $11, $55, $44, $22, $11, $55, $55, $00, $00, $11, $00, $44, $55
	.byte	$55, $55, $55, $44, $55, $44, $44, $44, $55, $22, $11, $55, $44, $77, $55, $55
	.byte	$55, $55, $55, $44, $22, $55, $55, $55, $55, $55, $11, $22, $44, $22, $55, $00
	.byte	$11, $00, $44, $00, $11, $00, $22, $00, $44, $00, $00, $44, $22, $00, $00, $00
	.byte	$00, $00, $00, $00, $22, $00, $00, $00, $00, $00, $00, $22, $22, $22, $aa, $99
FCol3:
	.byte	$00, $22, $00, $22, $66, $22, $33, $00, $44, $11, $22, $22, $00, $00, $00, $22
	.byte	$55, $22, $11, $22, $55, $66, $66, $11, $22, $55, $22, $22, $22, $77, $22, $11
	.byte	$77, $55, $66, $44, $55, $66, $66, $44, $77, $22, $11, $66, $44, $55, $55, $55
	.byte	$55, $55, $55, $22, $22, $55, $55, $55, $22, $55, $22, $22, $22, $22, $00, $00
	.byte	$00, $33, $66, $33, $33, $22, $77, $33, $66, $66, $33, $55, $22, $55, $66, $22
	.byte	$66, $33, $55, $33, $77, $55, $55, $55, $55, $55, $77, $22, $22, $22, $00, $66
FCol4:
	.byte	$00, $22, $00, $22, $33, $22, $55, $00, $44, $11, $55, $77, $00, $77, $00, $22
	.byte	$55, $22, $22, $11, $77, $11, $55, $22, $55, $33, $00, $00, $44, $00, $11, $22
	.byte	$77, $77, $55, $44, $55, $44, $44, $55, $55, $22, $55, $55, $44, $55, $55, $55
	.byte	$66, $55, $66, $11, $22, $55, $55, $55, $22, $22, $22, $22, $22, $22, $00, $00
	.byte	$00, $55, $55, $44, $55, $55, $22, $55, $55, $22, $11, $66, $22, $77, $55, $55
	.byte	$55, $55, $66, $66, $22, $55, $55, $55, $22, $55, $33, $44, $22, $11, $00, $44
FCol5:
	.byte	$00, $00, $00, $77, $77, $44, $55, $00, $44, $11, $00, $22, $00, $00, $00, $44
	.byte	$55, $22, $44, $55, $11, $55, $55, $22, $55, $22, $00, $00, $22, $77, $22, $00
	.byte	$44, $55, $55, $44, $55, $44, $44, $55, $55, $22, $55, $55, $44, $55, $55, $55
	.byte	$44, $55, $55, $55, $22, $55, $22, $77, $55, $22, $44, $22, $11, $22, $00, $00
	.byte	$00, $55, $55, $44, $55, $66, $22, $55, $55, $22, $11, $55, $22, $55, $55, $55
	.byte	$55, $55, $44, $33, $22, $55, $22, $77, $22, $55, $66, $22, $22, $22, $00, $66
FCol6:
	.byte	$00, $22, $00, $22, $22, $55, $33, $00, $22, $22, $00, $00, $22, $00, $11, $44
	.byte	$22, $77, $77, $22, $11, $22, $22, $22, $22, $44, $22, $22, $11, $00, $44, $22
	.byte	$33, $55, $66, $33, $66, $77, $44, $33, $55, $77, $22, $55, $77, $55, $55, $22
	.byte	$44, $33, $55, $22, $22, $22, $22, $55, $55, $22, $77, $22, $11, $22, $00, $00
	.byte	$00, $33, $66, $33, $33, $33, $44, $33, $55, $77, $55, $55, $77, $55, $55, $22
	.byte	$66, $33, $44, $66, $11, $22, $22, $55, $55, $33, $77, $22, $22, $22, $00, $99
FCol7:
	.byte	$00, $00, $00, $00, $00, $00, $00, $00, $11, $44, $00, $00, $22, $00, $00, $00
	.byte	$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $22, $00, $00, $00, $00
	.byte	$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
	.byte	$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $33, $00, $66, $00, $Ff
	.byte	$00, $00, $00, $00, $00, $00, $00, $66, $00, $00, $22, $00, $00, $00, $00, $00
	.byte	$44, $11, $00, $00, $00, $00, $00, $00, $00, $66, $00, $11, $00, $44, $00, $66

EOF	equ *
	
String	rmb	256

	.END

 

 

Edited by JamesD
Link to comment
Share on other sites

  • 2 weeks later...

Did you get anywhere with running the code? I do have an Atom though it spends most of its time in a box and I haven't used it much.

 

In case it helps, I looked up running machine language code in Atomic Theory and Practice and there were the following commands:-

 

LINK - link to machine code subroutine (returns with RTS, A,X and Y are initialised to the same-named BASIC variables and decimal mode flag is cleared) e.g. LINK #FFE3

 

*RUN - load and run a machine code file, e.g. *RUN "FILENAME" SSS where "SSSS" is an optional load address. The execution address is as stored in the file even if you relocate it.

 

*LOAD - load a named file, optionally relocated, e.g. *LOAD "FILENAME" SSSS where "SSSS" is again the optional relocated load address.

Link to comment
Share on other sites

People on stardot helped me out a bit.
After their response I loaded up the file in a hex editor.
As it turns out, TASM didn't like having an ORG statement after the header and generated all zeros through the file after the header even thought the .LST file had the right content.
The emulator was trying to run the program but there was no real code to run.

Now to bug fixing.


FWIW, it's my fault stardot didn't approve me right away. I was supposed to send an email and missed that little fact on the registration screen.

Edited by JamesD
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...