Code: Select all
org 50000
MAIN:
call RANDPOS
call DRAWSQUARE
DRAWSQUARE: ; this subroutine writes a value to video ram
ld a, 32 ; loads the value 32 (green) into accumulator
ld hl,22528 ; loads the value 22528 (start of videoram) into HL register pair
ld (hl), a ; loads the value of a (32) into the memory location pointed to by register pair HL (22528)
ret
RANDPOS:
ld b,5 ; as a test i put a dummy value into b register
ld a,b ; b gets loaded into accumulator
or c ; c is negated???
call $1E5A ; Not sure if I am accessing the function at the right point..
ret ;return
end 50000
From reading the disassembly I think its BC, and that I really only need to worry about B. But what value range is the subroutine expecting. I can see it calls other functions if it is fed a 0 value. So I am assuming its looking for an integer in B..
I am a bit confused by the rom disassembly.
What I want to do is get the output from random, rotate/shift the output till its in the vram range, then load that value into HL in the drawsquare subroutine.
I can crack on once I can figure out how to call the randomize rom routine. Sorry to ask such a simple question but this one had me stumped.
The thing is I am sure that the output is going to be a value less than 1 and a floating point value. So it leads me to believe that it must be loading the result to a register pair or a memory location..
Code: Select all
10 LET X=RND
20 PRINT X
30 GOTO 10