Nice text

Basic and Machine Language

Moderator: Moderators

Forbidden64
Vic 20 Hobbyist
Posts: 146
Joined: Sun Feb 28, 2016 9:59 pm
Location: CA USA

Re: Nice text

Post by Forbidden64 »

Well I managed to use HESMON for freeee :D! I figured out how to output the disassembly using the O command which switches the output to the "printer" which in my case was a text file, just like Mike taught me to do in basic, only this time applied to ML. I then formatted it with notepad ++. I was working on a "fast" pure basic AI and was chalk full of forum ?NEWB SYNTAX ERROR. I since learned some even faster techniques to use in basic, which I will likely update to that thread soon. To that end though, I really like your prg so far, it is way more involved than the 208208 project linked early on when you were starting the project, which actually didn't work at all even in PAL mode on an emulator, manually calling the init routine at various addresses. Yours has the courtesy of adding a basic system call which allows very easy, friendly loading! There is a sync that they used though which might be useful to you as far as timing goes:

Code: Select all

;208208 timing and sync
;synchronize with the screen
sync
	ldx	#$84	; wait for this raster line (times 2)
raster1	cpx	$9004
	bne	raster1
	ldy	#9
	bit	$24
raster2	ldx	$9004
	txa
	bit	$24
	ldx	#24
back	dex
	bne	back	; first spend some time (so that the whole
	cmp	$9004	; loop will be 2 raster lines)
	bcs	forward	; save one cycle if $9004 changed too late
forward	dey
	bne	raster2
			; now it is fully synchronized
			; 6 cycles have passed since last $9004 change
			; and we are on line 2*($71+9)=244
			; initialize the timers
timers
	lda	#$40	; enable Timer A free run of both VIAs
	sta	$912b
	lda	#<TIMER_VALUE
	ldx	#>TIMER_VALUE
	sta	$9126
	stx	$9125	; start the IRQ timer A
pointers
	lda	#<irq	; set the raster IRQ routine pointer
	sta	$314
	lda	#>irq
	sta	$315
	lda	#$c0
	sta	$912e	; enable Timer A underflow interrupts
	rts		; return
Being newer to assembler/ML in general in terms of actual study beyond what you find in introductory books written very likely by people who were probably also new to assembler lol, I found the methods used in 208208 and in yours very intriguing indeed for looping structures etc! None of the books I read touched on "implied branching" where you don't actually use a comparison op code, but rather the results of another action on a flag directly to branch. I don't know enough to understand why 208208 straight up doesn't work at all even in a pal emulator, but I do look forward to finding out. First however, I am more interested in studying yours, since it has so much more meat in it/it at least kind of works hehe. The 208208 one has massive amounts of unrolled looping eating up gobs of memory as well, but yours has more going on in terms of control code. I tried "SYS"ing to the addresses labelled as init etc in the 208208 but no dice. I am only a small way into commenting it[nice text], but as I do so, straight from disassembly I find it a much greater learning experience than just reading commented macro assembly because I really have to think critically about what these collections of low level commands are actually doing as a group. I am literally commenting every line lol, and then deciding what they are doing and adding a comment section above each group. It would be a great tutorial/supplemental by itself when its done for enthusiastic newbs like myself.

Code: Select all

;alleged entry point for 208208?
begin			; SYS 25063 (initialize)
	jmp	gron		; SYS 24835
	jmp	groff		; SYS 24838
	jmp	grclear		; SYS 24841
Post Reply