Skip to main content
added 185 characters in body
Source Link
Sep Roland
  • 4.6k
  • 16
  • 27

You need to enlarge tape because your initialization zeroes 101 bytes.

 section .bss
 tape resb 101

TheWhen in graphics mode, the teletype function uses the BL and BH registers as arguments.

 mov  bx,0007h ;Display page 0 and Color 7 
 (ifmov in graphicsah, mode)0Eh
 mov  al, byte [tape +di]
 int  10h

When in text mode, the teletype function uses the BH register as an argument.

 mov  bh,0     ;Display page 0
 mov  ah, 0Eh
 mov  al, byte [tape +di]
 int  10h

You can optimize the setup code by iterating backwards. It shaves off 2 instructions! It too will leave DI=0.

 mov  di, 101
setup_loop:
 sub di,1
 mov  byte [tape + di], 0
 jnz  setup_loop

I don't know if you would care but the code for [ ] by itself produces an infinite loop if the byte at [tape + di] is anything but zero.

You need to enlarge tape because your initialization zeroes 101 bytes.

 section .bss
 tape resb 101

The teletype function uses the BL and BH registers as arguments.

 mov  bx,0007h ;Display page 0 and Color 7 (if in graphics mode)
 mov  ah, 0Eh
 mov  al, byte [tape +di]
 int  10h

You can optimize the setup code by iterating backwards. It shaves off 2 instructions! It too will leave DI=0.

 mov  di, 101
setup_loop:
 sub di,1
 mov  byte [tape + di], 0
 jnz  setup_loop

I don't know if you would care but the code for [ ] by itself produces an infinite loop if the byte at [tape + di] is anything but zero.

You need to enlarge tape because your initialization zeroes 101 bytes.

 section .bss
 tape resb 101

When in graphics mode, the teletype function uses the BL and BH registers as arguments.

 mov  bx,0007h ;Display page 0 and Color 7 
 mov  ah, 0Eh
 mov  al, byte [tape +di]
 int  10h

When in text mode, the teletype function uses the BH register as an argument.

 mov  bh,0     ;Display page 0
 mov  ah, 0Eh
 mov  al, byte [tape +di]
 int  10h

You can optimize the setup code by iterating backwards. It shaves off 2 instructions! It too will leave DI=0.

 mov  di, 101
setup_loop:
 sub di,1
 mov  byte [tape + di], 0
 jnz  setup_loop

I don't know if you would care but the code for [ ] by itself produces an infinite loop if the byte at [tape + di] is anything but zero.

more info
Source Link
Sep Roland
  • 4.6k
  • 16
  • 27

You need to enlarge tape because your initialization zeroes 101 bytes.

 section .bss
 tape resb 101

The teletype function uses the BL and BH registers as arguments.

 mov  bx,0007h ;Display page 0 and Color 7 (if in graphics mode)
 mov  ah, 0Eh
 mov  al, byte [tape +di]
 int  10h

You can optimize the setup code by iterating backwards. It shaves off 2 instructions! It too will leave DI=0.

 mov  di, 101
setup_loop:
 sub di,1
 mov  byte [tape + di], 0
 jnz  setup_loop

I don't know if you would care but the code for [ ] by itself produces an infinite loop if the byte at [tape + di] is anything but zero.

You need to enlarge tape because your initialization zeroes 101 bytes.

section .bss
tape resb 101

The teletype function uses the BL and BH registers as arguments.

mov bx,0007h ;Display page 0 and Color 7 (if in graphics mode)
mov ah, 0Eh
mov al, byte [tape +di]
int 10h

You need to enlarge tape because your initialization zeroes 101 bytes.

 section .bss
 tape resb 101

The teletype function uses the BL and BH registers as arguments.

 mov  bx,0007h ;Display page 0 and Color 7 (if in graphics mode)
 mov  ah, 0Eh
 mov  al, byte [tape +di]
 int  10h

You can optimize the setup code by iterating backwards. It shaves off 2 instructions! It too will leave DI=0.

 mov  di, 101
setup_loop:
 sub di,1
 mov  byte [tape + di], 0
 jnz  setup_loop

I don't know if you would care but the code for [ ] by itself produces an infinite loop if the byte at [tape + di] is anything but zero.

Source Link
Sep Roland
  • 4.6k
  • 16
  • 27

You need to enlarge tape because your initialization zeroes 101 bytes.

section .bss
tape resb 101

The teletype function uses the BL and BH registers as arguments.

mov bx,0007h ;Display page 0 and Color 7 (if in graphics mode)
mov ah, 0Eh
mov al, byte [tape +di]
int 10h