From: Frank K. <fbk...@ve...> - 2007-07-11 19:23:54
|
martinknappe wrote: > > > Got the error(s) > > > its still not working, it seems im still in an endless loop > > somewhere: > > > > BITS 16 > > jmp 07C0h:start > > > > start: > > mov ax, cs > > mov ds, ax > > push txt > > rept: > > call print > > add sp, 2 > > jmp rept > > Here I'm jumping back to the procedure call, not to where the > parameter is pushed... Yup. Good catch! > > print: > > push bp > > mov bp, sp > > push ax > > push bx > > mov ah, 0Eh > > mov bx, [bp+2] > > This needs to read [bp+4]. You had it [bp + 4] originally, no? > Maybe someone can explain that to me. I > thought in 16Bit code [bp] is the return address right after calling > the procedure and [bp+2] is the parameter pushed last unto the stack, > but it seems I'm wrong here :-( Correct, so far... but then you "push bp"... Stack looks like: ??? ; more parameters? param0 ; return address segment, for a "far" call return address offset caller's bp So [bp + 4] is correct. Best, Frank |