Nothing challenging to you old hands but something to help me orient myself with the Model B... In short it's a Flood-it type game. I've something mostly complete now with the core control and input handled in BASIC and the grunt elements in assembly. There's no doubt been an unbelievable amount of unnecessary diversions and wheel reinvention but that seems to be the approach I need to take to learn. Anyhow...
I'm trying to use the RNDX routine to generate the play area, and I've come unstuck... From the BASIC ROM User Guide it appears that I should be able to do this and to some degree I can, in that the numbers I need are generated. The issues become apparent when control returns to the BASIC code. If I contain the calls to 'my' routine in a procedure then I get an 'at line X' message when returning from the proc. X will be the line I call the procedure from. If I keep the call to my code in the mainline code then processing will appear to continue but odd things will happen further into the run. The odd things vary depending on how many numbers I generate.
I've stripped things back to a contained test case. The issue is apparent even when making a single call to RNDX. Can anyone help me determine what's going on?
Code: Select all
rndx =&AF24 colrs =&81:?colrs=5 PROC_assemble PRINT "START" PROC_randomize PRINT "END" END DEF PROC_randomize CALL rndxtest:PRINT !result; ENDPROC DEF PROC_assemble DIM mc% 200 FOR pass% = 0 TO 2 STEP 2 P% = mc% [OPT pass% .result EQUD 0 EQUB 0 .rndxtest LDA &6 \ HIMEM lo STA &4 \ save in &4 LDA &7 \ HIMEM hi STA &5 \ save in &5 LDA colrs \ get next byte of rndxval LDX #0 \ zeroise loop counter STA &2A,X \ save in IWA STX &2B STX &2C STX &2D JSR rndx \ do rndx JSR saveiwa \ copy IWA into result RTS \ bye bye .saveiwa LDX #0 \ zeroise loop counter .loopiwa LDA &2A,X \ get next byte of IWA STA result,X \ save in result INX \ bump X CPX #4 \ end of loop ? BCC loopiwa \ no - back RTS \ back ] NEXT pass% ENDPROC
Another approach I'm considering is to hack together a routine specific to my case, but I think I'd rather sort this if I can and and move on. As mentioned above this was mostly intended as an exercise to help get me started. I'd be nice to move on to something fresh, though I've no firm plans as to what that might be...